ReactOS  0.4.15-dev-1177-g6cb3b62
nmidebug.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS NMI Debug Driver
3  * LICENSE: BSD - See COPYING.ARM in the top level directory
4  * FILE: drivers/base/nmidebug/nmidebug.c
5  * PURPOSE: Driver Code
6  * PROGRAMMERS: ReactOS Portable Systems Group
7  */
8 
9 /* INCLUDES *******************************************************************/
10 
11 #include <ntifs.h>
12 #include <ndk/ketypes.h>
13 
14 /* FUNCTIONS ******************************************************************/
15 
16 PCHAR NmiBegin = "NMI4NMI@";
17 
19 VOID
21 {
22  ((PCHAR)&KiBugCheckData[4])[0] -= (NmiBegin[3] | NmiBegin[7]);
23  ((PCHAR)&KiBugCheckData[4])[3] |= 1;
24 #ifdef _M_IX86
25 #if defined(_MSC_VER) && !defined(__clang__)
26  __asm
27  {
28  rcr KiBugCheckData[4], 8
29  }
30 #else
31  __asm__("rcrl %b[shift], %k[retval]" : [retval] "=rm" (KiBugCheckData[4]) : "[retval]" (KiBugCheckData[4]), [shift] "Nc" (8));
32 #endif
33 #endif
34 }
35 
36 BOOLEAN
37 NTAPI
40 {
41  /* Clear the NMI flag */
42  NmiClearFlag();
43 
44  /* Get NMI status signature */
45  __indwordstring(0x80, (PULONG)NmiBegin, 1);
46  ((void(*)())&KiBugCheckData[4])();
47 
48  /* Handle the NMI safely */
49 #ifdef _M_IX86
51 #endif
52  return TRUE;
53 }
54 
56 NTAPI
59 {
60  PAGED_CODE();
61 
62  /* Register NMI callback */
64 
65  /* Return success */
66  return STATUS_SUCCESS;
67 }
68 
69 /* EOF */
signed char * PCHAR
Definition: retypes.h:7
#define IN
Definition: typedefs.h:39
#define shift
Definition: input.c:1756
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN KiEnableTimerWatchdog
Definition: timerobj.c:20
NTSTATUS NTAPI DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath)
Definition: nmidebug.c:57
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
__asm__("\t.globl GetPhys\n" "GetPhys:\t\n" "mflr 0\n\t" "stwu 0,-16(1)\n\t" "mfmsr 5\n\t" "andi. 6,5,0xffef\n\t" "mtmsr 6\n\t" "isync\n\t" "sync\n\t" "lwz 3,0(3)\n\t" "mtmsr 5\n\t" "isync\n\t" "sync\n\t" "lwz 0,0(1)\n\t" "addi 1,1,16\n\t" "mtlr 0\n\t" "blr")
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
#define FORCEINLINE
Definition: ntbasedef.h:216
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
#define PCHAR
Definition: match.c:90
_In_z_ PWSTR RegistryPath
Definition: classp.h:1930
_In_ BOOLEAN Handled
Definition: ketypes.h:337
FORCEINLINE VOID NmiClearFlag(VOID)
Definition: nmidebug.c:20
ULONG_PTR KiBugCheckData[5]
Definition: bug.c:31
BOOLEAN NTAPI NmiDbgCallback(IN PVOID Context, IN BOOLEAN Handled)
Definition: nmidebug.c:38
PPC_QUAL void __indwordstring(unsigned long Port, unsigned long *Buffer, unsigned long Count)
Definition: intrin_ppc.h:598
PCHAR NmiBegin
Definition: nmidebug.c:16
unsigned int * PULONG
Definition: retypes.h:1
PVOID NTAPI KeRegisterNmiCallback(IN PNMI_CALLBACK CallbackRoutine, IN PVOID Context)
Definition: bug.c:1331
return STATUS_SUCCESS
Definition: btrfs.c:3014
#define RtlCompareMemory(s1, s2, l)
Definition: env_spec_w32.h:465
#define PAGED_CODE()