how i can determine utcb loaction in order to make thread

Norman Feske norman.feske at genode-labs.com
Thu Mar 31 22:58:24 CEST 2011


Hello Jason,

> 	L4_Word_t ip, sp;
> 	char stack[100];
...
> 	sp = (L4_Word_t)stack;
...
> 	L4_Append(&msg, ip);
> 	L4_Append(&msg, sp);
> 	L4_Load(&msg);
> 	L4_MsgTag_t result = L4_Send(jen, snd_time_out);

I don't know if this is related to your problem but you should
definitely specify the top (rather than the bottom) of the stack as
initial stack pointer because the stack always grows from top to bottom.
I recommend to use a larger stack anyway (just to be sure - printf might
need more than 100 bytes of stack), would not place the new thread's
stack as local variable on main's stack (better make it a static
variable), and would use a machine-word-aligned stack size (even though
x86 may tolerate an unaligned sp, other architectures do not).

Also, I warmly recommend you to give the Pistachio kernel debugger a try
to inspect the state of the new created thread. You should also consider
to not immediately return from the main function. The kernel will see
roottask exiting, which is an unexpected behavior from the kernel's
point of view. For a test, just insert an infinite loop at end of 'main'.

Cheers
Norman

-- 
Dr.-Ing. Norman Feske
Genode Labs

http://www.genode-labs.com · http://genode.org

Genode Labs GmbH · Amtsgericht Dresden · HRB 28424 · Sitz Dresden
Geschäftsführer: Dr.-Ing. Norman Feske, Christian Helmuth




More information about the l4-hackers mailing list