Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Lesson02] exercises - Switching EL in qemu #207

Open
obstriker opened this issue Oct 5, 2020 · 2 comments
Open

[Lesson02] exercises - Switching EL in qemu #207

obstriker opened this issue Oct 5, 2020 · 2 comments

Comments

@obstriker
Copy link

obstriker commented Oct 5, 2020

Did anyone manage to switch Exception levels in qemu?
I know when booting in qemu its on EL2 but even running the example or other solutions (Switching from EL2 -> EL1) didn't print anything.
Previous exercises were printing to screen but this one not printing or not working for some reason.

@X-141
Copy link

X-141 commented Dec 27, 2020

bump, I haven't found clear leads. There have been some pointers to possibly modifying QEMU's startup, however I have been looking for a easier solution first before I get into the weeds with that.

Because we are in EL2, we do not have access to sys registers that more privileged exception level (EL3) have access to. From what I've found and read, the instruction "msr scr_el3, x0" causes a "prefetch abort" which will cause the system to hang-up. Commenting the instruction will allow the system to run, but of course we don't configure the Secure Config register.

@lucas-infi
Copy link

Found the solution in this StackOverflow post: https://stackoverflow.com/questions/71006360/qemu-system-aarch64-always-entering-exception-level-2-and-hangs-when-switching-t

In short,
If you use qemu with the '-kernel' switch it will start in "Linux loader" mode, meaning it will try to start in EL2 is possible. Instead of using the -kernel kernel8.img flag, use -device loader,file=./kernel8.img, this will start qemu in EL1 mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants