In the kernel PL1 code, I want to switch to PL0 code. The PL0 code starts from 0x0000. Of courese it's a virtual address.
The related code is:
asm volatile
(
"msr cpsr_c, #0x10\n\t"
"mov r0, #0\n\t"
"mov pc, r0"
);
The code above works fine. But if I use SPSR to switch, an data-abort exception will be generated:
asm volatile
(
"msr spsr_c, #0x10\n\t"
"mov r0, #0\n\t"
"movs pc, r0"
);
The code above uses SPSR with mode switching. I can't find the reason why the exception is generated.
In my code, I am sure that the SPSR has not been accessed before.
------------------------
Solved, due to mmu config bug.