1 /* 2 * PROJECT: ReactOS Hardware Abstraction Layer 3 * LICENSE: BSD - See COPYING.ARM in the top level directory 4 * PURPOSE: NMI handling 5 * PROGRAMMERS: ReactOS Portable Systems Group 6 */ 7 8 /* INCLUDES *******************************************************************/ 9 10 #include <hal.h> 11 #include <drivers/bootvid/display.h> 12 13 #define NDEBUG 14 #include <debug.h> 15 16 /* GLOBALS *******************************************************************/ 17 18 BOOLEAN HalpNMIInProgress; 19 20 /* FUNCTIONS *****************************************************************/ 21 22 /* 23 * @implemented 24 */ 25 VOID 26 NTAPI 27 HalHandleNMI( 28 IN PVOID NmiInfo) 29 { 30 UNREFERENCED_PARAMETER(NmiInfo); 31 #ifndef _MINIHAL_ 32 SYSTEM_CONTROL_PORT_B_REGISTER SystemControl; 33 34 /* Don't recurse */ 35 if (HalpNMIInProgress++) 36 ERROR_DBGBREAK(); 37 38 /* Get NMI reason from hardware */ 39 #if defined(SARCH_PC98) 40 SystemControl.Bits = __inbyte(PPI_IO_i_PORT_B); 41 #else 42 SystemControl.Bits = __inbyte(SYSTEM_CONTROL_PORT_B); 43 #endif 44 45 /* Switch to boot video */ 46 if (InbvIsBootDriverInstalled()) 47 { 48 /* Acquire ownership */ 49 InbvAcquireDisplayOwnership(); 50 InbvResetDisplay(); 51 52 /* Fill the screen */ 53 InbvSolidColorFill(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1, BV_COLOR_RED); 54 InbvSetScrollRegion(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1); 55 56 /* Enable text */ 57 InbvSetTextColor(BV_COLOR_WHITE); 58 InbvInstallDisplayStringFilter(NULL); 59 InbvEnableDisplayString(TRUE); 60 } 61 62 /* Display NMI failure string */ 63 InbvDisplayString("\r\n*** Hardware Malfunction\r\n\r\n"); 64 InbvDisplayString("Call your hardware vendor for support\r\n\r\n"); 65 66 #if defined(SARCH_PC98) 67 /* Check for parity error */ 68 if (SystemControl.MemoryParityCheck) 69 { 70 InbvDisplayString("NMI: Parity Check / Memory Parity Error\r\n"); 71 } 72 if (SystemControl.ExtendedMemoryParityCheck) 73 { 74 InbvDisplayString("NMI: Parity Check / Extended Memory Parity Error\r\n"); 75 } 76 #else 77 /* Check for parity error */ 78 if (SystemControl.ParityCheck) 79 { 80 InbvDisplayString("NMI: Parity Check / Memory Parity Error\r\n"); 81 } 82 83 /* Check for I/O failure */ 84 if (SystemControl.ChannelCheck) 85 { 86 InbvDisplayString("NMI: Channel Check / IOCHK\r\n"); 87 } 88 #endif 89 90 /* Check for EISA systems */ 91 if (HalpBusType == MACHINE_TYPE_EISA) 92 { 93 /* FIXME: Not supported */ 94 UNIMPLEMENTED; 95 } 96 97 /* Halt the system */ 98 InbvDisplayString("\r\n*** The system has halted ***\r\n"); 99 100 /* Enter the debugger if possible */ 101 KiBugCheckData[0] = (ULONG_PTR)KeServiceDescriptorTable; /* NMI Corruption? */ 102 //if (!(KdDebuggerNotPresent) && (KdDebuggerEnabled)) KeEnterKernelDebugger(); 103 #endif /* !_MINIHAL_ */ 104 105 /* Freeze the system */ 106 while (TRUE) 107 NOTHING; 108 } 109