On Wednesday 12 July 2006 11:34, Andreas Berger wrote: > save and restore the floating point unit. I will need to do this for > FPC, so if someone knows how to save and restore the FPU, I would > apreciate the help.
F(X)SAVE/F(X)RSTOR The X-Versions are more efficient, but only available on newer CPUs. > Ideally I could also discover (via an exception > on first FPU usage?) if a thread needs to save/restore the FPU. Well, I'd say, this is quite hard to do in an efficient way, because you need to detect the usage of MMX instructions, too. As you may recall, Intel decided to implement another brain damaged design and mapped the MMX registers onto the FPU registers. I have to dig deep in my memory now, so take the following paragraphs with caution, I may be wrong (it's just too long ago): In theory it is possible to do, but only if you have write access to the EFLAGS register (where you could temporarily set a flag to raise an exception on MMX usage). But the usual DOS-target means DPMI, which means privilege level 3 which means: You're just not allowed to fiddle around with those. IIRC, there's a ring0-mode DPMI-Host available (should be CWSDPR0.EXE), but this only works in real plain DOS, so the option to run the program inside a Windows-DOS-Box would be out completely, I guess. Depending on your needs this might be ok, but as a general solution for FPC/GO32V2 this wouldn't be acceptable, I think. Vinzent. _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal