On Tue, 22 Sep 2015 14:20:22 -0500 Brian Conway <[email protected]> wrote: >> Can you try the diff following or >> >> http://yasuoka.net/~yasuoka/BOOTX64.EFI >> >> ? Then enter "machine memory" on "boot> " prompt and check the last line. >> It shows whether the memory area for kernel is free or not. Like >> >> Load address: Conventional(7) 0xXXXX for xxxxKB >> >> is good sign. > > Great, thanks. I grabbed the binary.
Thanks, > machine memory: > > http://i.imgur.com/gtiAIxc.jpg This picture shows Load address: Loader Data (2) 0xd00000 for 4096KB FATAL This is what I want to know. 0xd00000 + 4M is overlapping the kernel area. I think the following diff or http://yasuoka.net/~yasuoka/BOOTX64.EFI (updated) will fix the problem. Index: sys/arch/amd64/stand/efiboot/Makefile.common =================================================================== RCS file: /disk/cvs/openbsd/src/sys/arch/amd64/stand/efiboot/Makefile.common,v retrieving revision 1.1 diff -u -p -u -p -r1.1 Makefile.common --- sys/arch/amd64/stand/efiboot/Makefile.common 2 Sep 2015 01:52:25 -0000 1.1 +++ sys/arch/amd64/stand/efiboot/Makefile.common 23 Sep 2015 02:45:52 -0000 @@ -7,6 +7,8 @@ EFIDIR= ${.CURDIR}/../../efi OBJCOPY?= objcopy OBJDUMP?= objdump +EFI_HEAP_LIMIT= 0xc00000 + LDFLAGS+= -nostdlib -T${.CURDIR}/../${LDSCRIPT} -Bsymbolic -shared COPTS+= -DEFIBOOT -DNEEDS_HEAP_H -DLINKADDR=${LINKADDR} -I${.CURDIR}/.. @@ -65,6 +67,7 @@ ${PROG}: ${PROG.so} .include <bsd.prog.mk> CFLAGS+= -Wno-pointer-sign CPPFLAGS+= -DSMALL -DSLOW -DNOBYFOUR -D__INTERNAL_LIBSA_CREAD +CPPFLAGS+= -DHEAP_LIMIT=${EFI_HEAP_LIMIT} ${PROG.so}: ${OBJS} ${LD} ${LDFLAGS} -o ${.TARGET}.tmp ${OBJS} ${LDADD} Index: sys/arch/amd64/stand/efiboot/efiboot.c =================================================================== RCS file: /disk/cvs/openbsd/src/sys/arch/amd64/stand/efiboot/efiboot.c,v retrieving revision 1.3 diff -u -p -u -p -r1.3 efiboot.c --- sys/arch/amd64/stand/efiboot/efiboot.c 3 Sep 2015 09:22:40 -0000 1.3 +++ sys/arch/amd64/stand/efiboot/efiboot.c 23 Sep 2015 02:45:53 -0000 @@ -42,7 +42,7 @@ EFI_RUNTIME_SERVICES *RS; EFI_HANDLE IH, efi_bootdp = NULL; EFI_PHYSICAL_ADDRESS heap; EFI_LOADED_IMAGE *loadedImage; -UINTN heapsiz = 3 * 1024 * 1024; +UINTN heapsiz = 1 * 1024 * 1024; UINTN mmap_key; static EFI_GUID imgdp_guid = { 0xbc62157e, 0x3e33, 0x4fec, { 0x99, 0x20, 0x2d, 0x3b, 0x36, 0xd7, 0x50, 0xdf }}; @@ -199,7 +199,7 @@ efi_heap_init(void) { EFI_STATUS status; - heap = 0x1000000; /* Below kernel base address */ + heap = HEAP_LIMIT; status = EFI_CALL(BS->AllocatePages, AllocateMaxAddress, EfiLoaderData, EFI_SIZE_TO_PAGES(heapsiz), &heap); if (status != EFI_SUCCESS)

