IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> 嵌入式 -> arm push/pop/b/bl汇编指令 -> 正文阅读

[嵌入式]arm push/pop/b/bl汇编指令

目录

1. push指令

2. pop指令

3. b指令

4. bl指令

5. bx指令



1. push指令

  • 功能描述:入栈

armv7 芯片手册:

Push Multiple Registers stores multiple registers to the stack, storing to consecutive memory locations ending just
below the address in SP, and updates SP to point to the start of the stored data.

  • 语法

Assembler syntax

PUSH{<c>}{<q>} <registers> Standard syntax
STMDB{<c>}{<q>} SP!, <registers> Equivalent STM syntax


where:
<c>, <q> See Standard assembler syntax fields on page A8-285.
<registers> Is a list of one or more registers to be stored, separated by commas and surrounded by { and }. The lowest-numbered register is stored to the lowest memory address, through to the highest-numbered register to the highest memory address. See also Encoding of lists of ARM core registers on page A8-292.
If the list contains more than one register, the instruction is assembled to encoding T1, T2, or A1. If the list contains exactly one register, the instruction is assembled to encoding T1, T3, or A2. The SP and PC can be in the list in ARM instructions, but not in Thumb instructions. However:
? ARM deprecates the use of ARM instructions that include the PC in the list
? if the SP is in the list, and it is not the lowest-numbered register in the list, the instruction
stores an UNKNOWN value for the SP.

push支持同时将多个寄存器入栈,格式:{xx,xx},如:push {r0, r1,r2}?

2. pop指令

  • 功能描述:出栈

Pop Multiple Registers loads multiple registers from the stack, loading from consecutive memory locations starting at the address in SP, and updates SP to point just above the loaded data.

  • 语法

POP{<c>}{<q>} <registers> Standard syntax
LDM{<c>}{<q>} SP!, <registers> Equivalent LDM syntax

<registers> Is a list of one or more registers to be loaded, separated by commas and surrounded by { and }. The lowest-numbered register is loaded from the lowest memory address, through to the highest-numbered register from the highest memory address

如同push一样,pop也支持同时pop出栈多个寄存器

3. b指令

  • 功能描述:

Branch causes a branch to a target address.

  • 语法:只是简单的跳转到label处

B{<c>}{<q>} <label>

4. bl指令

  • 功能描述:

Branch with Link calls a subroutine at a PC-relative address.
Branch with Link and Exchange Instruction Sets (immediate) calls a subroutine at a PC-relative address, and changes instruction set from ARM to Thumb, or from Thumb to ARM.

  • 语法:

BL{X}{<c>}{<q>} <label>

The label of the instruction that is to be branched to.
For BL (encodings T1, A1), the assembler calculates the required value of the offset from the PC value of the BL instruction to this label, then selects an encoding that sets imm32 to that offset. Permitted offsets are even numbers in the range –16777216 to 16777214 (Thumb) or multiples of 4 in the range –33554432 to 33554428 (ARM).

BL指令于B指令区别:

? ? ? ? BL函数条跳转前执行:LR = PC - 4; (armv7为例)

Note: bl指令会计算label和当前pc位置的offset,所以这是相对跳转?

5. bx指令

  • 功能描述:跳转到寄存器中的地址

Branch and Exchange causes a branch to an address and instruction set specified by a register.

  • 语法

BX{<c>}{<q>} <Rm>

The register that contains the branch target address and instruction set selection bit. The PC can be used. This register can be the SP in both ARM and Thumb instructions, but ARM deprecates this use of the SP.

  嵌入式 最新文章
基于高精度单片机开发红外测温仪方案
89C51单片机与DAC0832
基于51单片机宠物自动投料喂食器控制系统仿
《痞子衡嵌入式半月刊》 第 68 期
多思计组实验实验七 简单模型机实验
CSC7720
启明智显分享| ESP32学习笔记参考--PWM(脉冲
STM32初探
STM32 总结
【STM32】CubeMX例程四---定时器中断(附工
上一篇文章      下一篇文章      查看所有文章
加:2022-08-06 11:00:44  更:2022-08-06 11:03:11 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年11日历 -2024/11/25 23:33:37-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码