0

A quick question regarding a movzwl instruction which do not behave as I expected.

here is the disassembled code:

movzwl (%rax),%eax

Before the instruction, rax is 0x7fffffffe410 and point to 0x5 After the instruction, I would expect eax to be 0x5 (which is the case), but I would not expect that the upper bits of rax be cleared too... However, when debugging, rax values 0x5...

I thought that movzwl would only clear the upper bits of eax, but not the rax ones. Could you explain?

Thank you very very much for your help!

enter image description here

  • "I thought that ..": Did you check the official Intel documentation? – usr2564301 Dec 28 '17 at 12:31
1

This is a somewhat tricky part of the x64 instruction set and is not mentioned in descriptions of individual instructions but only as a sidenote in the general introduction section. Here's a good answer on it:

https://stackoverflow.com/questions/11177137/why-do-x64-instructions-zero-the-upper-part-of-a-32-bit-register

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.