Page 1 of 1
PMode Stacks
Posted: Sat Nov 02, 2002 6:13 am
by PlayOS
Hi all,
Just wondering how big you think I should have my kernel stack, I have it at 256KB now, what do you have?
thanks.
Re:PMode Stacks
Posted: Sat Nov 02, 2002 12:25 pm
by K.J.
1024 bytes is how big mine is. Though there really isn't a right or wrong size for a kernel stack. It just has to be big enough.
K.J.
Re:PMode Stacks
Posted: Sat Nov 02, 2002 12:34 pm
by Whatever5k
I've currently reserved 4 KB for the kernel stack, but I'm not worrying about this, yet...
I can easily change this...
Re:PMode Stacks
Posted: Sat Nov 02, 2002 12:54 pm
by Tim
Each thread has three pages for a kernel stack: two pages for data with a guard page at the top. There is also a guard page at the bottom, owned by the previous thread. The guard pages are unmapped pages which trap accesses outside the proper area of the stack -- basically, they act to catch stack overflows or underflows.
Re:PMode Stacks
Posted: Sat Nov 02, 2002 1:32 pm
by Slasher
i was using a single stack which is 1024 bytes (1k) in size for the kernel code ie when users call kernel code, and each process has its own stack 512 bytes. is this a bad idea?
Re:PMode Stacks
Posted: Sat Nov 02, 2002 4:04 pm
by Tim
The kernel stack looks a bit too small, but see if it works. The user stack is much too small, but if you are using paging then you will be able to resize the stack dynamically (if you get a page fault, and the address is in the page at the end of the stack, then enlarge the stack and continue).