Location of stack
Posted: Thu Feb 27, 2003 8:16 pm
Disclaimer: I'm probably missing something here, but in my books that i've read i cannot find an answer...
Anyways,
I am getting into making a simple memory manager for my kernel, all the goodies of a keyboard interrupt driver and printf are done. I write out my kernel's memmory usage like this:
0x0001 0000 = Start of stack (mov esp, 0x00010000 right before main of c kernel is called)
0x0010 0000 = Kernel load address
0x0040 0000 = The start of my little malloc function.
all my malloc() does is return the address of a pointer (which initally points to memory at 0x00400000) and increases the pointer based on the size requested. It's dirt simple and there just so i could make some linked lists...
Now, I want to set the top of the stack to the the address right below where my kernel code starts, to 0x000FFFFF. When I do this, Bochs gives me a panic.
I want to do this to use that memory sitting between the stack and the kernel code. Grub will not allow me to load a kernel below 1 meg.
Is there some rule that says the stack must start as 0x0001000?
If so, where could I find more information on this and/or why does this have to be this way?
Some information would be appreciated. Don't be afraid to tell me I'm missing something extremly simple that I should have picked.
Thanks,
Simrook.
Anyways,
I am getting into making a simple memory manager for my kernel, all the goodies of a keyboard interrupt driver and printf are done. I write out my kernel's memmory usage like this:
0x0001 0000 = Start of stack (mov esp, 0x00010000 right before main of c kernel is called)
0x0010 0000 = Kernel load address
0x0040 0000 = The start of my little malloc function.
all my malloc() does is return the address of a pointer (which initally points to memory at 0x00400000) and increases the pointer based on the size requested. It's dirt simple and there just so i could make some linked lists...
Now, I want to set the top of the stack to the the address right below where my kernel code starts, to 0x000FFFFF. When I do this, Bochs gives me a panic.
I want to do this to use that memory sitting between the stack and the kernel code. Grub will not allow me to load a kernel below 1 meg.
Is there some rule that says the stack must start as 0x0001000?
If so, where could I find more information on this and/or why does this have to be this way?
Some information would be appreciated. Don't be afraid to tell me I'm missing something extremly simple that I should have picked.
Thanks,
Simrook.