From fd083a492d04db8a68a87d8ed04320287dfaafa3 Mon Sep 17 00:00:00 2001 From: Stanislav Sedov Date: Wed, 25 Apr 2012 22:44:07 +0000 Subject: [PATCH] - Disable MMU before reconfiguring the pagetables in the trampoline code. Otherwise we might end up overwriting the PTEs we're currently using for some reason. Reviewed by: cognet --- sys/arm/arm/elf_trampoline.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sys/arm/arm/elf_trampoline.c b/sys/arm/arm/elf_trampoline.c index 945f653ad832..403c012e49b3 100644 --- a/sys/arm/arm/elf_trampoline.c +++ b/sys/arm/arm/elf_trampoline.c @@ -614,6 +614,17 @@ __start(void) (unsigned int)&func_end + 800 , 0); if (altdst > dst) dst = altdst; + + /* + * Disable MMU. Otherwise, setup_pagetables call below + * might overwrite the L1 table we are currently using. + */ + cpu_idcache_wbinv_all(); + cpu_l2cache_wbinv_all(); + __asm __volatile("mrc p15, 0, %0, c1, c0, 0\n" + "bic %0, %0, #1\n" /* MMU_DISABLE */ + "mcr p15, 0, %0, c1, c0, 0\n" + :"=r" (pt_addr)); } else #endif dst = 4 + load_kernel((unsigned int)&kernel_start,