From 5d621118feb7a35ba417dfee63230732af2fa213 Mon Sep 17 00:00:00 2001 From: Olivier Houchard Date: Tue, 30 Aug 2016 23:30:26 +0000 Subject: [PATCH] Some old arm ports don't load the kernel at the beginning of the memory, because the bootloader, ie redboot, won't let them do so, and so used the memory before the kernel for early memory allocation, such as pagetables, stacks, etc... Make a bit of an effort to try to get that memory mapped. --- sys/arm/arm/locore-v4.S | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sys/arm/arm/locore-v4.S b/sys/arm/arm/locore-v4.S index bd39ae12b028..4d10fb3f0e7e 100644 --- a/sys/arm/arm/locore-v4.S +++ b/sys/arm/arm/locore-v4.S @@ -195,6 +195,16 @@ Lunmapped: ldr r2, =(KERNVIRTADDR) mov r3, #64 bl build_pagetables +#if defined(PHYSADDR) && (KERNVIRTADDR != KERNBASE) +/* + * If the kernel wasn't loaded at the beginning of the ram, map the memory + * before the kernel too, as some ports use that for pagetables, stack, etc... + */ + ldr r1, =PHYSADDR + ldr r2, =KERNBASE + ldr r3, =((KERNVIRTADDR - KERNBASE) / L1_S_SIZE) + bl build_pagetables +#endif /* Create a device mapping for early_printf if specified. */ #if defined(SOCDEV_PA) && defined(SOCDEV_VA)