diff --git a/src/dbg.s b/src/dbg.s index 52ef9ac..759fd3d 100644 --- a/src/dbg.s +++ b/src/dbg.s @@ -5,13 +5,13 @@ printk: push {lr} - /* disables IRQ and FIR in CPU */ + /* disables IRQ and FIQ in CPU */ cpsid if /* C-Implementation */ bl c_printk - /* enables IRQ and FIR in CPU */ + /* enables IRQ and FIQ in CPU */ cpsie if pop {pc} diff --git a/src/kernel.cpp b/src/kernel.cpp index 0ec1484..daf416f 100644 --- a/src/kernel.cpp +++ b/src/kernel.cpp @@ -21,9 +21,7 @@ extern "C" int main(int argc, char** argv) { printkl("Now firing software interrupt..."); fireswi(); - printkl("EOK -- End of Kernel"); - printkl("Now waiting for Godot in an endless loop"); - while(true); + printkl("EOK -- End of Kernel -- Now returning to assembly"); return 0; } diff --git a/src/kernel.s b/src/kernel.s index 17f93bb..d056fba 100644 --- a/src/kernel.s +++ b/src/kernel.s @@ -1,3 +1,7 @@ +.data +godot_msg: +.string "Waiting for Godot" + .text .align 4 @@ -27,5 +31,9 @@ _start: /* C-Main */ bl main + ldr r0, =godot_msg + bl printkl + /* Endless busy loop */ b . + diff --git a/src/vectab.s b/src/vectab.s index 8d56744..59a42ab 100644 --- a/src/vectab.s +++ b/src/vectab.s @@ -1,26 +1,80 @@ .data -swimsg: -.string "Hello. I am the sample SWI handler! =)\0" +und_msg: +.string "Undefined Instruction" +swi_msg: +.string "Hello. I am the sample SWI handler! =)" +prefetch_abt_msg: +.string "Prefetch Abort" +data_abt_msg: +.string "Data Abort" +irq_msg: +.string "IRQ" +fiq_msg: +.string "FIQ" .text .align 4 .global vectab vectab: b _start + ldr pc, =und_handler ldr pc, =swi_handler - ldr pc, =swi_handler - ldr pc, =swi_handler - ldr pc, =swi_handler - ldr pc, =swi_handler - ldr pc, =swi_handler - ldr pc, =swi_handler + ldr pc, =prefetch_abt_handler + ldr pc, =data_abt_handler + nop + ldr pc, =irq_handler + ldr pc, =fiq_handler + +// TODO: untested +und_handler: + stmfd sp!, {lr} + + ldr r0, =und_msg + bl printk + + ldmfd sp!, {pc}^ swi_handler: stmfd sp!, {lr} - ldr r0, =swimsg + ldr r0, =swi_msg bl printkl ldmfd sp!, {pc}^ +// TODO: untested +prefetch_abt_handler: + stmfd sp!, {lr} + + ldr r0, =prefetch_abt_msg + bl printkl + + ldmfd sp!, {pc}^ + +// TODO: untested +data_abt_handler: + stmfd sp!, {lr} + + ldr r0, =data_abt_msg + bl printkl + + ldmfd sp!, {pc}^ + +// TODO: untested +irq_handler: + stmfd sp!, {lr} + + ldr r0, =irq_msg + bl printkl + + ldmfd sp!, {pc}^ + +// TODO: untested +fiq_handler: + stmfd sp!, {lr} + + ldr r0, =fiq_msg + bl printkl + + ldmfd sp!, {pc}^