PMode Stacks

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
PlayOS

PMode Stacks

Post 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.
K.J.

Re:PMode Stacks

Post 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.
Whatever5k

Re:PMode Stacks

Post 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...
Tim

Re:PMode Stacks

Post 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.
Slasher

Re:PMode Stacks

Post 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?
Tim

Re:PMode Stacks

Post 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).
Post Reply