Files
nt-lite/code/kernel/ke_debug.h
T

28 lines
1.3 KiB
C

#ifndef KE_DEBUG_H
#define KE_DEBUG_H
#include <stdint.h>
void KeInitDebug(void (*PrintPtr)(char, uint32_t, uint32_t), int v);
__declspec(dllexport) void DbgPrint(const char* fmt, ...);
__declspec(dllexport) void KePrintConsole(const char* buf, size_t len);
__declspec(dllexport) _Noreturn void KePanic(const char *fmt, ...);
// ---------------------------------------------------------------------------
// Fault dispatch - called from the three IDT fault stubs (ke_syscall.asm).
//
// vector : CPU exception number (0=#DE, 13=#GP, 14=#PF)
// rip : faulting instruction pointer (from the CPU exception frame)
// errCode : CPU error code (0 for #DE)
// cr2 : value of CR2 at fault time (meaningful only for #PF)
// cs : CS from the exception frame; RPL bits determine ring
//
// Kernel-mode faults (cs & 3 == 0) call KePanic and halt.
// User-mode faults (cs & 3 == 3) kill the offending process and yield.
// ---------------------------------------------------------------------------
__declspec(dllexport) _Noreturn void KeFaultDispatch(int vector, uintptr_t rip,
uintptr_t errCode, uintptr_t cr2,
uintptr_t cs);
#endif // KE_DEBUG_H