Adam Lackorzynski adam at os.inf.tu-dresden.de
Mon Mar 24 18:23:52 CET 2008

On Fri Mar 21, 2008 at 04:12:57 +0000, muhammad saufy wrote:
> im using register based IPC operation to transfer
> string of more than two double word. (32 bit x 2). how
>  IPC handle this? it's the register copy is loop twice
> to transfer the data or fiasco automatically copy that
> data to memory and send to the receiver?

There are two ways: short IPC with UTCB and so-called long IPC.

Transfer with UTCBs basically works like this:


l4_msgtag_t tag = l4_msgtag(0, size, 0, 0); // max size is L4_UTCB_GENERIC_DATA_SIZE
memcpy(l4_utcb_get()->values, data, size * sizeof(long));
l4_ipc_send_tag(receiver_id, L4_IPC_SHORT_MSG, dw0, dw1, tag, L4_IPC_NEVER, &dope);

l4_ipc_receive_tag(thread1_id, L4_IPC_SHORT_MSG,
                   &d0, &d1, L4_IPC_NEVER, &dope, &tag);
memcpy(store, l4_utcb_get()->values, size); // at most sizeof(utcb)

Doing long-IPC needs a few more lines but also lets you transfer up to a
super-page data with one IPC. You can look up plenty of examples by
looking in IDL generated code. 

Adam                 adam at os.inf.tu-dresden.de
  Lackorzynski         http://os.inf.tu-dresden.de/~adam/

More information about the l4-hackers mailing list