Last active
November 8, 2017 20:01
-
-
Save moyix/7578bc512aaa2b8681e602244f97e7e9 to your computer and use it in GitHub Desktop.
A syscall quiz
This file contains hidden or 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
all: quiz | |
quiz.o: quiz.asm | |
nasm -f elf64 $< -o $@ | |
quiz: quiz.o | |
ld -Tdata=0x8000000000 $< -o $@ |
This file contains hidden or 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
[bits 64] | |
global _start | |
_start: | |
mov rdx, 12 | |
mov rcx, 0x8000000000 | |
or rcx, R | |
mov rbx, 1 | |
mov rax, 4 | |
int 80h | |
mov rdx, 12 | |
mov rcx, S | |
mov rbx, 1 | |
mov rax, 4 | |
int 80h | |
mov rdx, 12 | |
mov rsi, T | |
mov rdi, 1 | |
mov rax, 1 | |
syscall | |
mov rax, 60 | |
syscall | |
R: | |
db "Oh no world", 0x0a | |
; NB: will be linked with | |
; ld -Tdata=0x8000000000 | |
[SECTION .data] | |
S: | |
db "Hello world", 0x0a | |
T: | |
db "Goodbye foo", 0x0a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment