aboutsummaryrefslogtreecommitdiff
path: root/kernel/exceptions/irq.S
diff options
context:
space:
mode:
authorChristian Cunningham <cc@localhost>2022-03-24 09:38:08 -0700
committerChristian Cunningham <cc@localhost>2022-03-24 09:38:08 -0700
commit93bf62580a68533dc8252b9a2a055c02f34ecb67 (patch)
tree1b1ca92ebbe107a998136a1442c0dba5be885e13 /kernel/exceptions/irq.S
parent3e64dda5d5c350cc325650133f7e64967f1efe84 (diff)
Modularized
Diffstat (limited to 'kernel/exceptions/irq.S')
-rw-r--r--kernel/exceptions/irq.S28
1 files changed, 28 insertions, 0 deletions
diff --git a/kernel/exceptions/irq.S b/kernel/exceptions/irq.S
new file mode 100644
index 0000000..a7e78bc
--- /dev/null
+++ b/kernel/exceptions/irq.S
@@ -0,0 +1,28 @@
+.section ".text.exceptions"
+.globl irq
+irq:
+ cpsid ai
+ stmfd sp!, {r0-r12,lr}
+ // Run IRQ handler
+ bl c_irq_handler
+ cmp r0, #1
+ bne 1f
+ // Schedule if interrupted a thread
+ mrs r1, spsr
+ and r1, r1, #0x1f
+ cmp r1, #0x10
+ bne 1f
+ ldmfd sp!, {r0-r12,lr}
+ // Don't skip missed instruction upon return
+ sub lr, #4
+ push {r3}
+ // Store the instruction in a special area for
+ // future processing
+ ldr r3, =irqlr
+ str lr, [r3, #0]
+ pop {r3}
+ cps #0x13
+ b schedule
+1:
+ ldmfd sp!, {r0-r12,lr}
+ subs pc, lr, #4