Nerdy assembly "Hello world" program with AT&T syntax in FreeBSD For i386 we can take any assembly "Hello world" tutorial and translate it from Intel to AT&T syntax. The differences between Linux and FreeBSD are that in FreeBSD parameters need to be stored in stack instead of ebx, ecx, edx, and syscall need to be called from a fuction instead of direct 0x80 call: .text .global _start _syscall: int $0x80 ret _start: push $len push $msg push $1 mov $0x4,%eax call _syscall add $12,%esp push $0 mov $0x1,%eax call _syscall .data msg: .ascii "Hello, world!\n" len = . - msg ===== For amd64 Linux and FreeBSD assembly language versions are pretty the same: .text .global _start _start: mov $len,%rdx mov $msg,%rsi mov $0x1,%rdi mov $0x4,%rax # Linux write syscall number is $0x1 syscall mov $0, %rdi mov $0x1,%rax # Linux exit syscall number is $0x3c (decimal 60) syscall .data msg: .ascii "Hello, world!\n" len = . - msg ===== Compile it using Clang's integrated assembler $ clang -c -o hello.o hello.S $ ld -o hello hello.o $ ./hello Hello, world! ===== References: http://asm.sourceforge.net/intro/Assembly-Intro.pdf http://heather.cs.ucdavis.edu/~matloff/50/LinuxAssembly.html https://efxa.org/2011/03/02/assembly-gnulinux/ https://baptiste-wicht.com/posts/2011/11/print-strings-integers-intel-assembly.html http://neuraldk.org/document.php?att_asm https://www.cs.yale.edu/flint/cs421/papers/x86-asm/asm.html http://cs.lmu.edu/~ray/notes/gasexamples https://csiflabs.cs.ucdavis.edu/~ssdavis/50/att-syntax.htm https://sourceware.org/binutils/docs/as/ https://ru.wikibooks.org/wiki/Ассемблер_в_Linux_для_программистов_C http://www.cs.virginia.edu/~evans/cs216/guides/x86.html https://www.freebsd.org/doc/en/books/developers-handbook/x86.html https://people.freebsd.org/~lstewart/references/amd64.pdf https://www.cs.cmu.edu/~fp/courses/15213-s07/misc/asm64-handout.pdf