Skip to content

Instantly share code, notes, and snippets.

View jamichaels's full-sized avatar

sblip jamichaels

View GitHub Profile
@jamichaels
jamichaels / Getdents.old.att.syntax
Created April 24, 2015 01:14
An article on getting directory structs with getdents() in at&t asm I wrote in May of 2000.
#!/home/sblip/article.2
using the getdents(2) Linux syscall to read directory entries from disk.
This article assumes basic knowledge of at&t syntax assembly, and basic
understanding of how to make system calls in linux through int 0x80h.
@jamichaels
jamichaels / 64bitprintfintTut
Last active July 25, 2019 13:23
Printing an integer to stdout with printf in 64-bit NASM (Linux)
Printing an integer to stdout with printf in 64-bit NASM (Linux)
While doing some debugging, I found myself wanting to print an address to the screen, and it
took me forever to piece together how to do it from several tutorials.
The main things you need to know are
1) use 'main:' as a label and not '_start:' - because you are calling libc, it won't work without main.
2) compile or link with -lc (that's short for libc).
3) declare printf as extern
4) zero the vector registers (put 0 into rax). I don't know why, but apparently you are supposed to.