On Fri, Dec 20, 2019 at 10:33:02PM -0700, Bobby Johnson wrote: > I've tried to see if I could change the entry point by altering delta > in sys/arch/amd64/stand/efiboot/exec_i386.c. But even with a small > change my test vm won't boot with it.
For changing the entry point, you have to fix the delta calculation in the boot loader. Then you can alter the kernel base in the linker script. Note that you have to remove the ld.script in obj to get the new one installed. bluhm Index: arch/amd64/conf/ld.script =================================================================== RCS file: /data/mirror/openbsd/cvs/src/sys/arch/amd64/conf/ld.script,v retrieving revision 1.15 diff -u -p -r1.15 ld.script --- arch/amd64/conf/ld.script 9 Nov 2019 20:07:00 -0000 1.15 +++ arch/amd64/conf/ld.script 21 Dec 2019 11:37:56 -0000 @@ -38,8 +38,8 @@ PHDRS */ __ALIGN_SIZE = 0x1000; __kernel_base = 0xffffffff80000000; -__kernel_virt_base = __kernel_base + 0x1000000; -__kernel_phys_base = 0x1000000; +__kernel_virt_base = __kernel_base + 0x2000000; +__kernel_phys_base = 0x2000000; __kernel_base_phys = __kernel_phys_base + SIZEOF_HEADERS; __kernel_virt_to_phys = __kernel_phys_base - __kernel_virt_base; Index: arch/amd64/stand/efiboot/exec_i386.c =================================================================== RCS file: /data/mirror/openbsd/cvs/src/sys/arch/amd64/stand/efiboot/exec_i386.c,v retrieving revision 1.3 diff -u -p -r1.3 exec_i386.c --- arch/amd64/stand/efiboot/exec_i386.c 12 Dec 2019 13:09:35 -0000 1.3 +++ arch/amd64/stand/efiboot/exec_i386.c 21 Dec 2019 11:37:49 -0000 @@ -128,8 +128,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);