Search code examples
assemblystackx86-64

Push and Pop on AMD64


What is the equivalent of pushl %ecx and popl %ecx on an AMD64 system?
My results are:

Error: invalid instruction suffix for 'push'

I have had a look and someone suggested changing ecx to rcx but that just resulted in:

Incorrect register '%rcx' used with 'l' suffix

Thanks for your help.


Solution

  • On AMD64, push and pop operations are implicitly 64-bits and have no 32-bit counterparts. Try:

    pushq %rcx
    popq %rcx
    

    See here for details.