Page 1 of 1
Shared stacks?
Posted: Mon Jun 30, 2003 11:00 pm
by pepito
More questions about 'stack', it seem's to me to be hopeless about STACKS
It is posible to use a 'shared stack' for various tasks? Is it advisable?
If I use call gates to implement system calls, may I use the application's stack as 'ring 3 stack', and the kernel's stack as 'ring 0 stack'?
Thank you very much...
pepito
RE:Shared stacks?
Posted: Mon Jun 30, 2003 11:00 pm
by Chase
Really depends on how you're coding your OS. C language functions that are generated by most compilers use the stack for return addresses and temp variables. The problem is that when these functions retrieve their info off of the stack they usually assume their info is on the top of the stack and just do some pops. If you do everything in asm shared stacks could be possible but you'd have to do a lot of free/used stack mem tracking and your stack memory area for each process would get smaller and smaller with each new process you ran at the same time. The other possiblity would be to have your task switcher always change the value of esp but again you'd have the smaller and smaller stack....
So it's possible but it's not ideal
-Chase
RE:Shared stacks?
Posted: Mon Jun 30, 2003 11:00 pm
by pepito
OK, that mean that is necesary one stack for each task...
Thank you very much!