From c87aabd9fe6d3355cb4531345f313e9dc412b517 Mon Sep 17 00:00:00 2001 From: SergeySlice Date: Thu, 23 Jul 2020 23:42:29 +0300 Subject: [PATCH] kernel addresses are shifted Signed-off-by: SergeySlice --- rEFIt_UEFI/Platform/kernel_patcher.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rEFIt_UEFI/Platform/kernel_patcher.cpp b/rEFIt_UEFI/Platform/kernel_patcher.cpp index 9d611c975..416f05ec0 100644 --- a/rEFIt_UEFI/Platform/kernel_patcher.cpp +++ b/rEFIt_UEFI/Platform/kernel_patcher.cpp @@ -2446,12 +2446,12 @@ LOADER_ENTRY::KernelAndKextPatcherInit() // for AptioFix booting - it's always at KernelRelocBase + 0x00200000 // UINT64 os_version = AsciiOSVersionToUint64(OSVersion); - DBG("os_version=%s\n", OSVersion); + DBG("os_version=%s\n", OSVersion); // if (os_version < AsciiOSVersionToUint64("10.6")) { // KernelData = (UINT8*)(UINTN)(KernelSlide + KernelRelocBase + 0x00111000); // } else { - KernelData = (UINT8*)(UINTN)(KernelSlide + KernelRelocBase + 0x00200000); + KernelData = (UINT8*)(UINTN)(KernelSlide + KernelRelocBase + 0x00200000); // } // check that it is Mach-O header and detect architecture @@ -2483,7 +2483,7 @@ LOADER_ENTRY::KernelAndKextPatcherInit() KernelData = NULL; return; } - DBG( " kernel offset at 0x%x\n", KernelOffset); + // DBG( " kernel offset at 0x%x\n", KernelOffset); // find __PRELINK_TEXT and __PRELINK_INFO Get_PreLink(); //find symbol tables @@ -2491,8 +2491,8 @@ LOADER_ENTRY::KernelAndKextPatcherInit() UINT32 symCmdOffset = 0; Get_Symtab(&KernelData[KernelOffset], &symCmdOffset); if (symCmdOffset != 0) { - symCmd = (struct symtab_command *)&KernelData[symCmdOffset]; - AddrVtable = symCmd->symoff; + symCmd = (struct symtab_command *)&KernelData[KernelOffset + symCmdOffset]; + AddrVtable = symCmd->symoff; //this offset relative to KernelData+0 SizeVtable = symCmd->nsyms; NamesTable = symCmd->stroff; DBG("Kernel: AddrVtable=0x%x SizeVtable=0x%x NamesTable=0x%x\n", AddrVtable, SizeVtable, NamesTable);