I am learning assembler programming on 64-bit Linux.
The instruction "push edx" ends up with the error "instruction not
supported in 64-bit mode", the instrucion "push rdx" works fine.
What do I have to do to push edx?
Thanks,
Bernd
On 21 Dec 2009 21:11:06 GMT, Bernd Gerber
Hi Bernd,
Well... you can push rdx, that'll push edx too... I assume you know how
the registers fit together(?). Or you can write 32-bit code, and just
push edx.
If you're "just learning assembly", you might be better off to start
with 32-bit. Only because the instructional materials and examples
you'll find will mostly be 32-bit. 64-bit is still "pioneer land", to an
extent. There's this "work in progress" for 64-bit:
http://www.vikaskumar.org/amd64/index.htm
And there's this:
In order to get your ld (64-bit, I presume) to do 32-bit code, add
"-melf_i386" to the command line. If you're using Nasm, "-f elf32" (or
just "-f elf") instead of "-f elf64", of course. I think for (G)as, it's
just "-386"(?).
If you're "just learning 64-bit assembly", you just learned your first
lesson: push rdx. :)
Best,
Frank
Alex
On Dec 21, 6:19 pm, David <d...@nowhere.net> wrote:
> Read and understand the Intel and/or AMD instruction manuals. Some
> combinations, including the one you want, appear to be illegal.
>
> On 21 Dec 2009 21:11:06 GMT, Bernd Gerber
>
In 64-bit code, the stack is always manipulated in 64-bit units. The
calling convention requires this. So, to push edx, you push rdx instead.
--
Tim Roberts, ti...@probo.com
Providenza & Boekelheide, Inc.