rust-raspberrypi-OS-tutorials/0F_executionlevel
2018-01-13 21:31:34 +01:00
..
gpio.h Fixed typos and more tutorials 2018-01-06 16:49:26 +01:00
kernel8.img Fixed issue #2 2018-01-13 21:31:34 +01:00
link.ld Fixed typos and more tutorials 2018-01-06 16:49:26 +01:00
main.c Fixed typos and more tutorials 2018-01-06 16:49:26 +01:00
Makefile Fixed typos and more tutorials 2018-01-06 16:49:26 +01:00
mbox.c Fixed typos and more tutorials 2018-01-06 16:49:26 +01:00
mbox.h Fixed typos and more tutorials 2018-01-06 16:49:26 +01:00
OLVASSEL.md Fixed typos and more tutorials 2018-01-13 13:39:38 +01:00
README.md Fixed typos and more tutorials 2018-01-06 16:49:26 +01:00
start.S Fixed typos and more tutorials 2018-01-06 16:49:26 +01:00
uart.c Fixed issue #2 2018-01-13 21:31:34 +01:00
uart.h Fixed typos and more tutorials 2018-01-06 16:49:26 +01:00

Tutorial 0F - Execution levels

Before we can go on to virtual memory, we have to talk about execution levels. Each level has it's own memory translation tables, therefore it's cruital to know which one we are using. So in this tutorial we're make sure of it, we are at supervisor level, EL1. Qemu may start machine at EL1, but real Raspberry Pi hardware always boots at hypervisor level, EL2. Under qemu use "-d int" to debug the level change.

$ qemu-system-aarch64 -M raspi3 -kernel kernel8.img -serial stdio -d int
Exception return from AArch64 EL2 to AArch64 EL1 PC 0x8004c
Current EL is: 00000001

Start

I've added a little bit more Assembly code for changing the execution level if we're not at supervisor level. But before we can do that, we have to grant access for the counter registers (used by wait_msec()). Finally, we fake an exception return to change the level for real.

Main

We query the current execution level and then we display it on the serial console.