Page 1 of 1

[Poll] Stack size

Posted: Fri Jul 04, 2008 9:47 am
by inflater
Hey,
how big is stack in your OS? I ran into severe problems as mine kernel switches to real mode (APM, some useful bios functions etc) and I had to keep the stack under 640kB. Maybe it's enough you say, but loading SS at e.g. 0x5F and ESP to 0 (very close to CPU vectors BTW) as the stack grows downwards, works, but there are nasty errors like your OS wouldn't work on MS VPC 2007 but it would on Bochs. I've met personally with this. :evil: Or e.g. self-rewriting code: on VMware and VPC my OS wouldn't work with some commands, but Bochs worked flawlessly... so I've created at least 20 combinations of SS:ESP, which then had unexpected results. You e.g. can't set SS to 0 and ESP to 0xFFFF (resulting in 32 kB stack size, from 0xffff to 0x7C00) if your kernel is switching to real mode, here's why: 0xF000 and neighbours are ROM BIOS functions :roll:.

So I've got really mad and put TIMES 16*1024 DB 0 right in the beginning of the exe kernel, which works.

My question is: what's your stack size? Is 16 kB enough?

Re: [Poll] Stack size

Posted: Fri Jul 04, 2008 4:26 pm
by mathematician
Unless you are writing something like a recursive descent parser, or storing an awful lot of data on the stack, I would think 16kb is plenty.

Re: [Poll] Stack size

Posted: Fri Jul 04, 2008 6:17 pm
by bewing
My stacks are all 1K, and I never use more than 300 bytes of them. But I'm not planning on implementing a recursive descent parser in my kernel, either. :wink:

Re: [Poll] Stack size

Posted: Mon Jul 07, 2008 11:04 pm
by Adek336
I've got 64 kbs... so that I am always totally sure that (unless an inifite recursion occurred) a problem isn't stack related ;)

Re: [Poll] Stack size

Posted: Mon Jul 07, 2008 11:32 pm
by ChristianF
My Stack has a size of 16 KB and I got no problems :D

Re: [Poll] Stack size

Posted: Sun Jul 13, 2008 2:35 pm
by Combuster
kernel stacks are currently 3K. Basically, one page with the thread's info subtracted from it.

I even used 256b stacks without problems :)