AT&T 汇编问题

AirT
  • 98

初学汇编遇到一个疑问,汇编指令:

    0x100002d5b <+11>: xorl   %ecx, %ecx   ; ecx = 0x00000000
    0x100002d5d <+13>: movl   %ecx, %edx   ; 把 ecx 移动到 edx

此时 edx0x00000000 可以理解,但为什么 rdx0x0000000000000000 呢。

在执行第二条汇编指令前 rdx 的值是 0x00007ffeefbff5b8。执行 movl 后前面的 0x00007ffe 为什么会丢失呢。感觉应该是和低位高位有关系,计算机基础不是很好希望能得到指点。

回复
阅读 567
1 个回答

intel 的文档:https://software.intel.com/co...

When in 64-bit mode, operand size determines the number of valid bits in the destination general-purpose register:

  • 64-bit operands generate a 64-bit result in the destination general-purpose register.
  • 32-bit operands generate a 32-bit result, zero-extended to a 64-bit result in the destination general-purpose register.
  • 8-bit and 16-bit operands generate an 8-bit or 16-bit result. The upper 56 bits or 48 bits (respectively) of the destination general-purpose register are not modified by the operation. If the result of an 8-bit or 16-bit operation is intended for 64-bit address calculation, explicitly sign-extend the register to the full 64-bits.
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
你知道吗?

宣传栏