summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKjetil Orbekk <kjetil.orbekk@gmail.com>2015-10-11 14:26:14 -0400
committerKjetil Orbekk <kjetil.orbekk@gmail.com>2015-10-11 14:26:14 -0400
commite0bea38f2a5b9a46c712b24ccb215735cdf09dff (patch)
tree70c3a27cf91ae9c2f0a145e2056a9ae447e29094
Add elf64 hello world.
-rw-r--r--asm-64/Makefile5
-rw-r--r--asm-64/hello.asm14
2 files changed, 19 insertions, 0 deletions
diff --git a/asm-64/Makefile b/asm-64/Makefile
new file mode 100644
index 0000000..c208e6c
--- /dev/null
+++ b/asm-64/Makefile
@@ -0,0 +1,5 @@
+all: hello
+
+hello:
+ nasm -felf64 -o hello.o hello.asm
+ ld -o hello hello.o
diff --git a/asm-64/hello.asm b/asm-64/hello.asm
new file mode 100644
index 0000000..9a1f712
--- /dev/null
+++ b/asm-64/hello.asm
@@ -0,0 +1,14 @@
+section .data
+ message db "Hello, World!"
+
+section .text
+ global _start
+_start:
+ mov rax, 1
+ mov rdi, 1
+ mov rsi, message
+ mov rdx, 13
+ syscall
+ mov rax, 60
+ mov rdi, 0
+ syscall