Author: ros-arm-bringup Date: Fri Jan 1 21:55:15 2010 New Revision: 44860
URL: http://svn.reactos.org/svn/reactos?rev=44860&view=rev Log: NMI Support Patch 6: [HAL]: Fix NMI recursion issues. [HAL]: Reset the display during NMI and paint the NMI Screen of Death.
Modified: trunk/reactos/hal/halx86/generic/misc.c
Modified: trunk/reactos/hal/halx86/generic/misc.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/misc.c?r... ============================================================================== --- trunk/reactos/hal/halx86/generic/misc.c [iso-8859-1] (original) +++ trunk/reactos/hal/halx86/generic/misc.c [iso-8859-1] Fri Jan 1 21:55:15 2010 @@ -1,25 +1,30 @@ /* - * PROJECT: ReactOS HAL - * LICENSE: GPL - See COPYING in the top level directory - * FILE: hal/halx86/generic/misc.c - * PURPOSE: Miscellanous Routines - * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org) - * Eric Kohl (ekohl@abo.rhein-zeitung.de) - */ - -/* INCLUDES ******************************************************************/ + * PROJECT: ReactOS Hardware Abstraction Layer (HAL) + * LICENSE: BSD - See COPYING.ARM in the top level directory + * FILE: halx86/generic/misc.c + * PURPOSE: NMI, I/O Mapping and x86 Subs + * PROGRAMMERS: ReactOS Portable Systems Group + */ + +/* INCLUDES *******************************************************************/
#include <hal.h> #define NDEBUG #include <debug.h>
-/* PRIVATE FUNCTIONS *********************************************************/ +/* GLOBALS *******************************************************************/ + +BOOLEAN HalpNMIInProgress; + +/* PRIVATE FUNCTIONS **********************************************************/
VOID NTAPI HalpCheckPowerButton(VOID) { - /* Nothing to do on non-ACPI */ + // + // Nothing to do on non-ACPI + // return; }
@@ -28,7 +33,9 @@ HalpMapPhysicalMemory64(IN PHYSICAL_ADDRESS PhysicalAddress, IN ULONG NumberPage) { - /* Use kernel memory manager I/O map facilities */ + // + // Use kernel memory manager I/O map facilities + // return MmMapIoSpace(PhysicalAddress, NumberPage << PAGE_SHIFT, MmNonCached); @@ -39,7 +46,9 @@ HalpUnmapVirtualAddress(IN PVOID VirtualAddress, IN ULONG NumberPages) { - /* Use kernel memory manager I/O map facilities */ + // + // Use kernel memory manager I/O map facilities + // MmUnmapIoSpace(VirtualAddress, NumberPages << PAGE_SHIFT); }
@@ -112,32 +121,96 @@ NTAPI HalHandleNMI(IN PVOID NmiInfo) { - UCHAR ucStatus; - - /* Get the NMI Flag */ - ucStatus = READ_PORT_UCHAR((PUCHAR)0x61); - - /* Display NMI failure string */ - HalDisplayString ("\n*** Hardware Malfunction\n\n"); - HalDisplayString ("Call your hardware vendor for support\n\n"); - - /* Check for parity error */ - if (ucStatus & 0x80) - { - /* Display message */ - HalDisplayString ("NMI: Parity Check / Memory Parity Error\n"); - } - - /* Check for I/O failure */ - if (ucStatus & 0x40) - { - /* Display message */ - HalDisplayString ("NMI: Channel Check / IOCHK\n"); - } - - /* Halt the system */ + UCHAR NmiStatus; + + // + // Don't recurse + // + if (HalpNMIInProgress++) while (TRUE); + + // + // Get the NMI Flag + // + NmiStatus = READ_PORT_UCHAR((PUCHAR)0x61); + + // + // Switch to boot vieo + // + if (InbvIsBootDriverInstalled()) + { + // + // Acquire ownership + // + InbvAcquireDisplayOwnership(); + InbvResetDisplay(); + + // + // Fill the screen + // + InbvSolidColorFill(0, 0, 639, 479, 1); + InbvSetScrollRegion(0, 0, 639, 479); + + // + // Enable text + // + InbvSetTextColor(15); + InbvInstallDisplayStringFilter(NULL); + InbvEnableDisplayString(TRUE); + } + + // + // Display NMI failure string + // + HalDisplayString("\n*** Hardware Malfunction\n\n"); + HalDisplayString("Call your hardware vendor for support\n\n"); + + // + // Check for parity error + // + if (NmiStatus & 0x80) + { + // + // Display message + // + HalDisplayString("NMI: Parity Check / Memory Parity Error\n"); + } + + // + // Check for I/O failure + // + if (NmiStatus & 0x40) + { + // + // Display message + // + HalDisplayString("NMI: Channel Check / IOCHK\n"); + } + + // + // Check for EISA systems + // + if (HalpBusType == MACHINE_TYPE_EISA) + { + // + // FIXME: Not supported + // + UNIMPLEMENTED; + } + + // + // Halt the system + // HalDisplayString("\n*** The system has halted ***\n"); - //KeEnterKernelDebugger(); + + // + // Enter the debugger if possible + // + //if (!KdDebuggerNotPresent && KdDebuggerEnabled) KeEnterKernelDebugger(); + + // + // Freeze the system + // + while (TRUE); }
/* @@ -149,7 +222,9 @@ OUT PKINTERRUPT_ROUTINE **FlatDispatch, OUT PKINTERRUPT_ROUTINE *NoConnection) { - /* Not implemented on x86 */ + // + // Not implemented on x86 + // return 0; }
@@ -160,6 +235,8 @@ NTAPI KeFlushWriteBuffer(VOID) { - /* Not implemented on x86 */ + // + // Not implemented on x86 + // return; }