Description
Currently, some remote methods are unrepresentable, e.g. apps_std.mkdir(in string, in int)
. This method uses a variable-length input buffer, with the
length stored as the first 32-bit word in the primary input buffer. The current
struct fastrpc_function_def_interp2
has no information about the arrangement
of parameters. It assumes that all direct input words (such as ints, longs, or
structs) go before all lengths in the primary input buffer.
It also can't represent remotectl.set_param(in int, in sequence<int>)
. This
method has a variable-length input buffer. The number of elements is stored in
the primary input buffer, but each element is 4 bytes. Currently, an assumption
is made that each element in a variable-length input buffer is 1 byte.
A new method definition could accommodate these remote methods:
// A 32-bit word in a primary buffer
#define HEXAGONRPC_WORD 0
// A delimiter between the inputs and outputs
#define HEXAGONRPC_DELIMITER 0xFFFFFFFF
struct hrpc_method_def_interp3 {
uint32_t msg_id;
bool has_prim_out;
size_t n_args;
const uint32_t *args;
};
Here, the elements of args
each represent the byte size of each element in a
variable-length buffer. For a sequence of octets, it is 1. A value of 0 denotes
a 32-bit word which is a direct parameter to the remote method.
This still doesn't perfectly accommodate apps_std.readdir(in long, rout struct, rout int)
, which outputs a 260-byte struct. While this remote method can still be
represented, calling the method is tedious:
static inline int apps_std_readdir(struct fastrpc_context *ctx,
uint32_t handle_lo, uint32_t handle_hi,
uint32_t *inode, char *path, uint32_t *eof)
{
uint32_t *buf = (uint32_t *) path;
return hexagonrpc(&apps_std_readdir_def, ctx,
handle_lo, handle_hi, inode,
&buf[0], &buf[1], &buf[2], &buf[3],
&buf[4], &buf[5], &buf[6], &buf[7],
&buf[8], &buf[9], &buf[10], &buf[11],
&buf[12], &buf[13], &buf[14], &buf[15],
&buf[16], &buf[17], &buf[18], &buf[19],
&buf[20], &buf[21], &buf[22], &buf[23],
&buf[24], &buf[25], &buf[26], &buf[27],
&buf[28], &buf[29], &buf[30], &buf[31],
&buf[32], &buf[33], &buf[34], &buf[35],
&buf[36], &buf[37], &buf[38], &buf[39],
&buf[40], &buf[41], &buf[42], &buf[43],
&buf[44], &buf[45], &buf[46], &buf[47],
&buf[48], &buf[49], &buf[50], &buf[51],
&buf[52], &buf[53], &buf[54], &buf[55],
&buf[56], &buf[57], &buf[58], &buf[57],
&buf[60], &buf[61], &buf[62], &buf[63], eof);
}