From cb07f5b377c36af372f38fb2de14753921ca660d Mon Sep 17 00:00:00 2001 From: Olivier Houchard Date: Thu, 29 May 2014 16:54:15 +0000 Subject: [PATCH] For old CPUs, map the 64 first MB of RAM as it used to be. Some ports (XScale mainly) expects the memory located before the kernel to be mapped, and use it to allocate the page tables, the various stacks, etc. A better fix would probably be to rewrite the various bla_machdep.c to stop using that RAM, but I'm not so inclined to do it, especially since I don't have hardware for all of them. --- sys/arm/arm/locore.S | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/sys/arm/arm/locore.S b/sys/arm/arm/locore.S index 71547a8581f1..1376e88a928c 100644 --- a/sys/arm/arm/locore.S +++ b/sys/arm/arm/locore.S @@ -166,9 +166,32 @@ Lunmapped: ldr r1, [r0, #4] sub r0, r1, r2 +#ifndef _ARM_ARCH_6 + /* + * Some of the older ports (the various XScale, mostly) assume + * that the memory before the kernel is mapped, and use it for + * the various stacks, page tables, etc. For those CPUs, map the + * 64 first MB of RAM, as it used to be. + */ /* * Map PA == VA - */ + */ + ldr r5, =PHYSADDR + mov r1, r5 + mov r2, r5 + /* Map 64MiB, preserved over calls to build_pagetables */ + mov r3, #64 + bl build_pagetables + + /* Create the kernel map to jump to */ + mov r1, r5 + ldr r2, =(KERNBASE) + bl build_pagetables + ldr r5, =(KERNPHYSADDR) +#else + /* + * Map PA == VA + */ /* Find the start kernels load address */ adr r5, _start ldr r2, =(L1_S_OFFSET) @@ -183,6 +206,7 @@ Lunmapped: mov r1, r5 ldr r2, =(KERNVIRTADDR) bl build_pagetables +#endif #if defined(SOCDEV_PA) && defined(SOCDEV_VA) /* Create the custom map */