Hi Expert,
I am working on a simple kernel and test it on Qemu which supports RasPi3. During the boot level. Ras Pi goes to EL3 level, and I set spsr_el3 to 1 and elr_el3 to kernel_main and then use eret to enter EL1 mode. My problem is I create a kernel thread which still in EL1 level. I want to switch the kernel thread to user level. What I did is that this kernel thread also set spsr_el1 to 0 and elr_el1 to a function pointer, then eret. But this case a sync interrupt, I think caused by this eret? Please help her
Do you use the MMU?
If so, did you enable r/w/x for user mode?
Regarding sync exception: Don't guess. Try to get the error information (ESR_EL1 and ELR_EL1).
Hi, How to enable r/w/x for user mode.
ESR code is 92000050, and PC already point to the function which I assigned to.
Thanks very much :)
I wonder, how much ARM experience do you have? Because writing a kernel on ARMv8-A is not trivial. Cortex-R4 or Cortex-M3 is much much easier.
I only have x86 kernle experience. This is my first try on AARCH64. So this is what I want to do.
I'd suggest: Stay on EL1 until you are sure you understand MMU setup etc. And maybe add some tooling to help debug. Then try again switching to EL0.
View all questions in Cortex-A / A-Profile forum