I heard about TSS to switch between processes.
(whatever sw or hw task switching)
then I think, I should to make the default TSS data.
and I have to fill the value of ESP0 and SS0 in the TSS.
in this case, When task switching occurs, CPU will load ESP0 and SS0 in a default initialized TSS. but current stack is used by another process. and it indicates same area. it means, next process will overwrite current process's first area of stack.
isn't it make any problem?
Task switching (ring0<->ring3)
Having done software task-switching both with a single kernel stack (single threaded kernel) and multiple kernel stacks/threads (threads are scheduled by stack-switching in kernel, some of them return to userspace, some of them don't) I personally find the latter approach somewhat easier to work with (it's more or less like writing a multi-threaded server).
There are some advantages to a single kernel stack, but a lot more explicit book-keeping is required, so YMMV..
There are some advantages to a single kernel stack, but a lot more explicit book-keeping is required, so YMMV..
The real problem with goto is not with the control transfer, but with environments. Properly tail-recursive closures get both right.