47 lines
2.1 KiB
C
47 lines
2.1 KiB
C
// Public nt-lite DDK debugging declarations.
|
|
|
|
#pragma once
|
|
|
|
#include <stdint.h>
|
|
#include <ntlite/status.h>
|
|
|
|
// Kernel boot debug flags. Keep these contiguous and document every bit in boot.ini.
|
|
#define KE_DEBUG_CONSOLE 0x00000001u // Mirror debug output to the firmware/debug console.
|
|
#define KE_DEBUG_SELFTEST 0x00000002u // Run kernel and SMP boot self-tests.
|
|
#define KE_DEBUG_FILE_LOG 0x00000004u // Retain debug output for kernel.log persistence.
|
|
#define KE_DEBUG_POOL_CANARY 0x00000008u // Validate pool block canaries.
|
|
#define KE_DEBUG_POOL_POISON 0x00000010u // Poison released pool blocks.
|
|
#define KE_DEBUG_POOL_QUARANTINE 0x00000020u // Delay reuse of released pool blocks.
|
|
#define KE_DEBUG_POOL_CALLERS 0x00000040u // Track pool allocation/free callers.
|
|
#define KE_DEBUG_DISPLAY_ASSERTS 0x00000080u // Enable display-path consistency assertions.
|
|
#define KE_DEBUG_LIST_CHECKS 0x00000100u // Validate intrusive-list links on mutation.
|
|
|
|
#define KE_DEBUG_VALID_MASK (KE_DEBUG_CONSOLE | KE_DEBUG_SELFTEST | KE_DEBUG_FILE_LOG | \
|
|
KE_DEBUG_POOL_CANARY | KE_DEBUG_POOL_POISON | \
|
|
KE_DEBUG_POOL_QUARANTINE | KE_DEBUG_POOL_CALLERS | \
|
|
KE_DEBUG_DISPLAY_ASSERTS | KE_DEBUG_LIST_CHECKS)
|
|
|
|
// Driver-visible debug output service table passed through NTL_DDK.
|
|
typedef struct NTL_DDK_DEBUG {
|
|
void (*Print)(const char* fmt, ...);
|
|
uint32_t (*GetFlags)(void);
|
|
} NTL_DDK_DEBUG;
|
|
|
|
// Current fatal categories used by kernel-mode driver diagnostics.
|
|
typedef enum KE_PANIC_CODE {
|
|
KE_PANIC_CODE_GENERIC = 0,
|
|
KE_PANIC_CODE_FAULT = 1,
|
|
KE_PANIC_CODE_IRQL = 2,
|
|
KE_PANIC_CODE_SELFTEST = 3,
|
|
KE_PANIC_CODE_TRAP = 4,
|
|
KE_PANIC_CODE_DRIVER = 5,
|
|
KE_PANIC_CODE_INIT = 6,
|
|
KE_PANIC_CODE_SCHEDULER = 7,
|
|
} KE_PANIC_CODE;
|
|
|
|
// Emits a formatted debug message on the active kernel debug outputs.
|
|
__declspec(dllexport) void DbgPrint(const char* fmt, ...);
|
|
|
|
// Stops the system with a formatted diagnostic message.
|
|
__declspec(dllexport) _Noreturn void KePanic(int32_t code, const char* fmt, ...);
|