1

NOTE: I'm using a BSD based system so if I remember correctly this means args for called subroutines/functions are pushed onto the stack not placed in registers

I've been trying out assembly and I wanted to try my simple kernel-exit program:

.globl _start

_start:
    movl $0x20, %eax
    pushl %eax
    movl $0x1, %eax
    subl $0x4, %esp
    int $0x80

in 64 bit assembly.

I remember reading that a large difference is the registers are now renamed r prefixed instead of the 32 bit standard of an e prefix.

But what is the new postfix for 64 bit opcodes, if l already means long for 32 bits?

Out of curiosity why is it an r prefix for the new registers?

Also if there are any good resources where further information could be found. Or tutorials, tutorials are always fun.

Hawken
  • 2,059
  • 19
  • 34
  • The calling convention is different for 64 bit applications than 32-bit applications, so you will use registers, not the stack. See [this answer](http://stackoverflow.com/a/2538212/458390) for the details. The 64-bit postfix is `q` for quadword. The `r` prefix is probably because AMD created the 64-bit extensions first, so Intel didn't have a chance to add some other letter which meant "extended". – ughoavgfhw Mar 27 '12 at 01:17

1 Answers1

2

The postfix is q for qword, and r supposedly stands for register. Here's an introduction in AT&T syntax.

Jens Björnhager
  • 5,632
  • 3
  • 27
  • 47
  • Any idea why `l` is not `d` for dword? Or is it just remnants of GAS being made for C compilation? Come to think of it why doesn't C use `word` and `dword` instead of `short` and `long` respectively? – Hawken Mar 27 '12 at 01:19
  • 1
    As to the design decisions that went into AT&T syntax, I can only speculate that it was strongly tied to C. And as to the design decisions that went into C, I couldn't say :P – Jens Björnhager Mar 27 '12 at 02:11