1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
.section ".interrupt_vectors.text"
.global abort_handler
.local generic_handler
.global _interrupt_vectors
_interrupt_vectors:
ldr pc,reset_handler
ldr pc,undefined_handler
ldr pc,swi_handler
ldr pc,prefetch_handler
ldr pc,data_handler
ldr pc,unused_handler
ldr pc,irq_handler_caller
ldr pc,fiq_handler
reset_handler: .word abort
undefined_handler: .word abort
swi_handler: .word abort
prefetch_handler: .word abort
data_handler: .word abort
unused_handler: .word abort
irq_handler_caller: .word irq
fiq_handler: .word abort
//b abort_handler_caller
//b abort_handler_caller
//b abort_handler_caller
//b abort_handler_caller
//b abort_handler_caller
//b abort_handler_caller
//b abort_handler_caller
.globl enable_irq
enable_irq:
mrs r0,cpsr
bic r0,r0,#0x80
msr cpsr_c,r0
bx lr
b reset_handler_caller
b undef_handler_caller
b svc_handler_caller
b abort_handler_caller
b abort_handler_caller
b generic_handler_caller
b irq_handler_caller
b fiq_handler_caller
reset_handler_caller:
ldr sp, =_supervisor_stack_top
ldr r5, =reset_handler
bx r5
undef_handler_caller:
ldr sp, =_supervisor_stack_top
ldr r5, =undefined_instruction_vector
bx r5
svc_handler_caller:
ldr sp, =_supervisor_stack_top
push {r5, lr}
ldr r5, =supervisor_call_handler
blx r5
ldm sp!, {r5, pc} ^
abort_handler_caller:
ldr sp, =_supervisor_stack_top
ldr r5, =abort_handler
bx r5
generic_handler_caller:
ldr sp, =_supervisor_stack_top
ldr r5, =generic_handler
bx r5
irq_handler_caller:
ldr sp, =_irq_stack_top
sub lr, #4
push {r0-r3, lr}
ldr r3, =irq_handler
blx r3
ldm sp!, {r0-r3, pc} ^
fiq_handler_caller:
ldr sp, =_fiq_stack_top
ldr r5, =fiq_handler
bx r5
irq:
mov sp, #0x8000
ldr r5, =abort_handler
subs pc,lr,#4
|