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

相关推荐
small_wh1te_coder16 小时前
GCC深度剖析:从编译原理到嵌入式底层实战
汇编·c++·面试·嵌入式·状态模式·c
白书宇1 天前
5.从零开始写LINUX内核--从实模式到保护模式的过渡实现
linux·汇编·数据库·开源
浩浩测试一下2 天前
02高级语言逻辑结构到汇编语言之逻辑结构转换 if (...) {...} else {...} 结构
汇编·数据结构·数据库·redis·安全·网络安全·缓存
蚰蜒螟3 天前
JVM安全点轮询汇编函数解析
汇编·jvm·安全
要记得喝水7 天前
汇编中常用寄存器介绍
开发语言·汇编·windows·c#·.net
技术领导力9 天前
华为开源CANN,再次释放“昇腾转向”信号
汇编
DONG91313 天前
Python 中的可迭代、迭代器与生成器——从协议到实现再到最佳实践
开发语言·汇编·数据结构·python·算法·青少年编程·排序算法
embrace9916 天前
【C语言学习】scanf函数
c语言·开发语言·汇编·学习·青少年编程·c#·编辑器
麦兜*16 天前
【算法】十大排序算法超深度解析,从数学原理到汇编级优化,涵盖 15个核心维度
java·汇编·jvm·算法·spring cloud·ai·排序算法
会掉头发16 天前
x86_64汇编
汇编