This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

ARM64 - Simple EL2 MMU Configuration

I am doing an MMU experiment with Raspberry Pi 3B (Quad core Cortex A53) board. The board starts in EL2. From EL2, the stage-2 MMU is configured. It is configured to have a one-to-one mapping (that is Intermediate Physical Address and Physical Address are same). The code in EL2 is continuing to execute after the MMU is enabled (HCR_EL2.VM=1). But when the code switches to EL1 (After ERET instruction), the memory contains random data. If I inspect the memory before ERET, using a debugger, it contains valid code. May I know the reason for this?

The page table configuration uses 64KB granule. The Level-2 table entries points to 512MB blocks. For reference, the important steps of my configuration is given below. Any hint is greatly appreciated.

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
ldr x1, =tt_s2_l1_base
msr vttbr_el2, x1
movz x0, 0x755c
movk x0, 0x0001, lsl 16 //64KB granule, 512MB block
msr vtcr_el2, x0
ldr x1, =tt_s2_l1_base // Address of L1 table
movz x0,0x0000
orr x0, x0, 0x01
orr x0, x0, 0xc0
orr x0, x0, 0x400
orr x0, x0, 0x300
str x0, [x1] //first page table entry configuration
dsb SY
msr sctlr_el1, xzr
isb
tlbi VMALLE1
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

0