Search code examples
64-bitinstructions

x64 pop instructions (opcode + rd)


Here are the pop instructions that use the shortcut opcodes on page 1159 of the intel x64 manual:

58+ rw POP r16 Pop top of stack into r16; increment stack
pointer.

58+ rd POP r64 Pop top of stack into r64; increment stack
pointer.

Do these instructions use Rex.R or Rex.B to encode registers 9-16 or are they just added to the opcode? Also does the 64-bit version use Rex.W? I've just never run into these register shortcut instructions before.


Solution

  • Instructions that encode a register operand as part of the opcode use the REX.B field to access registers r8 and so on.

    64bit pushes and pops do not need a REX.W, they are 64bit by default and there is no way to make them 32bit. They can be made 16bit by using the 66h prefix.