Created
September 13, 2019 02:36
-
-
Save rexim/8c252ce17542693f850171034b9bc521 to your computer and use it in GitHub Desktop.
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
// gcc -nostdlib main.c | |
inline static | |
void write_syscall(int fd, const void *buf, unsigned int count) | |
{ | |
asm("movq $1, %rax"); | |
asm("syscall"); | |
} | |
inline static | |
void exit_syscall(int code) | |
{ | |
asm("movq $60, %rax"); | |
asm("syscall"); | |
} | |
void _start() | |
{ | |
char message[] = "Hello, World\n"; | |
write_syscall(1, message, sizeof(message)); | |
exit_syscall(0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment