清0:bic
置1:orr
访问cpsr和spdr要用到mrs和msr指令
mrs是把状态寄存器的值赋给通用寄存器
msr是把通用寄存器的值赋给状态寄存器
1 .text 2 .global _start 3 _start: 4 b reset 5 ldr pc, _undefined_instruction 6 ldr pc, _software_interrupt 7 ldr pc, _prefetch_abort 8 ldr pc, _data_abort 9 ldr pc, _not_used 10 ldr pc, _irq 11 ldr pc, _fiq 12 13 _undefined_instruction: .word undefined_instruction 14 _software_interrupt:.word software_interrupt 15 _prefetch_abort:.word prefetch_abort 16 _data_abort:.word data_abort 17 _not_used:.word not_used 18 _irq:.word irq 19 _fiq:.word fiq 20 21 undefined_instruction: 22 nop 23 24 software_interrupt: 25 nop 26 27 prefetch_abort: 28 nop 29 30 data_abort: 31 nop 32 33 not_used: 34 nop 35 36 irq: 37 nop 38 39 fiq: 40 nop 41 42 reset: 43 bl set_svc 44 45 set_svc: 46 mrs r0, cpsr 47 bic r0, r0, #0x1f 48 orr r0, r0, #0xd3 49 msr cpsr, r0
黄色部分就是设置处理器在svc模式
原文地址:https://www.cnblogs.com/sanshijvshi/p/8335116.html
时间: 2024-10-11 23:11:13