[okl4-developer] Sigma0 stack initialization

Martin Christian martin at christianix.de
Mon Jan 28 09:54:23 EST 2008


Hi!

> uintptr_t _stack[128];
> void * _stack_top = (void*) &_stack[255];

As far as I remember from the time hacking for my Diplomarbeit,
_stack_top is used as symbol within the CRT0 start code (the assembler
code that is executed before a C program starts).

The stack should always have the same size and as far as I remember,
uintptr and void* are both machine words of the same size. Thus, you
should either use 128 or 255.

The stack grows down from top to bottom - from highest to lowest word.
_stack_top is supposed to hold the address of the "first" word of the
stack - the highest valid address within the stack:

stack bottom     stack top
|________________|
|________________|
|                |
lowest word      highest word

It's some time ago, when I spent my time with L4 hacking, thus I'm not
100 % sure. But I hope this gives you an idea of what's happening.

Usually the stack setup - to with this code piece belongs - is done
within the CRT0 code in assembler. But I remember these strange lines
from Pistachio-embedded (the ancestor of OKL4).

Best,

Martin.

PS: I prefer to see the real name of my correspondent. And we don't have
a political discussion here which requires anonymity, do we? ;-)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
Url : http://lists.okl4.org/pipermail/developer/attachments/20080127/f347b33a/attachment.pgp 


More information about the Developer mailing list