This example shows how to start a newly created thread with a defined set of CPU registers.
#include <l4/sys/thread.h>
#include <l4/sys/factory.h>
#include <l4/sys/ipc.h>
#include <l4/sys/utcb.h>
#include <l4/util/util.h>
#include <l4/re/env.h>
#include <l4/re/c/util/cap_alloc.h>
#include <stdlib.h>
#include <stdio.h>
static char thread_stack[8 << 10];
{
while (1)
{
printf("hey, I'm a thread\n");
printf("got register values: %ld %ld %ld %ld %ld %ld %ld\n",
d[7], d[6], d[5], d[4], d[2], d[1], d[0]);
l4_sleep(800);
}
}
asm(
".global thread \n\t"
"thread: \n\t"
" pusha \n\t"
" push %esp \n\t"
" call thread_func \n\t"
);
extern void thread(void);
int main(void)
{
int err;
extern char _start[], _end[], _etext[];
return 1;
l4_touch_ro(_start, _end - _start + 1);
l4_touch_rw(_etext, _end - _etext);
return 1;
L4RE_THIS_TASK_CAP);
return 2;
return 3;
{
printf("Umm, ipc error: %x\n", err);
return 1;
}
{
printf("PF?: %lx %lx (not prepared to handle this) %ld\n",
return 1;
}
printf("Error sending IPC: %x\n", err);
while (1)
l4_sleep(10000);
return 0;
}