Reorganisation of KeStartXtSystem() routine and early debug printing
All checks were successful
ci/woodpecker/push/build Pipeline was successful
All checks were successful
ci/woodpecker/push/build Pipeline was successful
This commit is contained in:
parent
b7e5f1b5c1
commit
5730e8692e
@ -13,10 +13,10 @@
|
||||
/* XTOS platform debugging macros */
|
||||
#ifdef DBG
|
||||
#define DEBUG 1
|
||||
#define LDRPRINT(Format, ...) if(LdrPrint) LdrPrint(Format, __VA_ARGS__);
|
||||
#define LdrPrint(Format, ...) if(LdrDbgPrint) LdrDbgPrint(Format, __VA_ARGS__);
|
||||
#else
|
||||
#define DEBUG 0
|
||||
#define LDRPRINT(Format, ...) ((VOID)NULL)
|
||||
#define LdrPrint(Format, ...) ((VOID)NULL)
|
||||
#endif
|
||||
|
||||
#endif /* __XTDK_XTDEBUG_H */
|
||||
|
@ -12,6 +12,9 @@
|
||||
#include <xtkmapi.h>
|
||||
|
||||
|
||||
/* Kernel initialization block passed by boot loader */
|
||||
EXTERN PKERNEL_INITIALIZATION_BLOCK KeInitializationBlock;
|
||||
|
||||
/* Kernel own boot stack */
|
||||
EXTERN UCHAR KepKernelBootStackData[KERNEL_STACK_SIZE];
|
||||
|
||||
@ -19,6 +22,6 @@ EXTERN UCHAR KepKernelBootStackData[KERNEL_STACK_SIZE];
|
||||
EXTERN UCHAR KepKernelFaultStackData[KERNEL_STACK_SIZE];
|
||||
|
||||
/* Pointer to boot loader provided DbgPrint() routine */
|
||||
EXTERN VOID (*LdrPrint)(IN PWCHAR Format, IN ...);
|
||||
EXTERN VOID (*LdrDbgPrint)(IN PWCHAR Format, IN ...);
|
||||
|
||||
#endif /* __XTOSKRNL_GLOBALS_H */
|
||||
|
@ -9,6 +9,9 @@
|
||||
#include <xtos.h>
|
||||
|
||||
|
||||
/* Kernel initialization block passed by boot loader */
|
||||
PKERNEL_INITIALIZATION_BLOCK KeInitializationBlock;
|
||||
|
||||
/* Kernel own boot stack */
|
||||
UCHAR KepKernelBootStackData[KERNEL_STACK_SIZE] = {0};
|
||||
|
||||
@ -16,4 +19,4 @@ UCHAR KepKernelBootStackData[KERNEL_STACK_SIZE] = {0};
|
||||
UCHAR KepKernelFaultStackData[KERNEL_STACK_SIZE] = {0};
|
||||
|
||||
/* Pointer to boot loader provided DbgPrint() routine */
|
||||
VOID (*LdrPrint)(IN PWCHAR Format, IN ...) = NULL;
|
||||
VOID (*LdrDbgPrint)(IN PWCHAR Format, IN ...) = NULL;
|
||||
|
@ -27,14 +27,29 @@ KeStartXtSystem(IN PKERNEL_INITIALIZATION_BLOCK Parameters)
|
||||
if(DEBUG && Parameters->LoaderInformation.DbgPrint)
|
||||
{
|
||||
/* Use loader's provided DbgPrint() routine for early printing to serial console */
|
||||
LdrPrint = Parameters->LoaderInformation.DbgPrint;
|
||||
LdrDbgPrint = Parameters->LoaderInformation.DbgPrint;
|
||||
}
|
||||
|
||||
|
||||
/* Print some message to serial console and test kernel parameters */
|
||||
LdrPrint(L"Hello world from ExectOS kernel!\n");
|
||||
LdrPrint(L"\n\n------ Kernel parameters block ------\n"
|
||||
L"Loader block size: %lu\n"
|
||||
L"Loader block version: %lu\n"
|
||||
L"EFI Revision: %lu\n"
|
||||
L"EFI RunTime Revision: %lu\n\n",
|
||||
Parameters->Size,
|
||||
Parameters->Version,
|
||||
Parameters->FirmwareInformation.EfiFirmware.EfiVersion,
|
||||
((PEFI_RUNTIME_SERVICES) Parameters->FirmwareInformation.EfiFirmware.EfiRuntimeServices)->Hdr.Revision
|
||||
);
|
||||
|
||||
|
||||
/* Make sure kernel boot stack is initialized */
|
||||
if(!Parameters->KernelBootStack)
|
||||
{
|
||||
/* Initialize kernel boot stack */
|
||||
LDRPRINT(L"Initializing kernel boot stack\n");
|
||||
LdrPrint(L"Initializing kernel boot stack\n");
|
||||
Parameters->KernelBootStack = (ULONG_PTR)&KepKernelBootStackData[KERNEL_STACK_SIZE];
|
||||
}
|
||||
|
||||
@ -42,25 +57,10 @@ KeStartXtSystem(IN PKERNEL_INITIALIZATION_BLOCK Parameters)
|
||||
if(!Parameters->KernelFaultStack)
|
||||
{
|
||||
/* Initialize kernel fault stack */
|
||||
LDRPRINT(L"Initializing kernel fault stack\n");
|
||||
LdrPrint(L"Initializing kernel fault stack\n");
|
||||
Parameters->KernelFaultStack = (ULONG_PTR)&KepKernelFaultStackData[KERNEL_STACK_SIZE];
|
||||
}
|
||||
|
||||
/* Print some message to serial console */
|
||||
LDRPRINT(L"Hello world from ExectOS kernel!\n");
|
||||
|
||||
/* Test kernel parameters */
|
||||
LDRPRINT(L"\n\n------ Kernel parameters block ------\n"
|
||||
L"Loader block size: %lu\n"
|
||||
L"Loader block version: %lu\n"
|
||||
L"EFI Revision: %lu\n"
|
||||
L"EFI RunTime Revision: %lu\n",
|
||||
Parameters->Size,
|
||||
Parameters->Version,
|
||||
Parameters->FirmwareInformation.EfiFirmware.EfiVersion,
|
||||
((PEFI_RUNTIME_SERVICES) Parameters->FirmwareInformation.EfiFirmware.EfiRuntimeServices)->Hdr.Revision
|
||||
);
|
||||
|
||||
/* Enter infinite kernel thread loop */
|
||||
for(;;);
|
||||
/* Save the kernel initialization block */
|
||||
KeInitializationBlock = Parameters;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user