From 35f36adfa6be12916b2c99fc3c7cdd21c71cdbdf Mon Sep 17 00:00:00 2001 From: Rafal Kupiec Date: Mon, 1 Jan 2024 16:28:29 +0100 Subject: [PATCH] Update dummy module --- xtldr2/modules/dummy/dummy.c | 37 ++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/xtldr2/modules/dummy/dummy.c b/xtldr2/modules/dummy/dummy.c index cc24ebb..26e90b6 100644 --- a/xtldr2/modules/dummy/dummy.c +++ b/xtldr2/modules/dummy/dummy.c @@ -11,7 +11,20 @@ /* Dummy module information */ XTBL_MODINFO = L"Dummy XTLDR module"; -XTBL_MODDEPS = {L"dummy2"}; +// XTBL_MODDEPS = {L"dummy2"}; + +/* XTLDR protocol handler */ +PXTBL_LOADER_PROTOCOL XtLdrProto; + +/* Dummy Boot Protocol handler */ +XTBL_BOOT_PROTOCOL DummyProtocol; + +XTCDECL +EFI_STATUS +BootDummyOS(IN PXTBL_BOOT_PARAMETERS Parameters) +{ + return STATUS_EFI_SUCCESS; +} /** * This routine is the entry point of the XT EFI boot loader module. @@ -31,5 +44,25 @@ EFI_STATUS XtLdrModuleMain(IN EFI_HANDLE ImageHandle, IN PEFI_SYSTEM_TABLE SystemTable) { - return STATUS_EFI_SUCCESS; + EFI_GUID DummyGuid = XT_XTOS_BOOT_PROTOCOL_GUID; + EFI_HANDLE Handle = NULL; + EFI_STATUS Status; + + /* Open the XTLDR protocol */ + Status = BlGetXtLdrProtocol(SystemTable, ImageHandle, &XtLdrProto); + if(Status != STATUS_EFI_SUCCESS) + { + /* Failed to open the protocol, return error */ + return STATUS_EFI_LOAD_ERROR; + } + + /* Set boot protocol routines */ + DummyProtocol.BootSystem = BootDummyOS; + + /* Register XTOS boot protocol */ + XtLdrProto->Boot.RegisterProtocol(L"XTOS", &DummyGuid); + + /* Register DUMMY protocol as XTOS boot protocol */ + return SystemTable->BootServices->InstallProtocolInterface(&Handle, &DummyGuid, EFI_NATIVE_INTERFACE, + &DummyProtocol); }