What are the correct settings to make use of FXSAVE/FXRSTOR instructions ?
When I say "settings", I mean things like "NE", "MP", "TS", "EM" bits of CR0 and "OSFXSR", "OSXMMEXCPT" bits of CR4 ?
My current setting is:
NE=1
MP=1
TS=0
EM=0
OSFXSR=1
OSXMMEXCPT=1
on a Pentium 4 M
I also added a #XF exception handler
I tried to replace my existing fsave/frstor pair by the use of fxsave/fxrstor (I have also aligned the save area to a 16-byte boundary).
It seems to work for about 10-15 seconds (so there must be about 5-6 saves/restores done) and then suddenly, I get an #GP.
Where can it comes from ?
About the use of FXSAVE/FXRSTOR
Re:About the use of FXSAVE/FXRSTOR
Well, the two OS* are correct. You need to indicate you support it. TS=0 and EM=0 are also correct, you don't want to emulate these instructions, and you don't have them in use right now (note, if you always use this instruction when switching, it always has to be 0). The other two I have to checkpini wrote: When I say "settings", I mean things like "NE", "MP", "TS", "EM" bits of CR0 and "OSFXSR", "OSXMMEXCPT" bits of CR4 ?
My current setting is:
NE=1
MP=1
TS=0
EM=0
OSFXSR=1
OSXMMEXCPT=1
on a Pentium 4 M
I also added a #XF exception handler
I tried to replace my existing fsave/frstor pair by the use of fxsave/fxrstor (I have also aligned the save area to a 16-byte boundary).
It seems to work for about 10-15 seconds (so there must be about 5-6 saves/restores done) and then suddenly, I get an #GP.
Where can it comes from ?
Since you take some time to crash, can it be a complimentary bug? Something like a stack overflow or something similar?
Try tracing using debugging-bochs, figuring out what makes it crash and dump_cpu right before.