From 475b0fd7cb55b963b206d9eddcbfbb2e3bd88748 Mon Sep 17 00:00:00 2001 From: ReactOS Portable Systems Group Date: Sat, 2 Jan 2010 04:50:08 +0000 Subject: [PATCH] NMI Support Patch 13: [NMIDEBUG]: Add new NMI Debug driver. It registers an NMI callback on startup. The callback does nothing useful at the moment, but you can enhance it to add all sorts of debugging information that would otherwise be unavailable in situations such as an interrupt storm, IRQL hang, etc. When you send an NMI, such as by using QEMU, you should see the driver print a string. svn path=/trunk/; revision=44878 --- reactos/drivers/base/directory.rbuild | 3 ++ reactos/drivers/base/nmidebug/nmidebug.c | 49 +++++++++++++++++++ reactos/drivers/base/nmidebug/nmidebug.rbuild | 9 ++++ reactos/drivers/base/nmidebug/nmidebug.rc | 11 +++++ 4 files changed, 72 insertions(+) create mode 100644 reactos/drivers/base/nmidebug/nmidebug.c create mode 100644 reactos/drivers/base/nmidebug/nmidebug.rbuild create mode 100644 reactos/drivers/base/nmidebug/nmidebug.rc diff --git a/reactos/drivers/base/directory.rbuild b/reactos/drivers/base/directory.rbuild index e02425c92ea..697234e37a6 100644 --- a/reactos/drivers/base/directory.rbuild +++ b/reactos/drivers/base/directory.rbuild @@ -20,4 +20,7 @@ + + + diff --git a/reactos/drivers/base/nmidebug/nmidebug.c b/reactos/drivers/base/nmidebug/nmidebug.c new file mode 100644 index 00000000000..875b92c1e15 --- /dev/null +++ b/reactos/drivers/base/nmidebug/nmidebug.c @@ -0,0 +1,49 @@ +/* + * PROJECT: ReactOS NMI Debug Driver + * LICENSE: BSD - See COPYING.ARM in the top level directory + * FILE: drivers/base/nmidebug/nmidebug.c + * PURPOSE: Driver Code + * PROGRAMMERS: ReactOS Portable Systems Group + */ + +/* INCLUDES *******************************************************************/ + +#include + +/* FUNCTIONS ******************************************************************/ + +BOOLEAN +NTAPI +NmiDbgCallback(IN PVOID Context, + IN BOOLEAN Handled) +{ + // + // Let the user know we are alive + // + DbgPrint("NMI Callback entered! Letting the system crash...\n"); + + // + // Do not handle the NMI + // + return FALSE; +} + +NTSTATUS +NTAPI +DriverEntry(IN PDRIVER_OBJECT DriverObject, + IN PUNICODE_STRING RegistryPath) +{ + PAGED_CODE(); + + // + // Register NMI callback + // + KeRegisterNmiCallback(&NmiDbgCallback, NULL); + + // + // Return success + // + return STATUS_SUCCESS; +} + +/* EOF */ diff --git a/reactos/drivers/base/nmidebug/nmidebug.rbuild b/reactos/drivers/base/nmidebug/nmidebug.rbuild new file mode 100644 index 00000000000..5447a4a10d5 --- /dev/null +++ b/reactos/drivers/base/nmidebug/nmidebug.rbuild @@ -0,0 +1,9 @@ + + + + . + ntoskrnl + hal + nmidebug.c + nmidebug.rc + diff --git a/reactos/drivers/base/nmidebug/nmidebug.rc b/reactos/drivers/base/nmidebug/nmidebug.rc new file mode 100644 index 00000000000..f77708f3552 --- /dev/null +++ b/reactos/drivers/base/nmidebug/nmidebug.rc @@ -0,0 +1,11 @@ +#include +#include + +#define VER_FILETYPE VFT_DRV +#define VER_FILESUBTYPE VFT2_DRV_SYSTEM +#define VER_FILEDESCRIPTION_STR "NMI debug driver" +#define VER_INTERNALNAME_STR "NMIDEBUG.SYS" +#define VER_ORIGINALFILENAME_STR "NMIDEBUG.SYS" +#define VER_LANGNEUTRAL + +#include "common.ver"