Skip to content

Instantly share code, notes, and snippets.

@0x61nas
Created February 6, 2024 09:07
Show Gist options
  • Save 0x61nas/b1a73e335ea42062efd8615adbec13e1 to your computer and use it in GitHub Desktop.
Save 0x61nas/b1a73e335ea42062efd8615adbec13e1 to your computer and use it in GitHub Desktop.
; 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