So I am taking the plunge in to 64 bit assembly programming in Linux and coming from a previous understanding of 32 bit (x86) assembly, some of the immediate differences are interesting.
System Calls use syscall where in x86, it was int 0x80.
32 bit Hello World:
section .data
hello: db 'Hello world!',10
helloLen: equ $-hello
section .text
global _start
_start:
mov eax,4
mov ebx,1
mov ecx,hello
mov edx,helloLen
int 80h
mov eax,1
mov ebx,0
int 80h
64 bit Hello World:
section .data
string1 db "Hello World!",10,0
section .text
global _start
_start:
mov rdi, dword string1
mov rcx, dword -1
xor al,al
cld
repnz scasb
mov rdx, dword -2
sub rdx, rcx
mov rsi, dword string1
push 0x1
pop rax
mov rdi,rax
syscall
xor rdi,rdi
push 0x3c
pop rax
syscall
I figured it might be relevant to learn considering that most (home based) systems will be running on 64 bit processors. And the money I dished out on assembly books back in the early 90’s should be put to use.
Any assembly programmers here that haven’t had to have a hip replacement care to comment on some of the other differences or your experiences?