TSS based task switching
Posted: Fri Jan 30, 2004 11:01 pm
ok, i've been using the setjmp/longjmp technique for task switching and it works great. I would like to switch to TSS as this offers more protection checks upon switch and all those goodies.
my "plan" is to have 2 TSS in the GDT (last and current). also each thread object will have a TSS to store it's individual state.
As far as i understand, when i want to switch, i should copy the contents of the next threads, TSS into current and do a ljmp to that TSS's selector, this will automatically switch tasks and put the last tasks state into last TSS entry.
first of all, is this correct so far? also when should i copy the last TSS to the last Thread's TSS? should it be in the code directly following the ljmp (i realize this will be running in the context of a different task), is that the best time, or is there a less error prone time?
thanks
proxy
my "plan" is to have 2 TSS in the GDT (last and current). also each thread object will have a TSS to store it's individual state.
As far as i understand, when i want to switch, i should copy the contents of the next threads, TSS into current and do a ljmp to that TSS's selector, this will automatically switch tasks and put the last tasks state into last TSS entry.
first of all, is this correct so far? also when should i copy the last TSS to the last Thread's TSS? should it be in the code directly following the ljmp (i realize this will be running in the context of a different task), is that the best time, or is there a less error prone time?
thanks
proxy