boot/efi: fix alignment exception on arm
Change-Id: I8384433c4bed474c3cb82bc8451ecde9a47bcff8 Reviewed-on: https://review.haiku-os.org/c/haiku/+/4656 Tested-by: Commit checker robot <[email protected]> Reviewed-by: Fredrik Holmqvist <[email protected]> Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
committed by
Adrien Destugues
parent
c8e72ef924
commit
9aba9395e7
@@ -4,6 +4,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#include <kernel.h>
|
||||
#include <boot/platform.h>
|
||||
#include <boot/stage2.h>
|
||||
#include <boot/stdio.h>
|
||||
@@ -11,6 +12,9 @@
|
||||
#include "efi_platform.h"
|
||||
|
||||
|
||||
#define ALIGN_MEMORY_MAP 4
|
||||
|
||||
|
||||
extern "C" void arch_enter_kernel(uint32_t ttbr, struct kernel_args *kernelArgs,
|
||||
addr_t kernelEntry, addr_t kernelStackTop);
|
||||
|
||||
@@ -85,7 +89,12 @@ arch_start_kernel(addr_t kernelEntry)
|
||||
// between calls to ExitBootServices.
|
||||
size_t actual_memory_map_size = memory_map_size * 2;
|
||||
memory_map
|
||||
= (efi_memory_descriptor *)kernel_args_malloc(actual_memory_map_size);
|
||||
= (efi_memory_descriptor *)kernel_args_malloc(actual_memory_map_size +
|
||||
ALIGN_MEMORY_MAP);
|
||||
|
||||
// align memory_map to 4-byte boundary
|
||||
// otherwise we get alignment exception when calling GetMemoryMap below
|
||||
memory_map = (efi_memory_descriptor *)ROUNDUP((uint32_t)memory_map, ALIGN_MEMORY_MAP);
|
||||
|
||||
if (memory_map == NULL)
|
||||
panic("Unable to allocate memory map.");
|
||||
|
||||
Reference in New Issue
Block a user