ARM汇编指令基础

1、ARM和THUMB指令

ARM和THUMB指令的区别

2、ARM运行模式

通过不同的中断来进入不同的模式

用户模式User (usr) Mode is the normal execution state and cannot change the Operating Mode, except via theSWI instruction that switches Supervisor Mode.
快速中断模式Fast Interrupt (fiq) Mode used to handle the highest interrupt source (typical just one).
中断模式Interrupt (irq) Mode used for general-purpose interrupt handling.
 管理模式Supervisor (svc) Mode for system start-up, invoked after CPU Reset.
异常模式Abort (abt) Mode entered after a data or pre-fetch abort ( used for operating system abort handler).
未定义模式Undefined (und) Mode entered on execution of a undefined instruction. May be used to emulate coprocessor functions.
系统模式System (sys) Mode for privileged operating system functions, invoked by User Mode using theSWI instruction.
3、异常\中断向量表

CPU发生异常或者中断时,查找向量表进行指令跳转

4、程序状态寄存器PSR

 The N, Z, C, and V 分别是Negative(为负), Zero(为零), Carry(进位/借位) and oVerflow(溢出)的英文缩写。

C位和V位的区别是,C位是无符号运算时候导致的,V位是有符号运算导致的。【注,参考ARM V5架构手册 Program Status Register章节】

The N, Z, C, and V (Negative, Zero, Carry and oVerflow) bits are collectively known as the condition code 
flags, often referred to as flags. 


5、数据类型

  • 双字(64bit)double word (64-bit) are accessed via the instructions LDRD and STRD.
  •     字(32bit)word (32-bit) are accessed via the instructions LDRD and STRD
  • 半字(16bit)halfword (16-bit) the instructions LDRH,LDRSH, and STRH.
  • 字节(8bit)byte (8-bit) are accessed via the instructions LDRB, LDRSB, and STRB.
6、ARM指令的条件码

{cond} SuffixTested Status FlagsDescription
EQZ setequal
NEZ clearnot equal
CS/HSC setunsigned higher or same
CC/LOC clearunsigned lower
MIN setnegative
PLN clearpositive or zero
VSV setoverflow
VCV clearno overflow
HIC set and Z clearunsigned higher
LSC clear or Z setunsigned lower or same
GEN equals Vsigned greater or equal
LTN not equal to Vsigned less than
GTZ clear AND (N equals V)signed greater than
LEZ set OR (N not equal to V)signed less than or equal
AL(ignored)always (usually omitted)

EQ Equal   等于

NE Not Equal不等于


GT Greater Than大于

GE Graeter or Equal大于或等于

LT Less   Than小于

LE Less or Equal小于或等于


VS V Set  V位置位

VC V Clear  V位清零


MI N Set  N位置位

PL N Clear  N位清零



     CMP    R5,#10   // compare R5 with 10
     BHI    lab1     // branch to lab1 if value in R5 is higher than 10
      :
lab1:
     TST    R5,#10   // test content of R5 against 10
     ADDEQ  R6,#40   // add 40 to R6 if R5 contains 10

7、5种移位指令

LSR Logical Shift Right

 LSL Logical Shift Left

ASR  Arithmetic Shift Right

ROR Rotate Right

RRX Rotate Right Extend

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值