From c98007a4a57f45b7631526d7d9639d8b6581396f Mon Sep 17 00:00:00 2001 From: Rafal Kupiec Date: Wed, 10 Jan 2024 19:55:20 +0100 Subject: [PATCH] Do not link against libxtos if not needed --- xtldr/modules/fb_o/CMakeLists.txt | 2 +- xtldr/modules/pecoff_o/CMakeLists.txt | 2 +- xtldr/modules/pecoff_o/pecoff.c | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/xtldr/modules/fb_o/CMakeLists.txt b/xtldr/modules/fb_o/CMakeLists.txt index f8d811b..ea39165 100644 --- a/xtldr/modules/fb_o/CMakeLists.txt +++ b/xtldr/modules/fb_o/CMakeLists.txt @@ -15,7 +15,7 @@ list(APPEND XTLDR_FB_O_SOURCE add_executable(fb_o ${XTLDR_FB_O_SOURCE}) # Add linker libraries -target_link_libraries(fb_o libxtos libxtldr) +target_link_libraries(fb_o libxtldr) # Set proper binary name and install target set_target_properties(fb_o PROPERTIES SUFFIX .efi) diff --git a/xtldr/modules/pecoff_o/CMakeLists.txt b/xtldr/modules/pecoff_o/CMakeLists.txt index 12e137f..d96155b 100644 --- a/xtldr/modules/pecoff_o/CMakeLists.txt +++ b/xtldr/modules/pecoff_o/CMakeLists.txt @@ -14,7 +14,7 @@ list(APPEND XTLDR_PECOFF_O_SOURCE add_executable(pecoff_o ${XTLDR_PECOFF_O_SOURCE}) # Add linker libraries -target_link_libraries(pecoff_o libxtos libxtldr) +target_link_libraries(pecoff_o libxtldr) # Set proper binary name and install target set_target_properties(pecoff_o PROPERTIES SUFFIX .efi) diff --git a/xtldr/modules/pecoff_o/pecoff.c b/xtldr/modules/pecoff_o/pecoff.c index 2a4baed..1659bbe 100644 --- a/xtldr/modules/pecoff_o/pecoff.c +++ b/xtldr/modules/pecoff_o/pecoff.c @@ -283,7 +283,7 @@ PeLoadImage(IN PEFI_FILE_HANDLE FileHandle, } /* Copy all sections */ - RtlCopyMemory(ImageData->Data, Data, ImageData->PeHeader->OptionalHeader.SizeOfHeaders); + XtLdrProtocol->Memory.CopyMemory(ImageData->Data, Data, ImageData->PeHeader->OptionalHeader.SizeOfHeaders); /* Find section header */ SectionHeader = (PPECOFF_IMAGE_SECTION_HEADER)((PUCHAR)&ImageData->PeHeader->OptionalHeader + @@ -308,16 +308,16 @@ PeLoadImage(IN PEFI_FILE_HANDLE FileHandle, if(SectionSize > 0 && SectionHeader[Index].PointerToRawData != 0) { /* Copy section */ - RtlCopyMemory((PUINT8)ImageData->Data + SectionHeader[Index].VirtualAddress, - Data + SectionHeader[Index].PointerToRawData, SectionSize); + XtLdrProtocol->Memory.CopyMemory((PUINT8)ImageData->Data + SectionHeader[Index].VirtualAddress, + Data + SectionHeader[Index].PointerToRawData, SectionSize); } /* Check if raw size is shorter than virtual size */ if(SectionSize < SectionHeader[Index].Misc.VirtualSize) { /* Fill remaining space with zeroes */ - RtlZeroMemory((PUINT8)ImageData->Data + SectionHeader[Index].VirtualAddress + SectionSize, - SectionHeader[Index].Misc.VirtualSize - SectionSize); + XtLdrProtocol->Memory.ZeroMemory((PUINT8)ImageData->Data + SectionHeader[Index].VirtualAddress + SectionSize, + SectionHeader[Index].Misc.VirtualSize - SectionSize); } }