How fardenghi/so-tp2 works
Project type and purpose
• This is a teaching‐grade monolithic 64‐bit operating system.
• It comprises:
• A Bootloader (BMFS and Pure64 variants)
• A Kernel (interrupts, drivers, memory, scheduler, syscalls)
• A Userland (shell, utilities, tests)
• A Toolchain (cross‐compiler, ModulePacker)
• Build & run scripts (compile.sh, run.sh invoking Docker/QEMU)
High‐level file‐tree analysis
• Top‐level folders:
• Bootloader/…
• Image/…
• Kernel/…
• Toolchain/…
• Userland/…
• Support scripts in root: compile.sh, run.sh
• Kernel subdivides into Drivers, Interruptions, Memory, Processes, Semaphores, Pipes, Util, asm, include.
• Userland hosts a sample code module with Programs, Libs, asm stubs, headers.
• Toolchain contains ModulePacker for bundling kernel modules.
Key features from README
• Monolithic kernel with preemptive round‐robin scheduler
• Two memory managers: free‐list & buddy
• System calls, semaphores, pipes, drivers (keyboard, video, audio, time)
• Build in Docker container, run in QEMU with optional GDB
Main components
a. Build Environment
– Docker container (agodio/itba-so-multi-platform:3.0)
– Scripts: compile.sh (parameters: no-buddy/debug/buddy), run.sh (gdb)
– Toolchain: cross‐compiler toolchain, ModulePacker
b. Bootloader
– BMFS variant (BareMetal FS)
– Pure64 variant (bootsectors, init, syscalls)
– Role: set up CPU mode, load kernel into memory
c. Kernel
– Core initialization (cpu, pic, acpi, smp)
– Interrupt handling (IDT, IRQ dispatcher, exceptions)
– Memory management (free‐list, buddy systems, allocation interfaces)
– Process management (process table, context switching, scheduler)
– IPC mechanisms (unidirectional pipes, blocking I/O)
– Synchronization (semaphores)
– Device drivers (keyboard, video, audio, time)
– System call interface
d. Userland
– Shell (built‐in commands, parser, REPL)
– Utilities: cat, wc, filter, philosophers, help, mem, ps, kill, etc.
– Test programs (sync_test, test_mm, test_processes, etc.)
e. Execution Environment
– QEMU VM (virtual hardware)
– Optional GDB server integration
Interactions & data flows
• Build pipeline: compile.sh → Docker → Toolchain → Bootloader + Kernel + User modules → disk image
• run.sh → QEMU VM loads MBR → Bootloader → Loads Kernel → Kernel init → Launch shell process
• Userland apps ↔ Kernel via system calls (I/O, fork/exec, pipes, semaphores)
• Interrupts (timer, keyboard) trigger kernel handlers → scheduler context‐switches
• Drivers interface with virtual hardware via QEMU’s emulated devices
Architectural patterns & design principles
• Monolithic kernel: all core services (memory, processes, drivers, IPC) live in kernel space
• Layered initialization: bootstrap → CPU setup → memory manager → device init → scheduler → userland
• Use of modular code (separate C/ASM units, ModulePacker bundles modules)
• Clear separation: Bootloader vs Kernel vs Userland