Revert "misc cleanup"
[rpi-open-firmware.git] / arm_chainloader / main.c
index cb76062..0962ea2 100644 (file)
@@ -16,6 +16,33 @@ static void heap_init() {
        init_memory_pool(hs, start_of_heap);
 }
 
+static const char* get_execution_mode_name() {
+       uint32_t cpsr = arm_get_cpsr() & ARM32_MODE_MASK;
+
+       switch (cpsr) {
+       case ARM32_USR:
+               return "User";
+       case ARM32_FIQ:
+               return "FIQ";
+       case ARM32_IRQ:
+               return "IRQ";
+       case ARM32_SVC:
+               return "Supervisor";
+       case ARM32_MON:
+               return "Secure Monitor";
+       case ARM32_ABT:
+               return "Abort";
+       case ARM32_UND:
+               return "Undefined Instruction";
+       case ARM32_HYP:
+               return "Hypervisor";
+       case ARM32_SYS:
+               return "System";
+       default:
+               return "Unknown Mode";
+       }
+}
+
 void main(bool security_supported) {
        /* wait for peripheral access */
        while(ARM_ID != ARM_IDVAL);
@@ -31,6 +58,8 @@ void main(bool security_supported) {
                logf("Security extensions are supported!\n");
        }
 
+       logf("Execution mode: %s\n", get_execution_mode_name());
+
        heap_init();
 
        /* c++ runtime */
This page took 0.029512 seconds and 4 git commands to generate.