This project has been made with the sole purpose of teaching the fundamentals of POSIX system calls from a low-level perspective.
It also aims to provide a comparison of these calls compared with their counterparts in a medium/high-level language such as C.
The project covers a range of POSIX system calls, providing insights into their usage and behavior at the lowest level of abstraction. By comparing these implementations with their counterparts in C, the project offers a comprehensive understanding of how system calls function across different levels of abstraction.
The main idea behind this project was planned with the intention of publication in the Paged Out! technical magazine. It is designed to appeal
to readers interested in systems programming, low-level development, and understanding the inner workings of operating systems.
In order to compile and execute this project, you need to have the nasm
assembler installed. We will cover 2 compiling options:
- Assemble the program file:
Use NASM (Netwide Assembler) to convert the assembly code into an object file. Depending on your system and desired output format, you might need to specify the format. Use
nasm -h
for checking available formats:
mkdir -p build/{bin,obj} # Create the directories
nasm -f <format> ./src/chat.asm -o ./build/obj/asm-chat.o
- Link the object file to create an executable:
Use the linker (typically
ld
on Unix-like systems) to link the object file and produce the final executable:
ld ./build/obj/asm-chat.o -o ./build/bin/asm-chat
- Run the executable:
./build/bin/asm-chat
- Build the project:
Use Make to build the project automatically:
make build
- Run the executable:
make runonly
Or
./build/bin/asm-chat
Alternatively, you can download the compiled binary directly from Releases.
[1]
x86 Assembly/Interfacing with Linux - Wikibooks. [Consulted on June 2, 2024]
[2]
syscalls(2) [posix man page] - unix.com. [Consulted on June 2, 2024]
[3]
NASM - The Netwide Assembler v.2.16.03. [Consulted on June 2, 2024]
[4]
CMake NASM Test - Andy Stanton. [Consulted on June 2, 2024]