Skip to content

Repository files navigation

Cookie OS

A bare-metal x86 operating system and a high-fidelity web-based simulator, featuring a custom Rust kernel and a #![no_std] 3D raycaster game inspired by DOOM.

Features

Custom Kernel

  • Language: Rust (#![no_std], bare-metal).
  • Architecture: x86_64.
  • Memory Management: Physical and virtual memory management.
  • Privilege Levels: Ring 3 transitions.
  • Interrupts & System Calls: GDT/IDT management and an MSR-based Syscall interface.
  • Drivers: Custom VGA display driver and PS/2 keyboard driver.
  • File System: Basic FAT12 file system reader to load executables from disk.

User-Space Application (doom_game)

  • A standalone 3D raycaster game running entirely in user-space (Ring 3).
  • Communicates with the kernel via custom syscalls for display output and keyboard input.
  • Written in #![no_std] Rust.

High-Fidelity Web Simulator

  • An interactive, browser-based simulator built with HTML, CSS (Vanilla), and JavaScript.
  • Desktop UI: A dynamic and responsive visual interface mimicking a retro-futuristic desktop environment.
  • Virtual CPU & FAT12 Inspector: Live views of CPU registers and disk contents.
  • Web Raycaster: A JavaScript implementation of the 3D raycaster game, playable directly in the browser.

Build Pipeline

  • Automated build process driven by Cargo (build.rs) and Python (build_disk.py).
  • Compiles the kernel and user-space binaries.
  • Packages them into a bootable 1.44MB FAT12 disk image (fat_disk.img).

Getting Started

Prerequisites

  • Rust Toolchain: Nightly Rust with x86_64-unknown-none target.
  • Python 3: For running the disk image build script.
  • QEMU: To boot and test the generated disk image locally.
  • Node.js: (Optional) For running the local web server to host the simulator.

Building the OS

  1. Ensure your Rust environment is set up for cross-compiling. The project uses a custom target x86_64-antigravity_os.json.
  2. Run the build script to compile the kernel and the doom game, and generate the disk image:
    python build_disk.py
  3. The script will generate fat_disk.img.

Running in QEMU

You can run the OS using cargo run, which is configured (via .cargo/config.toml and .cargo/runner.ps1) to launch QEMU:

cargo run

Or you can manually start QEMU with the generated disk image:

qemu-system-x86_64 -drive format=raw,file=fat_disk.img

Running the Web Simulator

To experience the web-based simulator:

  1. Start a local development server in the root directory:
    npm run dev
    # or simply
    npx serve .
  2. Open your browser and navigate to the provided localhost URL (e.g., http://localhost:3000).

Architecture & Code Structure

  • src/: Kernel source code, including memory management, VGA driver, and syscall interface.
  • doom_game/: User-space 3D raycaster implementation.
  • build_disk.py: Script to generate the FAT12 disk image.
  • index.html, style.css, app.js: The web simulator frontend.
  • .cargo/: Configuration for building and running the OS via QEMU.
  • x86_64-antigravity_os.json: Custom target specification for the kernel.

License

MIT License

About

A bare-metal x86 operating system and a high-fidelity web-based simulator, featuring a custom Rust kernel and a #![no_std] 3D raycaster game inspired by DOOM

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages