Stringitem

BERTRAND Joel joel.bertrand at systella.fr
Sat Dec 4 16:14:16 CET 2010


	Hello,

	I think I have misunderstood StringItem IPC but I don't know where is 
my mistake.

	My roottask spawns a thread that sends a stringitem to roottask. I have 
checked with debugger that this stringitem contains my string :

     si = L4_StringItem(str.length_trim, (void *) str.c);

     L4_Clear(&msg);
     L4_Append(&msg, si);
     L4_Set_Label(&msg, CALL$PRINT);
     L4_Load(&msg);

     L4_Call(L4_Pager());

str is a struct vms$string :

struct vms$string
{
     vms$pointer             length;
     vms$pointer             length_trim;
     unsigned char           *c;
};

	My roottask receives this IPC in following function:

void
sys$loop()
{
     int                     running;

     L4_ThreadId_t           partner;
     L4_MsgBuffer_t          buffer;
     L4_MsgTag_t             tag;
     L4_Msg_t                msg;

     running = 1;

     L4_Accept(L4_MapGrantItems(L4_CompleteAddressSpace)
             + L4_StringItemsAcceptor);
     tag = L4_Wait(&partner);

     while(running)
     {
         L4_Clear(&msg);
         L4_Store(tag, &msg);

         if ((tag.raw & L4_REQUEST_MASK) == L4_PAGEFAULT)
         {
             sys$pagefault(partner, L4_Get(&msg, 0), L4_Get(&msg, 1),
                     tag.raw);
         }
         else
         {
             switch(L4_Label(tag))
             {
                 case CALL$PRINT:
                     notice("Here!\n");
                     break;

                 default:
                     PANIC(1, notice(IPC_F_UNKNOWN
                             "unknown IPC from $%lX "
                             "with label $%lX\n", L4_ThreadNo(partner),
                             L4_Label(tag)));
             }
         }

         tag = L4_ReplyWait(partner, &partner);
     }

     return;
}

	When system boots, I can intercept on serial line:

...
%SYS-F-PAGEFLT, pagefault request from $3C at $0000000000800110
%SYS-F-PAGEFLT, pagefault request from $3C at $000000000010FFF8
%SYS-F-PAGEFLT, pagefault request from $3C at $00000000008015C0
%SYS-F-PAGEFLT, pagefault request from $3C at $0000000000801C10
Here!
%IPC-F-UNKNOWN, unknown IPC from $0 with label $0

Panic at sys$loop, sys/sys_loop.c line 73
Have a nice day !


Backtrace:

   <00> [$000000000104F5B8] -> $0000000001004ED5 (sys$loop)
   <01> [$000000000104F838] -> $0000000001005813 (main)

	Pagefault messages are written by sys$pagefault() subroutine. As 
sys$loop() function writes 'Here!', it receives an IPC with CALL$PRINT 
label.

	First question: I don't know how read this stringitem. I have tried 
with msgbuff without any result. I suppose I have misunderstood how 
StringItem IPC works.

	Second question: I don't understand last line:
"%IPC-F-UNKNOWN, unknown IPC from $0 with label $0". I suppose this 
error comes from a bad stringitem IPC.

	I haven't found any stringitem IPC example. Help is welcome.

	Regards,

	JB




More information about the l4-hackers mailing list