ldmfd sp!,{r4-r8,pc}^
.text
@.global _start
_start:
b reset @0x00
ldr pc, _Undefined_Instruction @0x04
ldr pc, _Software_Interrupt @0x08
ldr pc, _Prefetch_Abort @0x0C
ldr pc, _Data_Abort @0x10
ldr pc, _Rserved @0x14
ldr pc, _IRQ @0x18
ldr pc, _FIQ @0x1C
_Undefined_Instruction:
.long Undefined_Instruction
_Software_Interrupt:
.long Software_Interrupt
_Prefetch_Abort:
.long Prefetch_Abort
_Data_Abort:
.long Data_Abort
_Rserved:
.long Rserved
_IRQ:
.long IRQ
_FIQ:
.long FIQ
reset:
mrs r5, CPSR
ldr r6,=0xFFFFFFE0
and r5,r6
orr r5,#0x10
msr CPSR, r5
mov r0, #0x0C
mov r1, #0x0C
mov r2, #0x0C
mov r3, #0x0C
mov r4, #0x0C
mov r5, #0x0C
mov r6, #0x0C
mov r7, #0x0C
mov r8, #0x0C
mov r9, #0x0C
mov r10, #0x0C
mov r11, #0x0C
swi #0x06
mov r3, #0x0c
Undefined_Instruction:
mov r1,#2
Software_Interrupt:
ldr sp,=stack_base
stmfd sp!,{r0-r7,r9-r12,lr}
mov r0,lr
sub r0,#4
ldr r1,[r0]
bic r1,#0xFF000000
cmp r1,#6
bleq do_swi
ldmfd sp!,{r0-r7,r9-r12,pc}^
do_swi:
mov r0, #0x3
mov r1, #0x4
mov r2, #0x5
mov r3, #0x6
mov r8, #0x0
add r8, r0
add r8, r1
add r8, r2
add r8, r3
mov pc, lr
Prefetch_Abort:
mov r3,#4
Data_Abort:
mov r4,#5
Rserved:
mov r5,#6
IRQ:
mov r6,#7
FIQ:
mov r7,#8
.data
stack_end:
.space 200
stack_base:
.end
结果展示: