How niclas3/frog works
Purpose and Execution Model
Frog is a self-teaching 32-bit x86 PC operating system: a bootloader loads a kernel that initializes hardware, memory, interrupts, processes, storage, and a desktop compositor. It is built for disk-image boot under QEMU/Bochs rather than hosted execution.
Boot and Kernel Entry
The boot chain begins in the MBR and loader assembly, then transfers into the protected-mode kernel assembly/C entry path. Core startup establishes the low-level runtime before subsystems are available.
• booter/MBR.s
• booter/loader.s
• core/core.s
• core/bootpack.c
CPU Protection, Interrupts, and Time
Descriptor/TSS setup defines x86 protected-mode execution context. PIC and interrupt code route hardware faults and IRQs; the PIT-backed timer drives timing and likely scheduling/timeout activity. Softirqs provide deferred interrupt work.
• core/destab/descriptor.c
• core/destab/tss.c
• core/interrupt/int.c
• core/pic/pic.c
• core/frog/pit8253.c
Process and System-Service Boundary
The thread/process subsystem owns task creation, context switching, scheduling, fork/exec/exit, and synchronization. User-facing syscall initialization and dispatch form the boundary from applications/system tasks into kernel services.
• core/thread/sched.c
• core/thread/process.c
• core/thread/switch.s
• core/usr/syscall-init.c
• core/usr/syscall.c
Memory, IPC, and Kernel Coordination
Physical/virtual memory management underpins process execution. IPC, pipes, semaphores, queues, and select-style readiness are the primary coordination mechanisms between processes and device/service code.
• core/mm/memory.c
• core/ipc/ipc.c
• core/fs/pipe.c
• core/fs/select.c
• core/thread/semaphore.c
Devices, Storage, and Filesystem
Hardware drivers cover CMOS, console, IDE disks, PS/2 keyboard/mouse, and linear-framebuffer video. IDE is the storage boundary; filesystem layers expose directories, files, inodes, and a package filesystem abstraction above it.
• core/device/ide.c
• core/device/pc_kbd.c
• core/device/ps2hid.c
• core/fs/fs.c
• core/vfs/packagefs.c
Graphics and Desktop Stack
Framebuffer video feeds graphics and GUI support libraries. The compositor and desktop applications consume these facilities; image decoders indicate desktop rendering can load BMP/JPEG assets. “Poudland” headers/library suggest an internal display-server/client protocol boundary.
• core/video/lfbvideo.c
• core/apps/compositor.c
• core/apps/desktop.c
• core/lib/poudland.c
• core/lib/2d_graphics.c
Build and Runtime Infrastructure
Makefiles partition bootloader, kernel, devices, filesystem, apps, libraries, and tools. Shell scripts build images and launch/debug QEMU; Bochs configs are also present. Required runtime artifacts are user-created hd.img and hd80M.img disk images. Networking currently exposes a socket-oriented kernel surface but README identifies TCP/IP as unfinished.
• Makefile
• scripts/build.sh
• scripts/qemu.sh
• bochsrc
• core/net/socket.c
Main entry points: bootpack.c Kernel entry · syscall.c System call dispatch · sched.c Processes and scheduler · int.c Interrupt routing
Components 21
Boot and kernel entry
- MBR boot sector
booter/MBR.s - Protected-mode loader
booter/loader.s - Kernel entry
core/bootpack.c
Kernel core
- Descriptors and TSS
core/destab/descriptor.c - Interrupt routing
core/interrupt/int.c - PIT timer · Supplies periodic timing for kernel activity.
core/frog/pit8253.c - Processes and scheduler · Owns tasks, scheduling, fork/exec, and context switching.
core/thread/sched.c - Memory manager
core/mm/memory.c - System call dispatch
core/usr/syscall.c - IPC and synchronization · IPC, pipes, readiness, and semaphores coordinate tasks.
core/ipc/ipc.c - Socket surface · TCP/IP implementation remains unfinished.
core/net/socket.c
Devices and storage
- Keyboard and mouse
core/device/pc_kbd.c - IDE disk driver
core/device/ide.c - Filesystem and package FS
core/fs/fs.c
Desktop stack
- Linear framebuffer
core/video/lfbvideo.c - 2D graphics and Poudland · Provides drawing and an internal display protocol.
core/lib/poudland.c - Compositor
core/apps/compositor.c - Desktop application
core/apps/desktop.c
Build and emulation
- Build orchestration
Makefile - Disk image build · Builds bootable disk artifacts.
scripts/build.sh - QEMU launch
scripts/qemu.sh
Connections 23
- Build orchestration → Disk image build: invokes
- Disk image build → MBR boot sector: packages
- QEMU launch → MBR boot sector: boots image at
- MBR boot sector → Protected-mode loader: loads
- Protected-mode loader → Kernel entry: transfers control
- Kernel entry → Descriptors and TSS: initializes
- Kernel entry → Interrupt routing: initializes
- Kernel entry → Memory manager: initializes
- Interrupt routing → PIT timer: routes timer IRQ
- PIT timer → Processes and scheduler: drives scheduling
- Descriptors and TSS → Processes and scheduler: provides task context
- Memory manager → Processes and scheduler: backs address spaces
- Interrupt routing → Keyboard and mouse: dispatches device IRQs
- Processes and scheduler → System call dispatch: runs callers
- System call dispatch → IPC and synchronization: exposes coordination
- System call dispatch → Filesystem and package FS: exposes files
- System call dispatch → Socket surface: exposes sockets
- Filesystem and package FS → IDE disk driver: reads and writes blocks
- Linear framebuffer → 2D graphics and Poudland: renders through
- 2D graphics and Poudland → Compositor: supports
- Keyboard and mouse → Compositor: supplies input
- Compositor → Desktop application: composes desktop
- Filesystem and package FS → Desktop application: loads apps and assets