简体   繁体   English

汇编语言整数寄存器

[英]Assembly Language Integer registers

I don't understand what this assembly instruction does. 我不明白该汇编指令的作用。 What is its effect and why? 它的作用是什么?为什么?

imull $16, (%eax, %edx,4)

The initial values of the registers are 寄存器的初始值为

%eax= 0x100x
%edx= 0x3

I'm assuming you're trying to understand how to interpret that AT&T style assembly instruction, in particular the addressing part. 我假设您正在尝试了解如何解释该AT&T样式的汇编指令,尤其是寻址部分。 I'm sure you don't need help understanding what the imull $16 part does - it simply performs a signed multiplication, the last l standing for long word. 我敢肯定,您不需要帮助就可以了解imull $16部分-它只是执行有符号乘法,最后一个l代表long词。

(%eax, %edx, 4) is a form of addressing, where you have a base address, an offset of a certain amount of elements, and a scale/multiplier for multiplying the number of elements by the size of each one: (base, offset, offset scale/multiplier) . (%eax, %edx, 4)是寻址,在这里有一个基地址,一定量的元件中的一个偏移量,以及用于通过每一个的大小的元素的数量乘以一个比例/乘法器的形式: (base, offset, offset scale/multiplier)

What you end up with is (base + (offset * multiplier) , so in this case it'll be: 您最终得到的是(base + (offset * multiplier) ,因此在这种情况下它将是:

(%eax + (%edx * 4))
(0x100 + (0x3 * 4))
(0x100 + 0xC)
(0x10C)

Therefore the instruction imull $16, (%eax, %edx,4) performs a signed multiplication of 16 by the value of the long word at the address 0x10C . 因此,指令imull $16, (%eax, %edx,4)执行16的有符号乘法与地址0x10C字的值的0x10C

The result of this instruction will be whatever dword is stored at the address 0x10c multiplied by 16 (or, if you prefer, shifted to the left by 4 bits). 该指令的结果将是存储在地址0x10c dword乘以16(或者,如果您愿意,向左移4位)的任何dword The result will be written to that address as well. 结果也将写入该地址。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM