From: Vladimir Serbinenko Subject: [PATCH 2/2] efiboot: Increase kern loading size and range To: tech@openbsd.org Cc: Vladimir Serbinenko Date: Sat, 1 Mar 2025 16:21:07 +0300 To accomodate for page table for sure, increase kern loading allocation. To compensate for this increase the allowable range for this allocation. This exposes a bug in entry point calculation that is fixed in this patch --- sys/arch/amd64/stand/efiboot/efiboot.c | 4 ++-- sys/arch/amd64/stand/efiboot/exec_i386.c | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/sys/arch/amd64/stand/efiboot/efiboot.c b/sys/arch/amd64/stand/efiboot/efiboot.c index b4ff85762..4f219a4af 100644 --- a/sys/arch/amd64/stand/efiboot/efiboot.c +++ b/sys/arch/amd64/stand/efiboot/efiboot.c @@ -38,7 +38,7 @@ #include "efiboot.h" #include "run_i386.h" -#define KERN_LOADSPACE_SIZE (64 * 1024 * 1024) +#define KERN_LOADSPACE_SIZE (128 * 1024 * 1024) EFI_SYSTEM_TABLE *ST; EFI_BOOT_SERVICES *BS; @@ -301,7 +301,7 @@ efi_memprobe(void) bios_memmap_t *bm; EFI_STATUS status; EFI_PHYSICAL_ADDRESS - addr = 0x10000000ULL; /* Below 256MB */ + addr = 0x20000000ULL; /* Below 512MB */ int error; status = BS->AllocatePages(AllocateMaxAddress, EfiLoaderData, diff --git a/sys/arch/amd64/stand/efiboot/exec_i386.c b/sys/arch/amd64/stand/efiboot/exec_i386.c index 7b1e26351..1e28a48b0 100644 --- a/sys/arch/amd64/stand/efiboot/exec_i386.c +++ b/sys/arch/amd64/stand/efiboot/exec_i386.c @@ -121,8 +121,7 @@ run_loadfile(uint64_t *marks, int howto) sr_clear_keys(); #endif - entry = marks[MARK_ENTRY] & 0x0fffffff; - entry += delta; + entry = (marks[MARK_ENTRY] + delta) & 0x0fffffff; printf("entry point at 0x%lx\n", entry); -- 2.39.5