Use more generic name for this macro use pointer used behind it will point to kernel debugger after it gets initialized
All checks were successful
ci/woodpecker/push/build Pipeline was successful

This commit is contained in:
Rafal Kupiec 2023-02-07 19:37:44 +01:00
parent 67768ae7a3
commit 75c519a70c
Signed by: belliash
GPG Key ID: 4E829243E0CFE6B4
8 changed files with 62 additions and 62 deletions

View File

@ -11,19 +11,19 @@
/* Debugging macros */ /* Debugging macros */
#define CHECKPOINT LdrPrint(L"Checkpoint reached at %s:%d\n", __FILE__, __LINE__); #define CHECKPOINT DebugPrint(L"Checkpoint reached at %s:%d\n", __FILE__, __LINE__);
#define DEPRECATED LdrPrint(L"Called deprecated routine '%s()' at %s:%d\n", \ #define DEPRECATED DebugPrint(L"Called deprecated routine '%s()' at %s:%d\n", \
__FUNCTION__, __FILE__, __LINE__); __FUNCTION__, __FILE__, __LINE__);
#define UNIMPLEMENTED LdrPrint(L"Called unimplemented routine '%s()' at %s:%d\n", \ #define UNIMPLEMENTED DebugPrint(L"Called unimplemented routine '%s()' at %s:%d\n", \
__FUNCTION__, __FILE__, __LINE__); __FUNCTION__, __FILE__, __LINE__);
/* XTOS platform debugging macros */ /* XTOS platform debugging macros */
#ifdef DBG #ifdef DBG
#define DEBUG 1 #define DEBUG 1
#define LdrPrint(Format, ...) if(LdrDbgPrint) LdrDbgPrint(Format, __VA_ARGS__); #define DebugPrint(Format, ...) if(KeDbgPrint) KeDbgPrint(Format, __VA_ARGS__);
#else #else
#define DEBUG 0 #define DEBUG 0
#define LdrPrint(Format, ...) ((VOID)NULL) #define DebugPrint(Format, ...) ((VOID)NULL)
#endif #endif
#endif /* __XTDK_XTDEBUG_H */ #endif /* __XTDK_XTDEBUG_H */

View File

@ -13,14 +13,14 @@ XTCDECL
VOID VOID
ArpHandleSystemCall32() ArpHandleSystemCall32()
{ {
LdrPrint(L"Handled 32-bit system call!\n"); DebugPrint(L"Handled 32-bit system call!\n");
} }
XTCDECL XTCDECL
VOID VOID
ArpHandleSystemCall64() ArpHandleSystemCall64()
{ {
LdrPrint(L"Handled 64-bit system call!\n"); DebugPrint(L"Handled 64-bit system call!\n");
} }
/** /**
@ -34,7 +34,7 @@ XTCDECL
VOID VOID
ArpHandleTrap00() ArpHandleTrap00()
{ {
LdrPrint(L"Handled Division-By-Zero Error (0x00)!\n"); DebugPrint(L"Handled Division-By-Zero Error (0x00)!\n");
for(;;); for(;;);
} }
@ -49,7 +49,7 @@ XTCDECL
VOID VOID
ArpHandleTrap01() ArpHandleTrap01()
{ {
LdrPrint(L"Handled Debug exception (0x01)!\n"); DebugPrint(L"Handled Debug exception (0x01)!\n");
for(;;); for(;;);
} }
@ -64,7 +64,7 @@ XTCDECL
VOID VOID
ArpHandleTrap02() ArpHandleTrap02()
{ {
LdrPrint(L"Handled Non-Maskable-Interrupt (0x02)!\n"); DebugPrint(L"Handled Non-Maskable-Interrupt (0x02)!\n");
for(;;); for(;;);
} }
@ -79,7 +79,7 @@ XTCDECL
VOID VOID
ArpHandleTrap03() ArpHandleTrap03()
{ {
LdrPrint(L"Handled INT3 (0x03)!\n"); DebugPrint(L"Handled INT3 (0x03)!\n");
for(;;); for(;;);
} }
@ -94,7 +94,7 @@ XTCDECL
VOID VOID
ArpHandleTrap04() ArpHandleTrap04()
{ {
LdrPrint(L"Handled Overflow exception (0x04)!\n"); DebugPrint(L"Handled Overflow exception (0x04)!\n");
for(;;); for(;;);
} }
@ -109,7 +109,7 @@ XTCDECL
VOID VOID
ArpHandleTrap05() ArpHandleTrap05()
{ {
LdrPrint(L"Handled Bound-Range-Exceeded exception (0x05)!\n"); DebugPrint(L"Handled Bound-Range-Exceeded exception (0x05)!\n");
for(;;); for(;;);
} }
@ -124,7 +124,7 @@ XTCDECL
VOID VOID
ArpHandleTrap06() ArpHandleTrap06()
{ {
LdrPrint(L"Handled Invalid Opcode exception (0x06)!\n"); DebugPrint(L"Handled Invalid Opcode exception (0x06)!\n");
for(;;); for(;;);
} }
@ -139,7 +139,7 @@ XTCDECL
VOID VOID
ArpHandleTrap07() ArpHandleTrap07()
{ {
LdrPrint(L"Handled Device Not Available exception (0x07)!\n"); DebugPrint(L"Handled Device Not Available exception (0x07)!\n");
for(;;); for(;;);
} }
@ -154,7 +154,7 @@ XTCDECL
VOID VOID
ArpHandleTrap08() ArpHandleTrap08()
{ {
LdrPrint(L"Handled Double-Fault exception (0x08)!\n"); DebugPrint(L"Handled Double-Fault exception (0x08)!\n");
for(;;); for(;;);
} }
@ -169,7 +169,7 @@ XTCDECL
VOID VOID
ArpHandleTrap09() ArpHandleTrap09()
{ {
LdrPrint(L"Handled Segment-Overrun exception (0x09)!\n"); DebugPrint(L"Handled Segment-Overrun exception (0x09)!\n");
for(;;); for(;;);
} }
@ -184,7 +184,7 @@ XTCDECL
VOID VOID
ArpHandleTrap0A() ArpHandleTrap0A()
{ {
LdrPrint(L"Handled Invalid-TSS exception (0x0A)!\n"); DebugPrint(L"Handled Invalid-TSS exception (0x0A)!\n");
for(;;); for(;;);
} }
@ -199,7 +199,7 @@ XTCDECL
VOID VOID
ArpHandleTrap0B() ArpHandleTrap0B()
{ {
LdrPrint(L"Handled Segment-Not-Present exception (0x0B)!\n"); DebugPrint(L"Handled Segment-Not-Present exception (0x0B)!\n");
for(;;); for(;;);
} }
@ -214,7 +214,7 @@ XTCDECL
VOID VOID
ArpHandleTrap0C() ArpHandleTrap0C()
{ {
LdrPrint(L"Handled Stack-Segment-Fault exception (0x0C)!\n"); DebugPrint(L"Handled Stack-Segment-Fault exception (0x0C)!\n");
for(;;); for(;;);
} }
@ -229,7 +229,7 @@ XTCDECL
VOID VOID
ArpHandleTrap0D() ArpHandleTrap0D()
{ {
LdrPrint(L"Handled General-Protection-Fault (0x0D)!\n"); DebugPrint(L"Handled General-Protection-Fault (0x0D)!\n");
for(;;); for(;;);
} }
@ -244,7 +244,7 @@ XTCDECL
VOID VOID
ArpHandleTrap0E() ArpHandleTrap0E()
{ {
LdrPrint(L"Handled Page-Fault exception (0x0E)!\n"); DebugPrint(L"Handled Page-Fault exception (0x0E)!\n");
for(;;); for(;;);
} }
@ -259,7 +259,7 @@ XTCDECL
VOID VOID
ArpHandleTrap10() ArpHandleTrap10()
{ {
LdrPrint(L"Handled x87 Floating-Point exception (0x10)!\n"); DebugPrint(L"Handled x87 Floating-Point exception (0x10)!\n");
for(;;); for(;;);
} }
@ -274,7 +274,7 @@ XTCDECL
VOID VOID
ArpHandleTrap11() ArpHandleTrap11()
{ {
LdrPrint(L"Handled Alignment-Check exception (0x11)!\n"); DebugPrint(L"Handled Alignment-Check exception (0x11)!\n");
for(;;); for(;;);
} }
@ -289,7 +289,7 @@ XTCDECL
VOID VOID
ArpHandleTrap12() ArpHandleTrap12()
{ {
LdrPrint(L"Handled Machine-Check exception (0x12)!\n"); DebugPrint(L"Handled Machine-Check exception (0x12)!\n");
for(;;); for(;;);
} }
@ -304,7 +304,7 @@ XTCDECL
VOID VOID
ArpHandleTrap13() ArpHandleTrap13()
{ {
LdrPrint(L"Handled SIMD Floating-Point exception (0x13)!\n"); DebugPrint(L"Handled SIMD Floating-Point exception (0x13)!\n");
for(;;); for(;;);
} }
@ -319,7 +319,7 @@ XTCDECL
VOID VOID
ArpHandleTrap2C() ArpHandleTrap2C()
{ {
LdrPrint(L"Handled Assertion (0x2C)!\n"); DebugPrint(L"Handled Assertion (0x2C)!\n");
for(;;); for(;;);
} }
@ -334,7 +334,7 @@ XTCDECL
VOID VOID
ArpHandleTrap2D() ArpHandleTrap2D()
{ {
LdrPrint(L"Handled Debug-Service-Request (0x2D)!\n"); DebugPrint(L"Handled Debug-Service-Request (0x2D)!\n");
for(;;); for(;;);
} }
@ -349,6 +349,6 @@ XTCDECL
VOID VOID
ArpHandleTrapFF() ArpHandleTrapFF()
{ {
LdrPrint(L"Handled Unexpected-Interrupt (0xFF)!\n"); DebugPrint(L"Handled Unexpected-Interrupt (0xFF)!\n");
for(;;); for(;;);
} }

View File

@ -20,7 +20,7 @@ XTCDECL
VOID VOID
ArpHandleTrap00() ArpHandleTrap00()
{ {
LdrPrint(L"Handled Division-By-Zero Error (0x00)!\n"); DebugPrint(L"Handled Division-By-Zero Error (0x00)!\n");
for(;;); for(;;);
} }
@ -35,7 +35,7 @@ XTCDECL
VOID VOID
ArpHandleTrap01() ArpHandleTrap01()
{ {
LdrPrint(L"Handled Debug exception (0x01)!\n"); DebugPrint(L"Handled Debug exception (0x01)!\n");
for(;;); for(;;);
} }
@ -50,7 +50,7 @@ XTCDECL
VOID VOID
ArpHandleTrap02() ArpHandleTrap02()
{ {
LdrPrint(L"Handled Non-Maskable-Interrupt (0x02)!\n"); DebugPrint(L"Handled Non-Maskable-Interrupt (0x02)!\n");
for(;;); for(;;);
} }
@ -65,7 +65,7 @@ XTCDECL
VOID VOID
ArpHandleTrap03() ArpHandleTrap03()
{ {
LdrPrint(L"Handled INT3 (0x03)!\n"); DebugPrint(L"Handled INT3 (0x03)!\n");
for(;;); for(;;);
} }
@ -80,7 +80,7 @@ XTCDECL
VOID VOID
ArpHandleTrap04() ArpHandleTrap04()
{ {
LdrPrint(L"Handled Overflow exception (0x04)!\n"); DebugPrint(L"Handled Overflow exception (0x04)!\n");
for(;;); for(;;);
} }
@ -95,7 +95,7 @@ XTCDECL
VOID VOID
ArpHandleTrap05() ArpHandleTrap05()
{ {
LdrPrint(L"Handled Bound-Range-Exceeded exception (0x05)!\n"); DebugPrint(L"Handled Bound-Range-Exceeded exception (0x05)!\n");
for(;;); for(;;);
} }
@ -110,7 +110,7 @@ XTCDECL
VOID VOID
ArpHandleTrap06() ArpHandleTrap06()
{ {
LdrPrint(L"Handled Invalid Opcode exception (0x06)!\n"); DebugPrint(L"Handled Invalid Opcode exception (0x06)!\n");
for(;;); for(;;);
} }
@ -125,7 +125,7 @@ XTCDECL
VOID VOID
ArpHandleTrap07() ArpHandleTrap07()
{ {
LdrPrint(L"Handled Device Not Available exception (0x07)!\n"); DebugPrint(L"Handled Device Not Available exception (0x07)!\n");
for(;;); for(;;);
} }
@ -140,7 +140,7 @@ XTCDECL
VOID VOID
ArpHandleTrap08() ArpHandleTrap08()
{ {
LdrPrint(L"Handled Double-Fault exception (0x08)!\n"); DebugPrint(L"Handled Double-Fault exception (0x08)!\n");
for(;;); for(;;);
} }
@ -155,7 +155,7 @@ XTCDECL
VOID VOID
ArpHandleTrap09() ArpHandleTrap09()
{ {
LdrPrint(L"Handled Segment-Overrun exception (0x09)!\n"); DebugPrint(L"Handled Segment-Overrun exception (0x09)!\n");
for(;;); for(;;);
} }
@ -170,7 +170,7 @@ XTCDECL
VOID VOID
ArpHandleTrap0A() ArpHandleTrap0A()
{ {
LdrPrint(L"Handled Invalid-TSS exception (0x0A)!\n"); DebugPrint(L"Handled Invalid-TSS exception (0x0A)!\n");
for(;;); for(;;);
} }
@ -185,7 +185,7 @@ XTCDECL
VOID VOID
ArpHandleTrap0B() ArpHandleTrap0B()
{ {
LdrPrint(L"Handled Segment-Not-Present exception (0x0B)!\n"); DebugPrint(L"Handled Segment-Not-Present exception (0x0B)!\n");
for(;;); for(;;);
} }
@ -200,7 +200,7 @@ XTCDECL
VOID VOID
ArpHandleTrap0C() ArpHandleTrap0C()
{ {
LdrPrint(L"Handled Stack-Segment-Fault exception (0x0C)!\n"); DebugPrint(L"Handled Stack-Segment-Fault exception (0x0C)!\n");
for(;;); for(;;);
} }
@ -215,7 +215,7 @@ XTCDECL
VOID VOID
ArpHandleTrap0D() ArpHandleTrap0D()
{ {
LdrPrint(L"Handled General-Protection-Fault (0x0D)!\n"); DebugPrint(L"Handled General-Protection-Fault (0x0D)!\n");
for(;;); for(;;);
} }
@ -230,7 +230,7 @@ XTCDECL
VOID VOID
ArpHandleTrap0E() ArpHandleTrap0E()
{ {
LdrPrint(L"Handled Page-Fault exception (0x0E)!\n"); DebugPrint(L"Handled Page-Fault exception (0x0E)!\n");
for(;;); for(;;);
} }
@ -245,7 +245,7 @@ XTCDECL
VOID VOID
ArpHandleTrap10() ArpHandleTrap10()
{ {
LdrPrint(L"Handled x87 Floating-Point exception (0x10)!\n"); DebugPrint(L"Handled x87 Floating-Point exception (0x10)!\n");
for(;;); for(;;);
} }
@ -260,7 +260,7 @@ XTCDECL
VOID VOID
ArpHandleTrap11() ArpHandleTrap11()
{ {
LdrPrint(L"Handled Alignment-Check exception (0x11)!\n"); DebugPrint(L"Handled Alignment-Check exception (0x11)!\n");
for(;;); for(;;);
} }
@ -275,7 +275,7 @@ XTCDECL
VOID VOID
ArpHandleTrap12() ArpHandleTrap12()
{ {
LdrPrint(L"Handled Machine-Check exception (0x12)!\n"); DebugPrint(L"Handled Machine-Check exception (0x12)!\n");
for(;;); for(;;);
} }
@ -290,7 +290,7 @@ XTCDECL
VOID VOID
ArpHandleTrap13() ArpHandleTrap13()
{ {
LdrPrint(L"Handled SIMD Floating-Point exception (0x13)!\n"); DebugPrint(L"Handled SIMD Floating-Point exception (0x13)!\n");
for(;;); for(;;);
} }
@ -305,7 +305,7 @@ XTCDECL
VOID VOID
ArpHandleTrap2C() ArpHandleTrap2C()
{ {
LdrPrint(L"Handled Assertion (0x2C)!\n"); DebugPrint(L"Handled Assertion (0x2C)!\n");
for(;;); for(;;);
} }
@ -320,7 +320,7 @@ XTCDECL
VOID VOID
ArpHandleTrap2D() ArpHandleTrap2D()
{ {
LdrPrint(L"Handled Debug-Service-Request (0x2D)!\n"); DebugPrint(L"Handled Debug-Service-Request (0x2D)!\n");
for(;;); for(;;);
} }
@ -335,6 +335,6 @@ XTCDECL
VOID VOID
ArpHandleTrapFF() ArpHandleTrapFF()
{ {
LdrPrint(L"Handled Unexpected-Interrupt (0xFF)!\n"); DebugPrint(L"Handled Unexpected-Interrupt (0xFF)!\n");
for(;;); for(;;);
} }

View File

@ -16,10 +16,10 @@
/* FrameBuffer information */ /* FrameBuffer information */
EXTERN HAL_FRAMEBUFFER_DATA HlpFrameBufferData; EXTERN HAL_FRAMEBUFFER_DATA HlpFrameBufferData;
/* Pointer to boot loader provided DbgPrint() routine */
EXTERN VOID (*KeDbgPrint)(IN PWCHAR Format, IN ...);
/* Kernel initialization block passed by boot loader */ /* Kernel initialization block passed by boot loader */
EXTERN PKERNEL_INITIALIZATION_BLOCK KeInitializationBlock; EXTERN PKERNEL_INITIALIZATION_BLOCK KeInitializationBlock;
/* Pointer to boot loader provided DbgPrint() routine */
EXTERN VOID (*LdrDbgPrint)(IN PWCHAR Format, IN ...);
#endif /* __XTOSKRNL_GLOBALS_H */ #endif /* __XTOSKRNL_GLOBALS_H */

View File

@ -36,7 +36,7 @@ XTAPI
VOID VOID
KepStartKernel(VOID) KepStartKernel(VOID)
{ {
LdrPrint(L"Hello from new kernel stack!\n"); DebugPrint(L"Hello from new kernel stack!\n");
for(;;); for(;;);
} }

View File

@ -12,8 +12,8 @@
/* FrameBuffer information */ /* FrameBuffer information */
HAL_FRAMEBUFFER_DATA HlpFrameBufferData; HAL_FRAMEBUFFER_DATA HlpFrameBufferData;
/* Pointer to boot loader provided DbgPrint() routine */
VOID (*KeDbgPrint)(IN PWCHAR Format, IN ...) = NULL;
/* Kernel initialization block passed by boot loader */ /* Kernel initialization block passed by boot loader */
PKERNEL_INITIALIZATION_BLOCK KeInitializationBlock; PKERNEL_INITIALIZATION_BLOCK KeInitializationBlock;
/* Pointer to boot loader provided DbgPrint() routine */
VOID (*LdrDbgPrint)(IN PWCHAR Format, IN ...) = NULL;

View File

@ -36,7 +36,7 @@ XTAPI
VOID VOID
KepStartKernel(VOID) KepStartKernel(VOID)
{ {
LdrPrint(L"Hello from new kernel stack!\n"); DebugPrint(L"Hello from new kernel stack!\n");
for(;;); for(;;);
} }

View File

@ -27,13 +27,13 @@ KeStartXtSystem(IN PKERNEL_INITIALIZATION_BLOCK Parameters)
if(DEBUG && Parameters->LoaderInformation.DbgPrint) if(DEBUG && Parameters->LoaderInformation.DbgPrint)
{ {
/* Use loader's provided DbgPrint() routine for early printing to serial console */ /* Use loader's provided DbgPrint() routine for early printing to serial console */
LdrDbgPrint = Parameters->LoaderInformation.DbgPrint; KeDbgPrint = Parameters->LoaderInformation.DbgPrint;
} }
/* Print some message to serial console and test kernel parameters */ /* Print some message to serial console and test kernel parameters */
LdrPrint(L"Hello world from ExectOS kernel!\n"); DebugPrint(L"Hello world from ExectOS kernel!\n");
LdrPrint(L"\n\n------ Kernel parameters block ------\n" DebugPrint(L"\n\n------ Kernel parameters block ------\n"
L"Loader block size: %lu\n" L"Loader block size: %lu\n"
L"Loader block version: %lu\n" L"Loader block version: %lu\n"
L"EFI Revision: %lu\n", L"EFI Revision: %lu\n",