[Poll] Stack size
Posted: Fri Jul 04, 2008 9:47 am
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. 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 .
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?
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. 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 .
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?