ARM指令条件码

ARM 209浏览
EQ (Equal Z set)
 NE (Not equal Z clear)
 CS/HS (Carry set/unsigned higher or same C set)
 CC/LO (Carry clear/unsigned lower C clear)
 MI (Minus/negative N set)
 PL (Plus/positive or zero N clear)
 VS (Overflow V set)
 VC (No overflow V clear)
 HI (Unsigned higher C set and Z clear)
 LS (Unsigned lower or same C clear or Z set)
 GE (Signed greater than or equal N set and V set, or N clear and V clear (N == V))
 LT (Signed less than N set and V clear, orN clear and V set (N != V))
 GT (Signed greater than Z clear, and either N set and V set, or N clear and V clear (Z == 0,N == V))
 LE (Signed less than or equal Z set, or N set and V clear, or
N clear and V set (Z == 1 or N != V))
 AL (Always (unconditional) )
括号外面的是条件,括号里的是解释说明。默认条件是AL(always).
eg, 执行MOVS,一定会影响N,Z,C标志
比如MOVS r0, #1,执行后r0=1
Z=!r0=0; 是否为0
N=r0>>31=0;符号位
C=!(r0 >= 0)=0;是否有进位

SPSR是进入内核态时,比如进入中断,对CPSR的备份(spsr=cpsr),退出内核态时,再恢复回来(cpsr=spsr)
MOVS总是会影响CPSR, 包括N,Z,C标志位
执行MOV pc, lr,可能会影响到T标志位,执行MOVS pc, lr时,CPSR会被SPSR覆盖(内核态)