Skip to content
Advertisement

ARM: Disabling MMU and updating PC

In short, I would like to shut down all MMU (and cache) operations in a Linux context (from inside the Kernel), for debug purposes, just to run some tests. To be perfectly clear, I don’t intend that my system still be functional after that.

About my setup: I’m currently fiddling with a Freescale Vybrid (VF610) – which integrates a Cortex A5 – and its low power modes. Since I’m experimenting some suspiciously local memory corruption while the chip is in “Low Power Stop” mode and my DDR3 in self refresh, I’m trying to shift the operations bit by bit, and right now performing all the suspend/resume steps without actually executing the WFI. Since before this instruction I run with address translation, and after that without (it’s essentially a reset), I would like to “simulate” that by “manually” shutting down the MMU.

(I currently have no JTAG nor any other debug access to my chip. I load it via MMC/TFTP/NFS, and debug it with LEDs.)

What I’ve tried so far:

JavaScript

and other variations to the same effect.

What I observe:

Before the MMU block, I can light a LED (3 assembly instructions, no branch, nothing fancy, nor any access to my DDR, which is already in self refresh – the virtual address for the GPIO port is stored in a register before that).

After the MMU block, I can no more, whether I try with physical or virtual addresses.

I think the problem may be related to my PC, which retains an outdated virtual address. Seeing how things are done elsewhere in the kernel, but the other way round (that is, while enabling translation) :

JavaScript

(from arch/arm/kernel/sleep.S, cpu_resume_mmu)

I wonder to what this 2 instructions delay is related to, and where it is documented. I’ve found nothing on the subject. I’ve tried something equivalent, without success:

JavaScript

Thanks to anyone who has a clue or some pointers!

Advertisement

Answer

Since both Jacen and dwelch kindly brought the answer I needed through a comment (each), I will answer my own question here for the sake of clarity:

The trick was simply to add an identity mapping from/to the page doing the transition, allowing us to jump to it with a “physical” (though actually virtual) PC, then disable MMU.

Here is the final code (a bit specific, but commented):

JavaScript
Advertisement