Setup processor context (GDT, PCR, TSS) and kernel startup stack before booting XTOS
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:
@@ -188,6 +188,7 @@ XtpBootSequence(IN PEFI_FILE_HANDLE BootDir,
|
||||
LIST_ENTRY MemoryMappings;
|
||||
ULONG KernelStackPages;
|
||||
EFI_STATUS Status;
|
||||
PKGDTENTRY Gdt;
|
||||
|
||||
/* Initialize XTOS startup sequence */
|
||||
XtLdrProtocol->DbgPrint(L"Initializing XTOS startup sequence\n");
|
||||
@@ -257,6 +258,15 @@ XtpBootSequence(IN PEFI_FILE_HANDLE BootDir,
|
||||
KernelStackPages, LoaderStartupKernelStack);
|
||||
VirtualAddress += (KernelStackPages * EFI_PAGE_SIZE);
|
||||
|
||||
/* Set processor context */
|
||||
Status = XtpSetProcessorContext(&MemoryMappings, &VirtualAddress, &Gdt);
|
||||
if(Status != STATUS_EFI_SUCCESS)
|
||||
{
|
||||
/* Failed to set processor context */
|
||||
XtLdrProtocol->DbgPrint(L"Failed to set processor context (Status Code: %lx)\n", Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* Enable paging */
|
||||
EfiSystemTable->BootServices->HandleProtocol(EfiImageHandle, &LoadedImageGuid, (PVOID*)&ImageProtocol);
|
||||
Status = XtLdrProtocol->EnablePaging(&MemoryMappings, VirtualAddress, ImageProtocol, &XtPageMap);
|
||||
@@ -267,6 +277,9 @@ XtpBootSequence(IN PEFI_FILE_HANDLE BootDir,
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* Load processor context */
|
||||
XtpLoadProcessorContext(Gdt);
|
||||
|
||||
/* Call XTOS kernel */
|
||||
XtLdrProtocol->DbgPrint(L"Booting the XTOS kernel\n");
|
||||
KernelEntryPoint(KernelParameters);
|
||||
|
||||
Reference in New Issue
Block a user