aboutsummaryrefslogtreecommitdiff
path: root/kernel.c
diff options
context:
space:
mode:
authorWojtek Kosior <kwojtus@protonmail.com>2019-11-11 14:40:08 +0100
committerWojtek Kosior <kwojtus@protonmail.com>2019-11-11 14:40:08 +0100
commitd8f1f7bcd7faa25410cfc57035a94f9fabd7d562 (patch)
treefb4e48c0ab9fa56cdcefdc567663e913e793e291 /kernel.c
parentc0ef6a1b3b873fa9a904e110eb5d558a0d9b4891 (diff)
downloadrpi-MMU-example-d8f1f7bcd7faa25410cfc57035a94f9fabd7d562.tar.gz
rpi-MMU-example-d8f1f7bcd7faa25410cfc57035a94f9fabd7d562.zip
describe CPSR using a struct with bitfields
Diffstat (limited to 'kernel.c')
-rw-r--r--kernel.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/kernel.c b/kernel.c
index 40b8a01..7a10b24 100644
--- a/kernel.c
+++ b/kernel.c
@@ -1,6 +1,6 @@
#include "uart.h"
-#include "psr.h"
#include "strings.h"
+#include "psr.h"
#include "translation_table_descriptors.h"
#include "cp_regs.h"
@@ -43,14 +43,13 @@ void kernel_main(uint32_t r0, uint32_t r1, uint32_t atags)
uart_puts(paging);
- uint32_t CPSR;
// get content of current program status register to check the current
// processor mode
- asm("mrs %0, cpsr" : "=r" (CPSR) :: "memory");
-
+ PSR_t CPSR = read_CPSR();
+
char *mode_name;
- switch(read_processor_mode())
+ switch(CPSR.fields.PSR_MODE_4_0)
{
case MODE_USER : mode_name = "User (PL0)\r\n"; break;
case MODE_FIQ : mode_name = "FIQ (PL1)\r\n"; break;