diff options
author | vetch <vetch97@gmail.com> | 2019-12-17 16:44:13 +0100 |
---|---|---|
committer | vetch <vetch97@gmail.com> | 2019-12-17 16:44:13 +0100 |
commit | 9891df79dc55cbab3b542b9ee67ea50d8b82542f (patch) | |
tree | 3992c661050af92af509a0d9cd59731cc0c948ec /libkernel.c | |
parent | 15c7742381d7c63d8fb9d664eab56f3fed96f824 (diff) | |
parent | 37821a7d49e78132e7bdf12e04a9ed339588650c (diff) | |
download | rpi-MMU-example-9891df79dc55cbab3b542b9ee67ea50d8b82542f.tar.gz rpi-MMU-example-9891df79dc55cbab3b542b9ee67ea50d8b82542f.zip |
Merge branch 'bob' of https://repo.or.cz/RPi-MMU-example into alice
Diffstat (limited to 'libkernel.c')
-rw-r--r-- | libkernel.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libkernel.c b/libkernel.c new file mode 100644 index 0000000..0955e0e --- /dev/null +++ b/libkernel.c @@ -0,0 +1,12 @@ +// This is the privileged code, that gets placed somewhere in +// unprivileged process' address space. It's compiled as relocatable, +// so it can be loaded at different address for different processes. + +void call_unprivileged(void (*address) (void)) { + // switch to PL0 + asm("cps #0b10000\n\r" + "isb" ::: "memory"); + + // jump to that unprivileged code + address(); +} |