summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Wildt <patrick@cvs.openbsd.org>2017-02-03 08:48:41 +0000
committerPatrick Wildt <patrick@cvs.openbsd.org>2017-02-03 08:48:41 +0000
commit27920229c3df030470f23f0700562e3431f79f8f (patch)
tree84fe372d39c9848968e206dbdd4a2026ea419499
parent79d6582906e9f255bb3e3b013b1db652bde7e4d1 (diff)
Explicitly ask EFI to allocate the page we picked out to lay our
kernel in, and not just use some memory address that we found in the table.
-rw-r--r--sys/arch/arm64/stand/efiboot/efiboot.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/arch/arm64/stand/efiboot/efiboot.c b/sys/arch/arm64/stand/efiboot/efiboot.c
index 609b9218201..a9e7ea38d0b 100644
--- a/sys/arch/arm64/stand/efiboot/efiboot.c
+++ b/sys/arch/arm64/stand/efiboot/efiboot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: efiboot.c,v 1.2 2017/01/22 04:18:52 kettenis Exp $ */
+/* $OpenBSD: efiboot.c,v 1.3 2017/02/03 08:48:40 patrick Exp $ */
/*
* Copyright (c) 2015 YASUOKA Masahiko <yasuoka@yasuoka.net>
@@ -515,7 +515,11 @@ efi_memprobe_find(UINTN pages, UINTN align, EFI_PHYSICAL_ADDRESS *addr)
break;
paddr = mm->PhysicalStart + (j * EFI_PAGE_SIZE);
- if (!(paddr & (align - 1))) {
+ if (paddr & (align - 1))
+ continue;
+
+ if (EFI_CALL(BS->AllocatePages, AllocateAddress,
+ EfiLoaderData, pages, &paddr) == EFI_SUCCESS) {
*addr = paddr;
free(mm0, siz);
return EFI_SUCCESS;