diff options
author | Wojtek Kosior <kwojtus@protonmail.com> | 2019-12-28 23:25:05 +0100 |
---|---|---|
committer | Wojtek Kosior <kwojtus@protonmail.com> | 2019-12-28 23:25:05 +0100 |
commit | a910d10349593fce9f5f28f0de4f27ba85cd7df2 (patch) | |
tree | 3c682f3e6dafd1ec54a88e177447b766de56db7c /PL0_test.c | |
parent | 68478311d11406e9452ae7fc2cf6e7405fb9c4d6 (diff) | |
download | rpi-MMU-example-a910d10349593fce9f5f28f0de4f27ba85cd7df2.tar.gz rpi-MMU-example-a910d10349593fce9f5f28f0de4f27ba85cd7df2.zip |
enter and exit supervisor call (+ fixed jumping to PL0 for the first time - setting sp was broken there)
Diffstat (limited to 'PL0_test.c')
-rw-r--r-- | PL0_test.c | 15 |
1 files changed, 11 insertions, 4 deletions
@@ -1,18 +1,25 @@ #include "uart.h" #include "psr.h" +// entry point - must remain the only function in the file! void PL0_main(void) { - // if all went correct, Success! gets printed + // If all went correct, Success! gets printed uart_puts("Success!\n\r"); - // if we're indeed i PL0, we should crash now, when trying to access + uart_puts("calling supervisor\n\r"); + + asm volatile("svc #0"); + + uart_puts("back from supervisor call\n\r"); + + // if we're indeed in PL0, we should crash now, when trying to access // memory we're not allowed to char first_kernel_byte[2]; - first_kernel_byte[0] = *(char*) ((uint32_t) 0x8000); + first_kernel_byte[0] = *(char*) ((uint32_t) 0x0); first_kernel_byte[1] = '\0'; - + uart_puts(first_kernel_byte); while (1) |