ARM base instruction -- bfm

If <imms> is greater than or equal to <immr>, this copies a bitfield of (<imms>-<immr>+1) bits starting from bit position <immr> in the source register to the least significant bits of the destination register.

If <imms> is less than <immr>, this copies a bitfield of (<imms>+1) bits from the least significant bits of the source register to bit position (regsize-<immr>) of the destination register, where regsize is the destination register size of 32 or 64 bits.

In both cases the other bits of the destination register remain unchanged.

Bitfield Move 通常通过其别名之一访问,这些别名在反汇编时总是首选。

如果<imms>大于或等于<immr>,则会从源寄存器中的位位置<immmr>开始复制一个(<imms>-<immr>+1)位的位字段到目标寄存器的最低有效位。

如果<imms>小于<immr>,则会将(<imms>+1)位的位字段从源寄存器的最低有效位复制到目标寄存器的位位置(regsize-<immr>),其中regsize是32或64位的目标寄存器大小。

在这两种情况下,目标寄存器的其他位保持不变。

32-bit variant

Applies when sf == 0 && N == 0.

BFM <Wd>, <Wn>, #<immr>, #<imms>

64-bit variant

Applies when sf == 1 && N == 1.

BFM <Xd>, <Xn>, #<immr>, #<imms>

Decode for all variants of this encoding

integer d = UInt(Rd);

integer n = UInt(Rn);

integer datasize = if sf == '1' then 64 else 32;

integer R;

bits(datasize) wmask;

bits(datasize) tmask;

if sf == '1' && N != '1' then UNDEFINED;

if sf == '0' && (N != '0' || immr<5> != '0' || imms<5> != '0') then UNDEFINED;

R = UInt(immr);

(wmask, tmask) = DecodeBitMasks(N, imms, immr, FALSE);

integer UInt(bits(N) x)

result = 0;

for i = 0 to N-1

if x<i> == '1' then result = result + 2^i;

return result;

Operation

bits(datasize) dst = X[d];

bits(datasize) src = X[n];

// perform bitfield move on low bits

bits(datasize) bot = (dst AND NOT(wmask)) OR (ROR(src, R) AND wmask);

// combine extension bits and result bits

X[d] = (dst AND NOT(tmask)) OR (bot AND tmask);

相关推荐
菜菜why2 天前
详细解析单片机启动汇编文件:以startup_stm32f407xx.s为例
汇编·单片机·嵌入式硬件·嵌入式软件
马里奥的蘑菇云3 天前
ARM GCC内联汇编
汇编·arm
AI迅剑4 天前
模块三:现代C++工程实践(4篇)第二篇《性能调优:Profile驱动优化与汇编级分析》
汇编·c++
代码改变世界ctw5 天前
ARM汇编编程(AArch64架构)第13课:多核启动与调度
汇编·arm开发·架构
代码改变世界ctw5 天前
ARM汇编编程(AArch64架构)课程 - 第9章:原子操作与同步
汇编·arm开发·架构
代码改变世界ctw6 天前
2.2 TF-A在ARM生态系统中的角色
汇编·arm开发·安全·trustzone·atf·optee
baynk6 天前
逆向入门(9)汇编篇-bound指令的学习
汇编·学习
无小道7 天前
c++--typedef和#define的用法及区别
c语言·开发语言·汇编·c++
代码改变世界ctw9 天前
ARM汇编编程(AArch64架构)课程 - 第5章函数调用规范
汇编·arm开发·架构
liulilittle9 天前
C/C++ inline-hook(x86)高级函数内联钩子
c语言·开发语言·汇编·c++·hook·底层·钩子