Shared 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
pepito

Shared stacks?

Post 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
Chase

RE:Shared stacks?

Post 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
pepito

RE:Shared stacks?

Post by pepito »

OK, that mean that is necesary one stack for each task...

Thank you very much!
Post Reply