mmu_enable before and after would effect?
I've been confisued by a MMU question 4 a long time.
First of all,let us see 2 points below:
1,cpu fatch the instuction by itself if no branch instuction called like "jump" and "b".The PC counter will be added automatically.
2,if the code tell the cpu to jump to a certain address by branch instruction, the pc-counter will be loaded by the address.
My questions are:
The code is from head.S FilePath:arch/arm/kernel/head.s
2 mov r0, r0
3 mcr p15, 0, r0, c1, c0, 0 @ enable mmu
4 mrc p15, 0, r3, c0, c0, 0 @ read id reg
5 mov r3, r3
6 mov r3, r13 @ load the address of __mmap_switched
7 mov pc, r3 @ jump to __mmap_switched
Suppose if the MMU Table was created to map the address from C0000000 to 50000000 as:
0xC0000000,0xC8000000 -> 0x50000000,0x58000000
If MMU enabled,after line 3 instuction,what would be loaded in the pc-counter?Shall we need to translate the address?
A,If the content of pc-counter was 0x30008000,and after line 3 4 code (Enable MMU),the pc-counter would be updateed by 0x50008004 or 0x30008004?For the reason there was no branch instruction called at line 4,so the pc-counter would be updated by cpu itself automatically.
B,If the __mmap_switched was arranged by the linker as a Cxxx xxxx,line 7 mov a address would be translated to a Virt Address?