Stack size
Posted: Sun Feb 26, 2006 9:30 am
I am finally getting along with osdev, but now I'm wondering how big a stack should be.
I'd like to know how big the kernel stack should be and where it is best placed. Is it possible to dynamically grow or shrink a stack or the kernel stack.
I like the idea of a single address space (SAS), but that leaves memory protection in my own hands instead of letting the hardware take care of it. To prevent stack overflows, I put a non-present page below the stack, but (not yet happened, only in theory) if it reaches the non-present page, it will page fault, but since it can't push cs and eip on the stack, it will double fault. Only if the double fault is a task gate, it will not triple fault. That leaves me with the fact that a stack overflow will crash the system.
Does anybody has any sollution to this problem?
I'd like to know how big the kernel stack should be and where it is best placed. Is it possible to dynamically grow or shrink a stack or the kernel stack.
I like the idea of a single address space (SAS), but that leaves memory protection in my own hands instead of letting the hardware take care of it. To prevent stack overflows, I put a non-present page below the stack, but (not yet happened, only in theory) if it reaches the non-present page, it will page fault, but since it can't push cs and eip on the stack, it will double fault. Only if the double fault is a task gate, it will not triple fault. That leaves me with the fact that a stack overflow will crash the system.
Does anybody has any sollution to this problem?