Passing data to a thread

Valentin Hauner valentinhauner at
Wed Sep 3 12:46:06 CEST 2014


On 09/03/2014 12:45 AM, Adam Lackorzynski wrote:
> For that we need to know the calling convention of functions. For
> x86-32, the arguments are passed via the stack. So you'd do it like
> this:
>    l4_umword_t stack[2000];
>    stack[1999] = (l4_umword_t)my_data;
>    stack[1998] = 0;
> And use &stack[1998] as an initial stack pointer for the thread.
> On ARM the setup can be the same, however, arguments are passed in
> registers, so you'll have a small asm stub for getting the argument from
> the stack to the register before calling the thread function. The same
> for x86-64.
Thanks, it works great.
Usage is very simple with:
>void thread_func(l4_umword_t data);

Best regards,

More information about the l4-hackers mailing list