Passing data to a thread
valentinhauner at gmx.de
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
> l4_umword_t stack;
> stack = (l4_umword_t)my_data;
> stack = 0;
> And use &stack 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);
More information about the l4-hackers