[okl4-developer] OKL4 v2.1: about thread identifiers

Frank Kaiser frank.kaiser at opensynergy.com
Fri Sep 12 23:12:06 EST 2008


Hello

 

For the client/server communication of my SPI implementation I tried to
identify the client from the messages it sends to the server, but this
does not work as expected. I have following IDL4 prototype defined:

interface virtual_spi

{

    int register_client

    (

        in uint32_t      mask,

        in objref_t      memsection,

        in uintptr_t     passwd

    );

};

This leads to the following C prototype definition:

int virtual_serial_init_impl(L4_ThreadId_t caller, device_t
virtual_serial, L4_Word_t owner, uint32_t mask, idl4_server_environment
*env);

According to the implementation in vspi_serverloop.c the first parameter
of this prototype is equal to the dereferenced second parameter of
function L4_ReplyWait(), which shall be, according to section D-5.1.8/.9
of the OKL4 User Manual, a pointer to the sender's thread id. Assuming
that this is the thread id of my client, I store this thread id and
later on I use it as first parameter of function L4_Notify(), but the
client never receives any notification.

The client side reception is a slightly modified copy from the
implementation in drivers_example.c:

    L4_ThreadId_t sender;

    L4_Set_NotifyMask(0xffffffff);

    L4_Accept(L4_NotifyMsgAcceptor);

 

    while(1)

    {

        L4_Msg_t msg;

        L4_MsgTag_t tag = L4_Wait(&sender);

        L4_MsgStore(tag, &msg);

        L4_Word_t num = L4_MsgWord(&msg, 0);

 

        printf("%s: Got message from %lx (msg: %lx)\n", __FUNCTION__,
sender.raw, num);

        ...

    }

A dump of the assumed client id caller.raw provides the value
0x80000003. There does seem to be a simple L4 function of obtains its
own thread id, so I used the somewhat cryptic method found in
drivers_example.c:

L4_ThreadId_t my_tid = thread_l4tid(env_thread(iguana_getenv("MAIN")));

The dump of mytid.raw provides 0x00010001, which is obviously different
from what the server has derived from the caller parameter. Since the
server's own thread id which the client derived with:

             spi->server = env_thread_id(iguana_getenv("VSPI_TID"));

provides the value 0x0000C001, I assume that the value from the caller
parameter is anything else but the sender's thread id. From what I have
gathered from the OKL4 and IGUANA manuals so far I conclude that the
behaviour of L4_ReplyWait() regarding the second parameter is faulty.

 

Regards

Frank

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.okl4.org/pipermail/developer/attachments/20080912/95855a76/attachment.htm 


More information about the Developer mailing list