32位PPC rlwinm指令 [英] 32 bit PPC rlwinm instruction
问题描述
我在理解 rlwinm
PPC 汇编指令时遇到了一些麻烦(Rotate Left Word Immediate Then AND with Mask).
I'm having a bit of trouble understanding the rlwinm
PPC Assembly instruction (Rotate Left Word Immediate Then AND with Mask).
我正在尝试反转函数的这一部分
I am trying to reverse this part of a function
rlwinm r3, r3, 0, 28, 28
我已经知道 r3
是什么.r3
在这种情况下是一个 4 字节的整数,但我不确定这个指令 rlwinm
到底在做什么.
I already know what r3
is. r3
in this case is a 4 byte integer but I am not sure exactly what this instruction rlwinm
is doing to it.
顺便说一下,这是在 32 位机器上.
By the way, this is on a 32 bit machine.
推荐答案
您的理解不完全正确.根据 IBM 链接 在此说明中,您看到的表格是:
Your understanding is not quite right. As per the IBM link on this instruction, the form you're seeing is:
rlwinm <target=r3>, <source=r3>, <shift=0>, <begin-mask=28>, <end-mask=28>
因此不涉及实际转移.而用于 AND
操作的实际掩码是根据 begin
和 end
掩码 位置构造的, 没有给出作为显式参数(a).
Hence no actual shift is involved. And the actual mask used for the AND
operation is constructed from the begin
and end
mask positions, it's not given as an explicit argument(a).
在这种情况下,因为两个位置都是 28,所以掩码只是一个位,根据链接页面(稍微解释一下):
In this case, since both positions are 28, the mask is simply a single bit, as per the linked page (slightly paraphrased):
如果 begin-mask 值小于 end-mask 值加一,则设置起点和终点之间的掩码位(包括起点和终点)对那些.所有其他位都设置为零.
If the begin-mask value is less than the end-mask value plus one, then the mask bits between and including the starting point and the end point are set to ones. All other bits are set to zeros.
所以您看到的指令并不比单个 AND
操作更复杂.
So the instruction you're seeing is nothing more complicated than a single AND
operation.
(a)有一种形式,允许您指定实际掩码(假设它由连续的一位组成),但它是四个-argument 版本,实际上只是汇编程序可以转换为五参数版本的语法糖.
(a) There is a form that allows you to specify the actual mask (assuming it consists of contiguous one-bits) but it's the four-argument version and really just syntactic sugar that the assembler can turn into the five-argument one.
这篇关于32位PPC rlwinm指令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!