简体   繁体   中英

MUL operation in assembly

i have the following assembly lines:

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

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 ?

The description for MUL r/m32 is Unsigned multiply (EDX:EAX <- EAX * r/m32). .

That means that the 64-bit product will be stored in EDX:EAX , ie 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.

Result is 01DBEE41 EB22A9CB , EDX stores high part of it.
Decimal numbers are not concatenatable when dealing with binary representation of numbers.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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