Creating a thread from roottask

jason philip <[email protected]> Sat, 12 Mar 2011 13:57:30 -0800
Newsgroups gmane.comp.micro-kernel.l4.l4ka.general
Message-ID <[email protected]>
--bcaec5299e67484657049e502a08
Content-Type: text/plain; charset=ISO-8859-1

hi all,
I am working on project and I want to create thread, but I do not exactly
know how to do so. One reason why so is because I don't know how to
determine the utcb location. This was the code I had mind:

void func(void)
{
printf("the thread start\n");
}

int main()
{
L4_ThreadId_t me = MyGlobalId(), newThread;
L4_Word_t BTN = L4_ThreadNo(me);
newThread = L4_GlobalId(BTN+5, 1);
ThreadControl(newThread, me, me, me, don't know);
int stack[40];
L4_LoadMR(0, 0x2);
L4_LoadMR(1, (L4_Word_t)func);
L4_LoadMR(2, (L4_Word_t)stack);
L4_Ipc(newThread, L4_nilthread, 0, 0);
}

and I know my kernel work good because I run examples that came with the
kernel. I also read the l4test project but it is very confusing to me. If my
code look crappy it because I very new to L4 programming.

--bcaec5299e67484657049e502a08
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<br>hi all,<br>I am working on project and I want to create thread, but I d=
o not exactly know how to do so. One reason why so is because I don&#39;t k=
now how to determine the utcb location. This was the code I had mind:<br>
<br>void func(void)<br>{<br>printf(&quot;the thread start\n&quot;);<br>}<br=
><br>int main()<br>{<br>L4_ThreadId_t me =3D MyGlobalId(), newThread;<br>L4=
_Word_t BTN =3D L4_ThreadNo(me);<br>newThread =3D L4_GlobalId(BTN+5, 1);<br=
>ThreadControl(newThread, me, me, me, don&#39;t know);<br>
int stack[40];<br>L4_LoadMR(0, 0x2);<br>L4_LoadMR(1, (L4_Word_t)func);<br>L=
4_LoadMR(2, (L4_Word_t)stack);<br>L4_Ipc(newThread, L4_nilthread, 0, 0);<br=
>}<br><br>and I know my kernel work good because I run examples that came w=
ith the kernel. I also read the l4test project but it is very confusing to =
me. If my code look crappy it because I very new to L4 programming.<br>

--bcaec5299e67484657049e502a08--