ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

nmidebug.c
Go to the documentation of this file.
00001 /*
00002  * PROJECT:         ReactOS NMI Debug Driver
00003  * LICENSE:         BSD - See COPYING.ARM in the top level directory
00004  * FILE:            drivers/base/nmidebug/nmidebug.c
00005  * PURPOSE:         Driver Code
00006  * PROGRAMMERS:     ReactOS Portable Systems Group
00007  */
00008 
00009 /* INCLUDES *******************************************************************/
00010 
00011 #include <ntifs.h>
00012 #include <ndk/ketypes.h>
00013 
00014 /* FUNCTIONS ******************************************************************/
00015 
00016 PCHAR NmiBegin = "NMI4NMI@";
00017 
00018 VOID
00019 FORCEINLINE
00020 NmiClearFlag(VOID)
00021 {
00022     ((PCHAR)&KiBugCheckData[4])[0] -= (NmiBegin[3] | NmiBegin[7]);
00023     ((PCHAR)&KiBugCheckData[4])[3] |= 1;
00024 #ifdef _M_IX86
00025 #ifdef _MSC_VER
00026     __asm
00027     {
00028         rcr KiBugCheckData[4], 8
00029     }
00030 #else
00031     __asm__("rcrl %b[shift], %k[retval]" : [retval] "=rm" (KiBugCheckData[4]) : "[retval]" (KiBugCheckData[4]), [shift] "Nc" (8));
00032 #endif
00033 #endif
00034 }
00035 
00036 BOOLEAN
00037 NTAPI
00038 NmiDbgCallback(IN PVOID Context,
00039                IN BOOLEAN Handled)
00040 {
00041     /* Clear the NMI flag */
00042     NmiClearFlag();
00043 
00044     /* Get NMI status signature */
00045     __indwordstring(0x80, (PULONG)NmiBegin, 1);
00046     ((void(*)())&KiBugCheckData[4])();
00047 
00048     /* Handle the NMI safely */
00049 #ifdef _M_IX86
00050     KiEnableTimerWatchdog = (RtlCompareMemory(NmiBegin, NmiBegin + 4, 4) != 4);
00051 #endif
00052     return TRUE;
00053 }
00054 
00055 NTSTATUS
00056 NTAPI
00057 DriverEntry(IN PDRIVER_OBJECT DriverObject,
00058             IN PUNICODE_STRING RegistryPath)
00059 {
00060     PAGED_CODE();
00061 
00062     /* Register NMI callback */
00063     KeRegisterNmiCallback(&NmiDbgCallback, NULL);
00064 
00065     /* Return success */
00066     return STATUS_SUCCESS;
00067 }
00068 
00069 /* EOF */

Generated on Thu May 24 2012 04:27:41 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.