From 21c6fe3075bf31da11e4d9a2f98eaf98a684664d Mon Sep 17 00:00:00 2001 From: Christian Cunningham Date: Sat, 5 Feb 2022 00:12:59 -0700 Subject: Fixed undefined handler --- src/exceptions/undefined.S | 3 +-- src/sys/kernel.S | 22 ++++++++-------------- 2 files changed, 9 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/exceptions/undefined.S b/src/exceptions/undefined.S index b8eab29..ef00735 100644 --- a/src/exceptions/undefined.S +++ b/src/exceptions/undefined.S @@ -17,8 +17,7 @@ undefined: ldr r2, =undefined_at bl draw_string // Output lr - mov r1, #0x1000 - ldr r0, [r1, #-4] + ldr r0, [sp, #0x34] sub r2, r0, #4 mov r0, #31 mov r1, #17 diff --git a/src/sys/kernel.S b/src/sys/kernel.S index 93074b6..119a00d 100644 --- a/src/sys/kernel.S +++ b/src/sys/kernel.S @@ -3,20 +3,14 @@ .globl kernel_main kernel_main: bl sysinit - // ///https://wiki.osdev.org/ARM_Paging - // // Query the ID_MMFR0 register - // mrc p15, 0, r0, c0, c1, 4 - // bl uart_hexn - // // Switch to user mode - // cps #0x10 - // // Intentional undefined instruction - // //.word 0xf7f0a000 - // // This will fail in user mode - // mrc p15, 3, r0, c15, c0, 0 - // // Supervisor Call #1 - Does nothing special - // svc #1 - // mrs r0, cpsr - // bl uart_hexn + ///https://wiki.osdev.org/ARM_Paging + // Query the ID_MMFR0 register + mrc p15, 0, r2, c0, c1, 4 + mov r0, #0 + mov r1, #7 + bl draw_hex32 + // Intentional undefined instruction + // .word 0xf7f0a000 cpsie aif, #0x10 svc #2 // Start scheduling! 1: -- cgit v1.2.1