Hopefully initialize FPU properly

svn path=/trunk/; revision=2242
This commit is contained in:
David Welch 2001-09-08 20:08:08 +00:00
parent 9e9c096bed
commit 8fd176384c

View file

@ -49,12 +49,18 @@ KiCheckFPU(VOID)
HardwareMathSupport = 0;
__asm__("movl %%cr0, %0\n\t" : "=a" (cr0));
/* Set NE and MP. */
cr0 = cr0 | 22;
__asm__("movl %0, %%cr0\n\t" : : "a" (cr0));
__asm__("clts\n\t");
__asm__("fninit\n\t");
__asm__("fstsw %0\n\t" : "=a" (status));
if (status != 0)
{
__asm__("movl %%cr0, %0\n\t" : "=a" (cr0));
/* Set the EM flag in CR0 so any FPU instructions cause a trap. */
cr0 = cr0 | 0x4;
__asm__("movl %0, %%cr0\n\t" :
: "a" (cr0));