From 58fc2c8cf8fa69af7facf56f3374f28a178b31ba Mon Sep 17 00:00:00 2001 From: David Welch Date: Sat, 17 Mar 2001 09:43:27 +0000 Subject: [PATCH] Oops, missing files svn path=/trunk/; revision=1705 --- reactos/ntoskrnl/Makefile.i386 | 3 +- reactos/ntoskrnl/ke/i386/fpu.c | 66 +++++++++++++++++++++++++++++++ reactos/ntoskrnl/ke/i386/kernel.c | 2 +- 3 files changed, 69 insertions(+), 2 deletions(-) create mode 100644 reactos/ntoskrnl/ke/i386/fpu.c diff --git a/reactos/ntoskrnl/Makefile.i386 b/reactos/ntoskrnl/Makefile.i386 index 685eb63d3a3..1c00d8ff558 100644 --- a/reactos/ntoskrnl/Makefile.i386 +++ b/reactos/ntoskrnl/Makefile.i386 @@ -18,7 +18,8 @@ OBJECTS_KE_I386 := \ ke/i386/idt.o \ ke/i386/ldt.o \ ke/i386/brkpoint.o \ - ke/i386/kernel.o + ke/i386/kernel.o \ + ke/i386/fpu.o OBJECTS_MM_I386 := \ mm/i386/memsafe.o \ diff --git a/reactos/ntoskrnl/ke/i386/fpu.c b/reactos/ntoskrnl/ke/i386/fpu.c new file mode 100644 index 00000000000..8497222e763 --- /dev/null +++ b/reactos/ntoskrnl/ke/i386/fpu.c @@ -0,0 +1,66 @@ +/* + * ReactOS kernel + * Copyright (C) 1998, 1999, 2000, 2001 ReactOS Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * PROJECT: ReactOS kernel + * FILE: ntoskrnl/ke/i386/fpu.c + * PURPOSE: Handles the FPU + * PROGRAMMER: David Welch (welch@mcmail.com) + * UPDATE HISTORY: + * Created 22/05/98 + */ + +/* INCLUDES *****************************************************************/ + +#include +#include +#include +#include + +#define NDEBUG +#include + +/* GLOBALS *******************************************************************/ + +static ULONG HardwareMathSupport; + +/* FUNCTIONS *****************************************************************/ + +VOID +KiCheckFPU(VOID) +{ + unsigned short int status; + int cr0; + + HardwareMathSupport = 0; + + __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)); + cr0 = cr0 | 0x4; + __asm__("movl %0, %%cr0\n\t" : + : "a" (cr0)); + DbgPrint("No FPU detected\n"); + return; + } + /* FIXME: Do fsetpm */ + HardwareMathSupport = 1; +} diff --git a/reactos/ntoskrnl/ke/i386/kernel.c b/reactos/ntoskrnl/ke/i386/kernel.c index 0ae9c063de3..2dcc56fb5cd 100644 --- a/reactos/ntoskrnl/ke/i386/kernel.c +++ b/reactos/ntoskrnl/ke/i386/kernel.c @@ -31,7 +31,7 @@ #include #include #include -#include +#include #define NDEBUG #include