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);

相关推荐
liulilittle1 小时前
C++ i386/AMD64平台汇编指令对齐长度获取实现
c语言·开发语言·汇编·c++
工业互联网专业1 小时前
汇编与接口技术:8259中断实验
汇编·单片机·嵌入式硬件·8259中断实验
small_wh1te_coder15 小时前
硬件嵌入式学习路线大总结(一):C语言与linux。内功心法——从入门到精通,彻底打通你的任督二脉!
linux·c语言·汇编·嵌入式硬件·算法·c
Ronin-Lotus13 天前
微处理器原理与应用篇---ARM常见汇编指令
汇编·arm开发·微处理原理与应用
永夜的黎明16 天前
【二进制安全作业】250616课上作业1-栈溢出漏洞利用
c语言·汇编·安全
Geometry Fu18 天前
物联网控制技术 知识点总结 第三章 汇编语言 第四章 C51语言
汇编·物联网·51单片机
半桔18 天前
【Linux手册】进程的状态:从创建到消亡的“生命百态”
linux·运维·服务器·汇编·深度学习·面试
一条叫做nemo的鱼21 天前
从汇编的角度揭开C++ this指针的神秘面纱(下)
java·汇编·c++·函数调用·参数传递
一条叫做nemo的鱼22 天前
从汇编的角度揭开C++ this指针的神秘面纱(上)
汇编·c++·算法·函数调用·this指针·参数传递
qwertyuiop_i24 天前
汇编(函数调用)
汇编·windows·函数调用