Created
February 6, 2024 09:07
-
-
Save 0x61nas/b1a73e335ea42062efd8615adbec13e1 to your computer and use it in GitHub Desktop.
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
; Print a message out | |
; Aassmbl with: | |
; nasm -f elf64 -g -F stabs eatsyscall.asm | |
; ld -o eatsyscall eatsyscall.o | |
section .data | |
EatMsg: db "Eat at Joe's!", 10 | |
EatLen: equ $-EatMsg | |
section .bss ; section containing the unintialized data | |
section .text ; The code | |
global .start ; The entry point | |
_start: | |
mov rbp, rsp ; for correct debugging | |
nop ; keep gdb happy | |
mov rax, 1 ; 1 => write syscall | |
mov rdi, 1 ; 1 => stdout file discriptor | |
mov rsi, EatMsg ; pointer to the first address in the msg | |
mov rdx, EatLen ; the message length | |
syscall ; make the call | |
mov rax, 60 ; 60 => exit syscall | |
mov rdi, 0 ; the 1st argument | |
syscall |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment