本文介绍了组装中的MUL操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下装配线:

...
MOV ECX, 0x36EE80
MOV EDX, 0x95217CB1
MUL EDX
SHR EDX, 0x15
MOV DWORD PTR SS:[EBP-0x3C8], EDX
....
....

因此,在 http://en.wikibooks.org/wiki/X86_Assembly/Arithmetic我已经读过,MUL(在这种情况下为EDX)的操作数的值与EAX中的值相乘.因此,在EAX中,我的值为0330FD3B(十进制:53542203).在EDX中,我的值是95217CB1(十进制:2501999793).但是在MUL操作之后,我在EDX中具有值01DBEE41(十进制:31190593).但这一定是错误的,因为53542203 * 2501999793不是31190593 ...

So, in http://en.wikibooks.org/wiki/X86_Assembly/Arithmetic I have read that the value of the operand of MUL (in that case EDX) is multiplied with the value in EAX. So, in EAX I have the value 0330FD3B (decimal: 53542203). In EDX, i have the value 95217CB1 (in decimal: 2501999793).But after the MUL operation i have in EDX the value 01DBEE41(in decimal: 31190593). But this must be wrong because 53542203 * 2501999793 is not 31190593...

有人可以向我解释一下吗?

Can someone explain me this ?

推荐答案

MUL r/m32的描述Unsigned multiply (EDX:EAX <- EAX * r/m32)..

这意味着 64位乘积将存储在EDX:EAX中,即,高32位以EDX结尾,而低32位则以EAX结尾.符合您所看到的结果,因为乘积应为0x1DBEE41EB22A9CB.

That means that the 64-bit product will be stored in EDX:EAX, i.e. the upper 32 bits ends up in EDX and the lower 32 bits in EAX. Which fits with the results you're seeing, since the product should be 0x1DBEE41EB22A9CB.

这篇关于组装中的MUL操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-29 06:58