Ideally, everything needs to be saved in order for the state in which a thread executes never changes and not have to worry about which registers a thread can and can't use. So each thread needs to have an allocated register store for GPRs including selectors and flags (mov, pushf, popf), FPU (fsave, frstore) and SSE (fxstore, fxrstor) in a lookup table somewhere in memory.
Where you put this table is up to you, just make sure its in ring 0 memory and your OS keeps track of the base address and size of the table, the entries can then be found using the thread's id as an offset.
|