当前位置:网站首页>Arm assembly syntax
Arm assembly syntax
2022-06-23 01:47:00 【Chongyou research Sen】
This article is continuously updated ( Citing punctual atomic data !!!)
Catalog
1.1 Processor internal data transfer instructions
1.2 Memory access instructions
1.3 Stack pressing and out of stack instructions
1.6 Logical operation instructions
ARM Basic assembly syntax
1.1 Processor internal data transfer instructions

mov: Copy data from one register to another , Or pass an immediate value into a register
MOV R0, R1 @ Register R1 The number in is passed to R0 R0=R1
MOV R0, #0x12 @ Will count immediately 0x12 Pass to R0 R0=0x12MRS: Read special registers (CPSR and SPSR) The data in is passed to the general register
MRS R0, CPSR @ hold CPSR The data is passed to R0,R0=CPSRMSR: Pass the data from the ordinary register to the special register
MSR CPSR, R0 @ hold R0 The data is passed to CPSR,CPSR=R01.2 Memory access instructions

LDR: Load an immediate into a register , Or read the value of a register to another register
SR: Write data to a register
LDR R0, 0X0209C004 @ take 0X0209C004 The value of the address to R0
LDR R1, R2 @ take R2 The value in to R1
LDR R1, =0X123456789 @ take 0X123456789 This address is written to R1 in , That is to say, now R1=0x123456789
STR R0,[R1],#8 @ take R0 The word data in is written to R1 In memory for address , And put the new address R1+8 write in R1.
STR R0,[R1,#8] @ take R0 The word data in is written to R1+8 In memory for address .”
str r1, [r0] @ take r1 Register value , The value transmitted to the address is r0 Of ( Memory ) In the memory
matters needing attention : In the above code , for the first time LDR It's a 0X0209C004 The value of this position gives R0, third time LDR Is to write the address R1
【Rx】: Represents the address of this register
1.3 Stack pressing and out of stack instructions
Used to call each other between functions .

Pressing stack :PUSH,STMFD SP!
Out of the stack :POP,LDMFD SP!
PUSH{R0~R2,R12}
POP{R0~R2,R12}
STMFD SP!{R0~R2,R12}
LDMFD SP!{R0~R2,R12}1.4 Jump instruction

B: Used to jump out of a function and never come back
_start
ldr sp, =0x80200000
b mainBL: It is used to continue the process of the current function after the function is called
push {r0, r1} @ preservation r0,r1
cps #0x13 @ Get into SVC Pattern , Allow other interrupts to go in again
bl system_irqhandler @ load C Language interrupt handler to r2 In the register
cps #0x12 @ Get into IRQ Pattern
pop {r0, r1}
str r0, [r1, #0X10] @ Interrupt execution complete , Write EOIR1.5 Arithmetic instructions

1.6 Logical operation instructions

2 Other instructions
2.1 Coprocessor functions
MCR{cond} p15,<opc1>,<Rt>,<CRn>,<CRm>,<opc2> take ARM The data of the register is written to CP15 Coprocessor register .
MRC p15,0,r0,c0,c0,0 take CP15 The register data in the coprocessor reads ARM In the register .

2.2 Bit clearing and bit or function
bic r1, r0, #(0x1 << 11) hold (0x1 << 11) Reverse later , And then on r0, Write this value again r1
orr r0, r0, #0x12 r0 Or on the 0x13, Said the use of IRQ Pattern
2.3 Isolation
DSB
Data synchronization isolation . Only after all the memory access operations in front of it are completed , To execute the instructions that follow it ( That is, any instruction must wait for memory access Ask operation )
ISB
Command synchronization isolation . The strictest : It cleans the assembly line , To ensure that after all the instructions in front of it have been executed , To execute the instructions that follow it .
边栏推荐
- Why can't I access object properties in a for in loop in an object array
- Time complexity
- C#.NET万能数据库访问封装类(ACCESS、SQLServer、Oracle)
- C#. Net universal database access encapsulation classes (access, sqlserver, Oracle)
- 165. cat climbing
- Autumn move script C
- MySQL basic command statement
- Day260: the number III that appears only once
- "Initial C language" (Part 2)
- Is it safe for Hongyuan futures to open an account? Can Hongyuan futures company reduce the handling fee?
猜你喜欢

LeetCode 206. 反转链表(迭代+递归)

Xiaobai operates win10 to expand Disk C (allocate disk D memory to Disk C) and the test is valid for many times

Wallys/DR7915-wifi6-MT7915-MT7975-2T2R-support-OpenWRT-802.11AX-supporting-MiniPCIe

There are animation characters interacting with each other when the mouse slides in the web page

Classical questions of function recursion

Lexical Sign Sequence

SQL programming task03 job - more complex query

A hundred lines of code to realize reliable delay queue based on redis

7.new, delete, OOP, this pointer
![Found several packages [runtime, main] in ‘/usr/local/Cellar/go/1.18/libexec/src/runtime;](/img/75/d2ad171d49611a6578faf2d390af29.jpg)
Found several packages [runtime, main] in ‘/usr/local/Cellar/go/1.18/libexec/src/runtime;
随机推荐
"Initial C language" (Part 2)
ERROR { err: YAMLException: end of the stream or a document separator is expected at line 6, colum
Foundation Consolidation - Flex width is content width
Freshman C language summary post (hold change) Part 2 formatted monthly calendar
Classical questions of function recursion
4. functions and inline functions with default values for formal parameters
SQL programming task05 job -sql advanced processing
You can also do NLP (classification)
C. Number of Pairs-Codeforces Round #725 (Div. 3)
LeetCode 206. 反转链表(迭代+递归)
崔鹏团队:万字长文梳理「稳定学习」全景图
Char[], char *, conversion between strings
人民币的单位的大写
Up the Strip
Function part
Cmake simple usage
Wallys/DR7915-wifi6-MT7915-MT7975-2T2R-support-OpenWRT-802.11AX-supporting-MiniPCIe
Autumn move script a
Centos7 installing postgresql12
Day260: the number III that appears only once