xmm15 wrote:
bzt wrote:
First, you need to save and restore ALL registers for a context switch. This also includes xmm,sse etc. registers if you use float or double in your C++ code.
I would just like to point out that you should probably not save xmm registers on every context switch, but rather leverage the use of #NM exception. For more info look at
http://www.dumais.io/index.php?article=2aa66f0c1b5391997f2615e8f88ee169Not saving them on every context switch is just on optimization, so doesn't really matter that much. Of course later you'll want to take advantage of that optimization, but if you keep it in mind it shouldn't be difficult to implement later as well.
Once you realize why you don't have to save these regs on every context switch you hopefully realize that it (partially) applies to all the regs, including general purpose and segment regs as well.