I'm writng a basic x86-64 assembly program on my linux system(x86-64) to print "Trollll" on execution, and it doesn't seem to work.
This is the code I've written. The file name is hello1.asm
section .data
msg db 'Trollll',0xa
section .text
global _start
_start:
;write(int fd,char* msg,unsigned int len)
mov rax,1 ; for write system call
mov rbx,1 ; first parameter (for output on stdout)
mov rcx,msg ;second parameter
mov rdx,8
int 0x80
;exit(int return)
mov rax,60 ;for exit system call
mov rbx,0 ;first parameter
int 0x80
I first complied the file with:
nasm -f elf64 hello1.asm
I then linked it with:
ld -o hello1 hello1.o
Next, I executed it with:
./hello1
I was expecting the output to be: Trollll
but, nothing showed on the screen? Where am I missing something?
Note: I found the system call numbers in the file:
/usr/include/x86-64-linux-gnu/asm/unistd_64.h