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: printk:
push {lr} push {lr}
/* disables IRQ and FIR in CPU */ /* disables IRQ and FIQ in CPU */
cpsid if cpsid if
/* C-Implementation */ /* C-Implementation */
bl c_printk bl c_printk
/* enables IRQ and FIR in CPU */ /* enables IRQ and FIQ in CPU */
cpsie if cpsie if
pop {pc} pop {pc}

View File

@ -21,9 +21,7 @@ extern "C" int main(int argc, char** argv) {
printkl("Now firing software interrupt..."); printkl("Now firing software interrupt...");
fireswi(); fireswi();
printkl("EOK -- End of Kernel"); printkl("EOK -- End of Kernel -- Now returning to assembly");
printkl("Now waiting for Godot in an endless loop");
while(true);
return 0; return 0;
} }

View File

@ -1,3 +1,7 @@
.data
godot_msg:
.string "Waiting for Godot"
.text .text
.align 4 .align 4
@ -27,5 +31,9 @@ _start:
/* C-Main */ /* C-Main */
bl main bl main
ldr r0, =godot_msg
bl printkl
/* Endless busy loop */ /* Endless busy loop */
b . b .

View File

@ -1,26 +1,80 @@
.data .data
swimsg: und_msg:
.string "Hello. I am the sample SWI handler! =)\0" .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 .text
.align 4 .align 4
.global vectab .global vectab
vectab: vectab:
b _start b _start
ldr pc, =und_handler
ldr pc, =swi_handler ldr pc, =swi_handler
ldr pc, =swi_handler ldr pc, =prefetch_abt_handler
ldr pc, =swi_handler ldr pc, =data_abt_handler
ldr pc, =swi_handler nop
ldr pc, =swi_handler ldr pc, =irq_handler
ldr pc, =swi_handler ldr pc, =fiq_handler
ldr pc, =swi_handler
// TODO: untested
und_handler:
stmfd sp!, {lr}
ldr r0, =und_msg
bl printk
ldmfd sp!, {pc}^
swi_handler: swi_handler:
stmfd sp!, {lr} stmfd sp!, {lr}
ldr r0, =swimsg ldr r0, =swi_msg
bl printkl bl printkl
ldmfd sp!, {pc}^ 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}^