Last active
May 18, 2022 10:55
-
-
Save RaphGL/9b27df425c4e4b250bbdc9a4a25c75b3 to your computer and use it in GitHub Desktop.
Hello World in x86 Assembly (AT&T)
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
# .data stores variables | |
.data | |
hello: .string "Hello world\n" | |
# .text stores the code | |
.text | |
.globl _start # makes _start the entry point of the program | |
_start: | |
# call write(fd, buf, size) | |
movl $4, %eax # write = 4 | |
movl $1, %ebx | |
movl $hello, %ecx | |
movl $12, %edx | |
int $0x80 # calls the kernel and the kernel runs the system call | |
# exit(0) | |
# needs to exit so the CPU stops execution | |
# otherwise it segfaults | |
movl $1, %eax | |
movl $0, %ebx | |
int $0x80 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment