Created
October 28, 2011 06:59
-
-
Save adrianratnapala/1321776 to your computer and use it in GitHub Desktop.
Hello World on amd64 under Linux.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Hello World on amd64 under Linux. | |
# | |
# One way to build this is with: | |
# | |
# gcc hello.S -s -nostartfiles -nostdlib -o hello | |
# | |
# for syscall numbers look in /usr/include/asm/unistd_64.h | |
# for examples look at http://99-bottles-of-beer.net/language-assembler-(amd64)-933.html | |
# for insipration look at http://www.muppetlabs.com/~breadbox/software/tiny/teensy.html | |
hello: | |
.string "Hello world!\n" | |
.globl _start | |
_start: | |
# write(1, hello, 13) | |
mov $1, %rdi | |
mov $hello, %rsi | |
mov $13, %rdx | |
mov $1, %rax | |
syscall | |
# _exit(0) | |
xor %rdi, %rdi | |
mov $60, %rax | |
syscall |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment