Added other (untested) interrupts

This commit is contained in:
giomba 2018-12-30 23:07:00 +01:00
parent b431e382e8
commit b18437ba51
4 changed files with 74 additions and 14 deletions

View File

@ -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}

View File

@ -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;
}

View File

@ -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 .

View File

@ -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}^