【AArch64汇编命令】

本文详细介绍了AArch64架构下的四种汇编指令:STP用于存储一对寄存器值到内存,LDP则用于从内存加载一对寄存器值,ADR通过PC相对偏移计算地址,而ADRP则用于计算4KB页面对齐的PC相对地址。这些指令在低级编程和内存操作中起到关键作用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

STP指令

STP <Wt1>, <Wt2>, [<Xn|SP>], #<imm>

Store Pair of Registers calculates an address from a base register value and an immediate offset, and stores two 32-bit words or two 64-bit doublewords to the calculated address, from two registers.

将<Wt1>, <Wt2>寄存器中的值保存到内存[<Xn|SP>+#imm]中

LDP指令

LDP <Xt1>, <Xt2>, [<Xn|SP>], #<imm>

Load Pair of Registers calculates an address from a base register value and an immediate offset, loads two 32-bit words or two 64-bit doublewords from memory, and writes them to two registers

将内存[<Xn|SP>+#imm]、[<Xn|SP>+#imm+8]中的值保存到 <Xt1>, <Xt2>两个寄存器中

ADR指令

ADR <Xd>, <label>
Compute address of label at a PC-relative offset.

Form PC-relative address:adds an immediate value to the PC value to form a PC-relative address, and writes the
result to the destination register.
PC指针加上一个立即数得到一个PC相对地址,将这个地址写道目的寄存器

The ADR instruction adds a signed, 21-bit immediate to the value of the program counter that fetched this instruction,
and then writes the result to a general-purpose register. This permits the calculation of any byte address within
±1MB of the current PC.

ADRP指令

ADRP <Xd>, <label>
Compute address of 4KB page at a PC-relative offset

Form PC-relative address to 4KB page:adds an immediate value that is shifted left by 12 bits, to the PC value to form a PC-relative address, with the bottom 12 bits masked out, and writes the result to the destination register.
得到4KB页对齐的PC相对地址:将一个立即数左移12位,加上PC值(低12位清零),形成一个PC的相对地址,其低12位为0(4K页对齐),将结果写入目的寄存器。

The ADRP instruction shifts a signed, 21-bit immediate left by 12 bits, adds it to the value of the program counter with
the bottom 12 bits cleared to zero, and then writes the result to a general-purpose register. This permits the
calculation of the address at a 4KB aligned memory region. In conjunction with an ADD (immediate) instruction, or
a load/store instruction with a 12-bit immediate offset, this allows for the calculation of, or access to, any address
within ±4GB of the current PC.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值