Jason Xu 9c5c2813a0 Update QEMU command in all README and Makefile před 2 roky
..
Makefile 426205e2a3 Added makefiles for LLVM Clang před 5 roky
Makefile.clang 9c5c2813a0 Update QEMU command in all README and Makefile před 2 roky
Makefile.gcc 9c5c2813a0 Update QEMU command in all README and Makefile před 2 roky
OLVASSEL.md 9c5c2813a0 Update QEMU command in all README and Makefile před 2 roky
README.md 9c5c2813a0 Update QEMU command in all README and Makefile před 2 roky
gpio.h ed7cb505f9 Fixed typos and more tutorials před 7 roky
kernel8.img 8ce0f75b47 Recompiled with latest gcc před 4 roky
link.ld ed7cb505f9 Fixed typos and more tutorials před 7 roky
main.c fab78ec257 Fixed Clang compatibility issue před 6 roky
mbox.c 214885df63 compute the mailbox cmd only once před 6 roky
mbox.h ed7cb505f9 Fixed typos and more tutorials před 7 roky
start.S ea4691947c Improve comments wrt stack setup před 3 roky
uart.c 8a80ab88b9 Clearified mbox call in uart per issue #49 před 6 roky
uart.h ed7cb505f9 Fixed typos and more tutorials před 7 roky

README.md

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 normally boots at hypervisor level, EL2. Under qemu use "-d int" to debug the level change.

$ qemu-system-aarch64 -M raspi3b -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()), and tell the CPU we want AArch64 mode in EL1. Finally, we fake an exception return to change the level for real.

NOTE: For completeness, I've added code for EL3 too because of Issue #6, although normally Raspberry runs kernel8.img in EL2. With some config.txt options, you can make it run in EL3 (thanks @btauro for the info).

Main

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