1.02.1 ARM assembly instruction set

mov r1, r0; @Data transfer between two registers
mov r1, # 0xff @Assign immediate value to register

The usage of mvn is the same as that of mov, the difference is that mov is transmitted intact, and mvn is transmitted after bitwise inversion.
The meaning of bitwise inversion: for
example: r1 = 0x000000ff, then after mov r0, r1, r0 = 0xff but my mvn r0, after r1, r0 = 0xffffff00

Commonly used ARM instruction 2: cpsr access instruction
Commonly used mrs & msr
mrs is used to read psr, msr is used to write psr
CPSR register is special, and requires special instruction access, this is mrs and msr.
The difference and connection between cpsr and spsr:
cpsr is the program status register, there is only 1 in the entire SOC; and spsr has 5, respectively in 5 abnormal modes, the role is to enter the abnormal mode from the normal mode, used to save Cpsr in normal mode to restore the original cpsr when returning to normal mode.
Commonly used ARM instruction 3: Jump (branch) instruction
b & bl & bx
b Direct jump (no plan to return, often used for absolute jump)
bl branch and link, put the return address into lr before the jump to return , So that it can be used to
jump to ARM mode at the same time as the function call bx jump, which is generally used for jumps in exception handling.
Common ARM instructions 4: memory access instructions
ldr / str & ldm / stm & swp

Single word / halfword / byte access ldr / str
multi-word bulk access ldm / stm
swp r1, r2, [r0]
swp r1, r1, [r0]

Coprocessor and coprocessor instructions

Coprocessor cp15 operation instructions
mcr & mrc

mrc is used to read the register
in CP15 mcr is used to write the register in CP15

Commonly used gnu directives.
Global _start @ gives _start the external link attribute
. Section .text @ specifies the current section as a code section.
Ascii .byte .short .long .word
.quad .float .string @ definition data.align
4 @ 16 Byte alignment.
Balignl 16 0xabcdefgh @ 16 byte alignment padding.
Equ @ is similar to the macro definition in C.
end @ identifies the end of the
file. Include @ header file contains
.arm / .code32 @ declares the following as an arm instruction.thumb
/ .code16 @Declares the following as a thubm instruction

ldr Large range of address load instructions
adr Small range of address load instructions
adrl Medium range of address load instructions
nop No operation

There is an ldr instruction in ARM, and there is also an ldr pseudo-instruction that
generally uses the ldr pseudo-instruction instead of the ldr instruction

Guess you like

Origin blog.51cto.com/14762640/2487323