ARM assembly instruction set 3

Publisher:WhisperingWindsLatest update time:2020-01-29 Source: eefocusKeywords:ARM Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Common ARM instructions 1: data processing instructions

    

•Data transfer instructions mov mvn

      mov r1, r0 @Data transfer between two registers

      mov r1, #0xff @Assign the immediate value to the register

mov and mvn are used in the same way, the difference is that mov is passed intact, while mvn is passed after bitwise inversion

 

•Arithmetic instructions add sub rsb adc sbc rsc 

     and logical AND

     orr logical OR

     eor logical exclusive or

 

•Logical instructions and orr eor bic

    bic bit cleared

    bic r0,r1,#0x1f @clear bits 0 to 4 of r1 and assign them to r0

 

•Comparison instructions cmp cmn tst teq (Comparison instructions focus on the process and not the result)

   cmp r0, r1 @ equivalent to sub r2, r0,r1 (r2 = r0-r1)

   cmn r0, r1 @ is equivalent to add r0,r1

   tst r0,#0x08 @test whether bit_3 is 0

   bne suspendup @Whether the previous instruction is true or not, if true, jump to the label suspendup

   tst r0,#0x0f @test whether bits 0-3 of r0 are all 0

 

•Multiplication instructions mvl mla umull umlal smull smlal

 

• Leading zero count clz

Comparison instructions are used to compare the values ​​in two registers.
Note: comparison instructions do not need to be followed by an suffix of 's' to affect the flag bits in cpsr.
Common ARM instructions 2: cpsr access instructions: mrs & msr

•mrs is used to read psr (including cpsr, spsr), msr is used to write psrpsr (including cpsr, spsr)

      The difference and connection between cpsr and spsr: there is only one cpsr program status register in the entire SOC; while there are 5 spsrs, which are used in 5 exception modes respectively. Their function is to enter the exception mode when the normal mode enters the exception mode.

      Used to save the cpsr in the previous normal mode and restore the original spsr when returning to normal mode.

•CPSR registers are special and require special instructions to access them, namely mrs and msr.

 

Common ARM instructions 3: Jump (branch) instructions: b & bl & bx

•b Jump directly (if not opened, it will be considered a return)

•bl branch and link, put the return address into lr before jumping, so that it can be returned and used for function calls

•The bx jump switches to ARM mode at the same time, and is generally used for exception handling jumps.

 

Common ARM instructions 4: memory access instructions: ldr/str & ldm/stm & swp

• Single word/half word/byte access ldr/str

•Multi-word batch access ldm/stm

•swp r1, r2, [r0]

•swp r1, r1, [r0] (swap data between memory and register)

 

Immediate values ​​in ARM assembly (legal and illegal immediate values)

•ARM instructions are all 32-bit, and in addition to the instruction tag and operation tag, they can only be accompanied by a small number of immediate values. Therefore, there are legal and illegal immediate values.

• Legal immediate number: After any number of shifts, the non-zero part can be represented by 8 bits, which is a legal immediate number.

  For example: Legal immediate number: 0x000000ff, 0x00ff0000

       Illegal immediate value: 0x000001ff

 

Common ARM instructions 5: software interrupt instruction: swi (software interrupt)

•Soft interrupt instructions are used to implement system calls in the operating system

Keywords:ARM Reference address:ARM assembly instruction set 3

Previous article:ARM assembly instruction set 1
Next article:ARM assembly instruction set 4

Recommended ReadingLatest update time:2024-11-16 12:03

Chapter 4 of "Some Problems with ARM and Linux": Analysis of the Principles of System Calls on the ARM Platform
This article is based on the mstar801 platform Linux2.6.35.11 version. First of all, it should be noted that system calls do not cause process context switching. 1. Introduction to system call - the only way for Linux user space to actively enter kernel space     1. System call is a set of "special" interfaces prov
[Microcontroller]
(Embedded) About the storage controller in ARM (I)
Purpose: When the development board (JZ2440 V3) starts the CPU from Nand flash after power-on, the CPU will copy the first 4K data of Nand flash to the 4K internal SRAM called "Steppingstone" (starting address is 0) through the internal hardware, and then jump to address 0 to start execution. In this experiment, we
[Microcontroller]
(Embedded) About the storage controller in ARM (I)
GNU ARM assembly instructions
Part 1 ARM Assembly Syntax under Linux Although it is convenient to write programs in C or C++ under Linux, the assembly source program is used for the most basic system initialization, such as initializing the stack pointer, setting up the page table, and operating the ARM coprocessor. After the initialization is comp
[Microcontroller]
Some concepts of arm (the difference between ARM7 and Cortex-M)
What do ARM core and architecture mean, and what is the relationship between them? 1. ARM core: From ARM7, ARM9 to Cortex-A7, A8, A9, A12, A15, and then to Cortex-A53, A57, etc., in short, different versions of ARM have different ideas. For example, Cortex A8 and A9 designed for high speed are both ARMv7a architectur
[Microcontroller]
Application of ARM core board in electrical fire monitoring system
In autumn, when the weather is dry, please be careful not to use a small horse to pull a big cart when using electricity at home! Some time ago, I learned that there were 5,679 fires in Hangzhou in 2014, of which electrical fires accounted for more than 40%!   In the fire statistics of the fire department, fir
[Microcontroller]
Application of ARM core board in electrical fire monitoring system
8. Detailed explanation of ARM registers
Simple classification of ARM registers: Figure 1-1: Figure 1-1 There are 37 32-bit registers in the ARM microprocessor, including 31 general registers and 6 status registers. However, these registers cannot be accessed at the same time. In the seven modes, the types of registers that can be accessed
[Microcontroller]
8. Detailed explanation of ARM registers
Qemu builds ARM vexpress development environment (I)
Embedded development is inseparable from hardware devices such as development boards and peripherals. However, if you just want to study the Linux kernel, the architecture and working mode of the Linux kernel, you need to modify some codes, recompile and burn them into the development board for verification, which may
[Microcontroller]
[ARM Learning Notes] Understanding ARM interrupt nesting mode
I have been working on DSP before. DSP has nested interrupts. In order to ensure that the terminal is not lost in the case of multiple interrupts, the interrupt will be re-enabled after reading the hardware data. Therefore, I took it for granted that the ARM architecture also has such a priority-based preemption mecha
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号