Skip to content

Equinox-Collective/EquinoxOS

Repository files navigation

EquinoxOS

EquinoxOS

A hobby monolithic kernel for x86_64 β€” with a real GUI, preemptive multitasking, networking, and audio.

License: GPL-2.0 Kernel Arch Boot Language Status Ring3 Sound


What is EquinoxOS?

EquinoxOS is a from-scratch hobby operating system for x86_64 written in C and ASM. It boots via the Limine bootloader in 64-bit Higher Half mode, runs a compositing window manager with drop shadows and z-ordering, supports true preemptive multitasking with Ring 3 user-space isolation, dual filesystem support (FAT32 + EXT2), a full TCP/IP network stack, AC97 audio, and even runs a port of DOOM.

It's made to be minimally daily-usable while staying readable and educational.


πŸ— System Architecture

graph TD
    subgraph UserSpace["πŸ§‘ User Space (Ring 3)"]
        ELF[ELF64 Executables] --> SDK[EquinoxOS SDK / CRT0]
        SDK --> SYSCALL[int 0x80 Syscall Interface]
    end

    subgraph KernelCore["βš™οΈ Kernel Core (Ring 0)"]
        SYSCALL --> HANDLER[Syscall Handler Β· 10 calls]
        HANDLER --> TASK[Preemptive Scheduler Β· Round-Robin]
        HANDLER --> MEM[Memory Manager]
        MEM --> PMM[PMM Β· Bitmap Allocator]
        MEM --> VMM[VMM Β· 4-Level Paging]
        MEM --> HEAP[Kernel Heap Β· kmalloc/kfree]
        MEM --> SHM[Shared Memory Β· shm_alloc]
    end

    subgraph Subsystems["πŸ”§ Kernel Subsystems"]
        VFS[Virtual File System] --> FAT32[FAT32 R/W Β· ATA PIO]
        VFS --> EXT2[EXT2 R/W Β· ATA PIO]
        VFS --> DEVFS[Device Nodes]
        GUI[CWM Compositor] --> VESA[VESA LFB Β· Direct Framebuffer]
        GUI --> SHADOW[Drop Shadow Β· Alpha Blend]
        NET[Network Stack] --> RTL[RTL8139 Driver]
        NET --> ARP_IP[ARP Β· IPv4 Β· ICMP]
        NET --> UDP_TCP[UDP Β· TCP 3-way handshake]
        NET --> HTTP_DNS[HTTP GET Β· DNS Β· NTP]
        AUDIO[AC97 Driver] --> PCM[PCM Audio Output]
    end

    subgraph Hardware["πŸ–₯ Hardware"]
        VESA --> FB[Framebuffer]
        RTL --> NIC[RTL8139 NIC]
        FAT32 --> DISK[ATA Disk]
        EXT2 --> DISK
        AUDIO --> CODEC[AC97 Codec]
        PS2MOU[PS/2 Mouse] --> GUI
        PS2KB[PS/2 Keyboard] --> TASK
        PCI[PCI Bus Scan] --> RTL
        PCI --> AUDIO
    end
Loading

πŸ›  Hardware Support & Features

Category Component Status Notes
Boot Limine Protocol v3 βœ… 64-bit Higher Half, memory map, HHDM
CPU x86_64 + SSE βœ… SSE init (CR0/CR4), used by VESA blitter
Memory β€” PMM Bitmap Allocator βœ… Page-granular, pmm_alloc_continuous()
Memory β€” VMM 4-Level Paging βœ… PML4/PDP/PD/PT, separate user address spaces
Memory β€” Heap kmalloc / kfree βœ… 64 MB kernel heap
Memory β€” SHM Shared Memory βœ… shm_alloc() for IPC between tasks
Multitasking Preemptive Round-Robin βœ… IRQ0 (PIT 50 Hz) context switch
User Mode Ring 3 Isolation βœ… Per-process PML4, TSS, GDT segments
Graphics VESA LFB βœ… Double-buffered, hardware cursor, alpha blending
GUI Compositing WM βœ… Z-ordering, drop shadows, window drag
Storage ATA PIO βœ… Raw sector R/W for both FS drivers
Filesystem FAT32 βœ… Full Read + Write, 8.3 filenames
Filesystem EXT2 βœ… Read + Write, stress-tested
ELF Loader ELF64 βœ… PT_LOAD segments mapped into user PML4
Network RTL8139 βœ… PCI scan, raw TX/RX
Network ARP / IPv4 / ICMP βœ… Full IPv4 stack with ICMP ping
Network UDP / TCP βœ… UDP datagrams + TCP 3-way handshake
Network HTTP / DNS / NTP βœ… HTTP GET, DNS resolve, NTP time sync
Audio AC97 βœ… PCM output via SYS_AUDIO_PLAY syscall
Input PS/2 Keyboard βœ… Scancode-based, shell + app input
Input PS/2 Mouse βœ… Relative tracking, click detection
PCI PCI Bus Scan βœ… Vendor/device ID enumeration
Timer PIT (8253) βœ… 50 Hz tick, get_time_ms()
Serial COM1 βœ… Early boot log + QEMU debug output

πŸ–₯ Built-in Applications

The OS ships a full desktop environment with the following apps:

App Description
Terminal Interactive shell with command history and kernel log streaming
Explorer Graphical file manager β€” lists FAT32/EXT2 files, launches ELF executables
Notepad Text editor with disk save support (NOTES.TXT β†’ FAT32/EXT2)
Paint Drawing app with Bresenham line algorithm + BMP export to disk
System Monitor Real-time RAM usage bar and process overview

External Applications (userspace ELF)

App How to launch Description
snake.elf Explorer / run snake.elf Classic snake game
bmpview.elf run bmpview.elf BG.BMP BMP image viewer
htmlview.elf Explorer HTTP browser (no HTTPS)
niplay.elf run niplay.elf terry.wav WAV music player via AC97
widget_demo.elf Explorer EID v2.0 widget showcase (button / checkbox / text input / slider + animations)
ipc_test.elf Explorer Pipe & message-queue smoke test (syscalls 60–67)
doom.elf Explorer DOOM port with AC97 audio

πŸ’‘ The desktop / system shell itself is now the separate enGUI project, pulled in as the app/sysgui Git submodule and launched as the Ring 3 init process (bin/sysgui.elf). Older versions had Lua (luagui.elf) bundled β€” Lua was removed from the SDK and app set.


⌨️ Developer API (EquinoxOS SDK)

Applications are ELF64 binaries linked at 0x1000000, built with the bundled SDK. All kernel services are accessed via int 0x80.

Syscall Table

RAX Name Description Key Args
1 SYS_PRINT Write string to terminal + serial rdi: char* msg
2 SYS_READ_FILE Map file from VFS into user RAM rdi: name, rsi: size_out
3 SYS_WRITE_FILE Save buffer to VFS (FAT32/EXT2) rdi: name, rsi: buf, rdx: size
5 SYS_DRAW_BUFFER Blit pixel buffer to compositor window rdi/rsi: x/y, rdx/rcx: w/h, r8: buf
7 SYS_GET_MOUSE Get mouse X/Y/buttons from kernel rax: X, rbx: Y, rcx: buttons
9 SYS_GET_SCANCODE Pop keyboard scancode (non-blocking) β€”
10 SYS_EXIT Terminate process, reclaim RAM rdi: exit_code
12 SYS_GET_FONT Map PSF font pointer into user space β€”
20 SYS_AUDIO_PLAY Submit PCM chunk to AC97 driver rdi: buf, rsi: size

EID v2.0 β€” Immediate Mode GUI Toolkit

EquinoxOS includes EID (Equinox Interface Designer) β€” an immediate-mode UI toolkit that gives apps full control over their visual style.

#include <eid.h>
#include <equos.h>

eid_ctx_t ui;
uint32_t buffer[400 * 300];

void render() {
    eid_begin(&ui, buffer, 400, 300);
    ui.mx -= win_x;  // Map global β†’ window-relative coords
    ui.my -= win_y;

    uint32_t id    = eid_get_id("OK", 50, 120);
    uint32_t state = eid_process_interaction(&ui, id, 50, 120, 100, 36);

    uint32_t col = (state & EID_STATE_HOVER) ? 0x00FFFF : 0x006666;
    if (state & EID_STATE_ACTIVE) col = 0xFFFFFF;

    eid_draw_rect(buffer, 400, 300, 50, 120, 100, 36, col);
    eid_draw_text(buffer, 400, 300, 68, 130, "OK", 0x000000);

    if (state & EID_STATE_CLICKED) { /* handle */ }
    eid_end(&ui, win_x, win_y);
}

πŸ“– See EID_SDK.md for the full API reference, drawing primitives, and best practices.


πŸ“‚ Project Structure

EquinoxOS/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ kernel.c                     # kmain() β€” boot entry, subsystem init
β”‚   β”œβ”€β”€ api.h                        # EquinoxAPI struct (app ↔ kernel contract)
β”‚   β”œβ”€β”€ boot/limine/                 # Limine protocol headers
β”‚   β”œβ”€β”€ gui/
β”‚   β”‚   β”œβ”€β”€ gui.c / gui.h            # Compositing Window Manager
β”‚   β”‚   β”œβ”€β”€ gui_apps.c               # Built-in app UIs (Paint, Notepad, Explorer…)
β”‚   β”‚   └── terminal.c               # Shell terminal widget
β”‚   β”œβ”€β”€ syslibc/                     # Kernel-side stdio + string helpers
β”‚   └── system/
β”‚       β”œβ”€β”€ core/                    # GDT, IDT, PIC, interrupt stubs (NASM)
β”‚       β”œβ”€β”€ mem/
β”‚       β”‚   β”œβ”€β”€ pmm.c                # Bitmap Physical Memory Manager
β”‚       β”‚   β”œβ”€β”€ vmm.c                # 4-level Virtual Memory Manager
β”‚       β”‚   β”œβ”€β”€ memory.c             # kmalloc / kfree heap
β”‚       β”‚   └── shm.c                # Shared Memory
β”‚       β”œβ”€β”€ usr/
β”‚       β”‚   β”œβ”€β”€ task.c               # Scheduler + context switch
β”‚       β”‚   └── syscall.c            # int 0x80 dispatch table
β”‚       β”œβ”€β”€ fs/
β”‚       β”‚   β”œβ”€β”€ vfs.c / vfs.h        # Virtual File System abstraction
β”‚       β”‚   β”œβ”€β”€ fat32.c              # FAT32 driver (R/W)
β”‚       β”‚   β”œβ”€β”€ ext2.c               # EXT2 driver (R/W)
β”‚       β”‚   └── elf.h                # ELF64 loader structures
β”‚       β”œβ”€β”€ drivers/
β”‚       β”‚   β”œβ”€β”€ vesa/                # VESA LFB, BMP encoder, PSF font
β”‚       β”‚   β”œβ”€β”€ devices/
β”‚       β”‚   β”‚   β”œβ”€β”€ audio/ac97.c     # AC97 PCM audio driver
β”‚       β”‚   β”‚   β”œβ”€β”€ keyboard/        # PS/2 keyboard (scancodes)
β”‚       β”‚   β”‚   β”œβ”€β”€ mouse/           # PS/2 mouse (relative tracking)
β”‚       β”‚   β”‚   β”œβ”€β”€ pci/             # PCI bus scan
β”‚       β”‚   β”‚   └── pcspeaker/       # PC Speaker beeper
β”‚       β”‚   └── hardware/
β”‚       β”‚       β”œβ”€β”€ net/             # RTL8139 Β· ARP Β· IPv4 Β· TCP Β· UDP Β· DNS Β· HTTP Β· NTP
β”‚       β”‚       β”œβ”€β”€ disk/            # ATA PIO disk driver
β”‚       β”‚       └── serial/          # COM1 serial (QEMU log)
β”‚       β”œβ”€β”€ misc/timer.c             # PIT 8253 timer
β”‚       └── shell/                   # Shell command parser
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ snake.c                      # Snake game
β”‚   β”œβ”€β”€ bmpview.c                    # BMP image viewer
β”‚   β”œβ”€β”€ htmlview.c                   # HTTP browser
β”‚   β”œβ”€β”€ niplay.c                     # WAV music player
β”‚   β”œβ”€β”€ widget_demo.c                # EID v2.0 widget showcase
β”‚   β”œβ”€β”€ ipc_test.c                   # Pipe + message-queue test app
β”‚   β”œβ”€β”€ sysgui/                      # enGUI submodule (Ring 3 init process)
β”‚   └── doom/                        # DOOM port (doomgeneric)
β”œβ”€β”€ sdk/
β”‚   β”œβ”€β”€ include/                     # equos.h, eid.h, eid_ext.h, stb_truetype.h, libc headers
β”‚   β”œβ”€β”€ lib/                         # CRT0 (_start), syscall stubs, libc bits, eid + eid_ext
β”‚   └── codec/                       # WAV/audio codec helpers
β”œβ”€β”€ iso_root/                        # Bootable ISO staging area
β”‚   β”œβ”€β”€ sys/kernel.elf
β”‚   β”œβ”€β”€ bin/                         # Compiled ELF userspace apps
β”‚   └── res/                         # Fonts, wallpapers, assets
β”œβ”€β”€ Makefile                         # Windows build (mingw/msys2 cross-compiler)
β”œβ”€β”€ Makefile-linux                   # Linux build
β”œβ”€β”€ WINDOWS_ext2.py                  # Python script β€” generates hdd.img (EXT2)
β”œβ”€β”€ EID_SDK.md                       # Full EID + Syscall reference
└── ROADMAP.md                       # Development phases & milestones

πŸš€ Quick Start

Prerequisites

Tool Purpose
x86_64-elf-gcc Cross-compiler (freestanding, no stdlib)
nasm Assembler for interrupt stubs & CRT0
x86_64-elf-ld Linker
xorriso ISO image creation
python3 EXT2 disk image generation
qemu-system-x86_64 Virtual machine for testing

Build & Run

# 1. Clone the repo
git clone https://github.com/Equinox-Collective/EquinoxOS.git
cd EquinoxOS

# 2. Build kernel + all apps + create ISO + HDD image
make all

# 3. Launch in QEMU (512 MB RAM, RTL8139, AC97 audio)
make run

Windows users: Use the Makefile (tested with msys2/mingw toolchain).
Linux users: Use Makefile-linux.

Individual Build Targets

make kernel.elf   # Build kernel only
make apps         # Build all userspace ELF apps
make doom.elf     # Build DOOM port
make iso          # Package bootable ISO
make create_hdd   # Generate hdd.img (EXT2) via Python script
make clean        # Remove all build artifacts
make cleanrun     # clean + all + run

Debugging

# addr2line to map a fault RIP to source
x86_64-elf-addr2line -e kernel.elf <RIP_ADDRESS>

# QEMU serial log is written to qemu.log automatically
# and streamed to stdout via -serial stdio

The kernel outputs a full boot log to COM1 (visible in QEMU terminal):

=== EquinoxOS Kernel Starting ===
HHDM offset initialized
GDT initialized  |  SSE initialized  |  PMM initialized
VMM initialized  |  Heap initialized |  VESA initialized
IDT initialized  |  PIC remapped     |  Timer initialized
Task system initialized  |  VFS initialized
FAT32 initialized  |  EXT2 initialized
PCI initialized  |  GUI initialized  |  Shell initialized
=== EquinoxOS Ready ===

πŸ—Ί Roadmap

Full details in ROADMAP.md Β· recent patch set: CHANGES.md

βœ… Completed

  • x86_64 Higher Half kernel via Limine (HHDM)
  • Bitmap PMM + 4-level VMM + 64 MB kernel heap
  • Preemptive Round-Robin scheduler (IRQ0 / PIT 50 Hz)
  • Ring 3 user mode with isolated per-process address spaces
  • GDT / IDT / TSS β€” proper kernel+user segments
  • ELF64 loader β†’ Ring 3 jump (CRT0)
  • Syscall interface (int 0x80) β€” 30+ calls (print, file R/W, draw, mouse, kbd, exec, audio, net, shm, pipes, mqueue, …)
  • VESA LFB with compositing WM, alpha shadows, z-ordering
  • ATA PIO + FAT32 R/W + EXT2 R/W (stress-tested) + VFS abstraction
  • RTL8139 NIC + full happy-path TCP/IP stack (ARP, IPv4, ICMP, TCP, UDP, DNS, NTP, HTTP GET)
  • AC97 PCM audio driver
  • PS/2 keyboard & mouse, PCI bus scan, COM1 serial debug
  • Shared Memory (shm_alloc)
  • PSF font rendering (loaded from /res/font.psf)
  • HAL skeleton β€” hal_display_ops_t / hal_input_ops_t / hal_block_ops_t registry with adapters for VESA, PS/2, ATA PIO
  • GPT partition table parser (UTF-16 names, header validation; CRC32 still TODO)
  • Sync primitives β€” spinlock, waitqueue, sleeping mutex, counting semaphore
  • IPC β€” kernel pipes (4 KB ring buffer) + priority message queues + syscalls 60–67
  • PSF2 font renderer in the kernel (variable glyph width, Unicode, UTF-8 decoder)
  • EID v2.0 widget set β€” button / checkbox / text input / slider + animation helper (linear / quad / cubic easing)
  • enGUI spun out as a Git submodule (app/sysgui) and launched as the Ring 3 init process
  • DOOM port with AC97 audio Β· HTTP browser (htmlview.elf) Β· WAV player (niplay.elf)

πŸ”§ In Progress / Planned

  • AHCI/SATA driver (slot into the HAL block interface, retire ATA PIO)
  • VFS file descriptors (open / read / write / close, seek, stat) and pipe VFS nodes
  • EXT2 indirect / double-indirect / triple-indirect blocks (large files)
  • GPT CRC32 verification + multi-partition VFS mount
  • SSE/AVX-accelerated compositing (needs FXSAVE/FXRSTOR on context switch)
  • Real-time blur (Gaussian/Box) and WM-level window animations
  • Kernel-side TrueType rendering (userspace stb_truetype.h already in SDK)
  • Cross-process shared memory for GUI event streaming
  • Port mlibc / newlib as a full libc β†’ self-hosting (TCC / GCC inside the OS)
  • Shell scripting, env vars, native piping via kernel pipes
  • DHCP client + DNS cache, full TCP state machine with retransmission, POSIX socket syscalls
  • HTTPS (BearSSL / mbedTLS port) + RNG + cert store
  • USB stack (UHCI / EHCI / xHCI)
  • Intel HD Audio driver and multi-stream software mixer
  • Native EquinoxFS format + installable ISO that writes the OS to disk

Screenshots

EquinoxOS Desktop EquinoxOS GUI Apps EquinoxOS Explorer EquinoxOS on real hardware

πŸ‘₯ Contributors

Handle Role
πŸ‘‘ @ewasion137 Lead Developer
⭐ @oxtiskz Special Thanks (account deleted)
⭐ @gobgolaxi Contributor
⭐ @Offihito Contributor
⭐ @Lertov2424232 Contributor

License: GPL-2.0 Stars Forks Last Commit

Built from scratch, for the love of low-level programming.

About

EquinoxOS: x86-based Operating System.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors