Skip to content

YemotaY/glowieStopper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

glowieStopper

DISCLAIMER: Terry davis did say a lot of weird things. This here should admire his programming skills not his crude racism speeches.. Genius and madness are fare closer together than we think.

Status: qemu booteable

A fully self-contained operating system built from first principles.

No external dependencies. No C, no Python, no borrowed code. Everything from scratch.

Inspired by TNC yemotay/tnc — same trust-root philosophy: a tiny, hand-auditable hex blob bootstraps the full toolchain via POSIX sed+printf as the one escape hatch.

What is glowieStopper?

glowieStopper is an x86_64 operating system where every component — bootloader, kernel, language, compiler, standard library, networking stack, and GUI — is designed and implemented from zero. The system bootstraps from ~657 bytes of hand-typed hex and evolves into a fully self-hosting environment.

Quick Start

# Rebuild every binary in the repo from hex + prove byte-identity.
./bootstrap/verify.sh

# Build the bootable disk image.
./bootstrap.sh

# Run in QEMU with serial console + RTL8139 NIC.
qemu-system-x86_64 \
  -drive file=build/glowieStopper.img,format=raw \
  -serial stdio \
  -netdev user,id=n0 \
  -device rtl8139,netdev=n0

# Ctrl+P inside QEMU = shutdown.

Compilation Pipeline (source → running image)

# Run toolchain self-tests + build the source-level MBR demo.
./tbuild.sh demo

# Watch it print from QEMU over serial.
qemu-system-x86_64 -drive file=build/mbr_serial.img,format=raw \
                   -serial stdio -display none
# => glowieStopper tasm0 OK

./tbuild.sh drives the full pipeline:

source.s  --(tasm0)-->  hex  --(seed)-->  bootable.img  -->  QEMU

Both tasm0 and seed are our own tools (shell + awk, and a 331-byte hand-crafted ELF respectively). No external assembler, no C, no Python.

Usable OS demos (all source-compiled)

Demo Source What it does
mbr_hello.img boot/mbr_hello.s Prints a banner via BIOS teletype.
mbr_serial.img boot/mbr_serial.s Prints a banner over COM1.
login.img boot/login.s Interactive password prompt, login loop.
os.img boot/os.s Login + PCI bus scan — detects the RTL8139.
shell.img boot/shell.s Login + tsh (tiny shell), multi-sector boot.
desktop.img boot/desktop.s v0.3: env vars, scripts, TUI IDE, 3-strike login lockout.

Boot the shell:

./tbuild.sh boot/shell.s build/shell.img
qemu-system-x86_64 -drive file=build/shell.img,format=raw
# password: glowie
# tsh$ help
#   help  echo  clear  ver  uptime  mem  pci  reboot  halt  logout

The shell supports line editing (backspace), first-word command dispatch via a {name_ptr, handler_ptr} table, and handlers for BIOS keyboard/video, BIOS tick counter, BIOS memory-size call, PCI config-space I/O, and warm reboot. Stage 1 is a 512-byte MBR that reads stage 2 from disk via int 0x13; stage 2 lives at 0x7E00 and contains all shell logic.

Boot the v0.3 desktop:

./tbuild.sh boot/desktop.s build/desktop.img
qemu-system-x86_64 -drive file=build/desktop.img,format=raw
# password: glowie                 (3 strikes → hard halt)
# tsh$ set FOO bar                 (env store, 32 slots × 64 B at 0x0600)
# tsh$ get FOO                     → bar
# tsh$ env                         → FOO=bar ...
# tsh$ run hello                   (run a built-in script)
# tsh$ ide                         (full-screen TUI editor)
#      F2=save  F5=run  F10=quit   (edits are a runnable shell script)

The IDE paints directly to VGA text memory at segment 0xB800: grey title bar on row 0, blue body (rows 1..22, white text), blue status line on row 23, grey legend on row 24. F5 saves the current buffer into the user script slot and immediately re-enters the shell running each line.

Hardening in v0.3:

  • gets() is bounded to 62 payload chars; keystrokes past that are silently dropped. No buffer overruns from a long password line.
  • Failed login attempts are counted; 3 strikes → halted forever.
  • The input buffer is zeroed after every password comparison.
  • The env store (2 KiB), script buffer (2 KiB) and lockout counter are all explicitly zeroed at boot before being used.
  • Non-printable characters are rejected by the IDE insert path.

The Trust Chain

tools/hex2bin.hex  ──(sed + printf)──▶  build/tools/hex2bin
          │
          ▼
toolchain/seed/seed.hex  ──(hex2bin)──▶  build/tools/seed
          │
          ▼
boot/image.hex   ──(seed)──▶  build/glowieStopper.img
  • bootstrap/hex0_build.sh — ~30 lines of POSIX shell, the one escape hatch.
  • bootstrap/verify.sh — rebuilds every committed binary from hex and checks byte-identity. If this passes, you have a clean trust root.

Hand-typed bytes of trust: 657 (326 for hex2bin + 331 for seed). There is no Python, no C, no GNU Make, no external assembler anywhere.

See docs/BOOT_GUIDE.md for the boot guide and docs/ROADMAP.md for the definitive checklist.

Networking

The kernel ships with a real (not stubbed) networking stack in TerryLang, awaiting tlc to compile:

  • kernel/pci/pci.tl — PCI configuration-space enumeration
  • kernel/drivers/rtl8139.tl — Realtek RTL8139 NIC driver
  • kernel/net/ethernet.tl — Ethernet II framing
  • kernel/net/arp.tl — ARP with 32-entry LRU cache (RFC 826)
  • kernel/net/ipv4.tl — IPv4 + ICMP echo + UDP (RFC 791/792/768)
  • kernel/net/tcp.tl — minimal TCP
  • kernel/net/net.tl — stack orchestration

Default config matches QEMU user-mode: 10.0.2.15/24 via 10.0.2.2.

Safety

  • Ring-3 userspace via SYSCALL/SYSRET (kernel/security/ring3.tl)
  • SMEP + SMAP; copy_from_user/copy_to_user bracket with stac/clac
  • NX, CR0.WP, canonical-address validation for user pointers
  • Per-process address spaces (planned — see ROADMAP)

Future (once toolchain is self-hosting)

# Bootstrap the toolchain from hex seed (one-time)
tbuild bootstrap

# Build everything
tbuild all

# Run test suite
tbuild test

Components

Component Directory Description
Bootloader boot/ 3-stage bootloader: Real→Protected→Long mode
Kernel kernel/ Hybrid kernel with preemptive multitasking
tLang lang/ Custom systems programming language
Toolchain toolchain/ Assembler (tasm), Compiler (tlc), Linker (tlink)
Standard Library lib/ libt — full standard library for tLang
GUI gui/ Framebuffer-based windowing system
Userspace user/ Shell, editor, and core utilities

Architecture

See ARCHITECTURE.md for the complete design document.

Building

glowieStopper bootstraps in phases:

  1. Phase 0: Seed assembler (hand-crafted hex) → tasm assembler
  2. Phase 1: Bootloader assembled with tasm
  3. Phase 2: Kernel compiled with bootstrap tlc compiler
  4. Phase 3: Full toolchain self-hosts on glowieStopper
  5. Phase 4: Everything rebuilds from source on glowieStopper itself

Afterword:

RESPECT EVERYONE, HELP WHERE EVER POSSIBLE, BE A GOOD HOOMAN! PLEASE!

MIT License!

About

A fully self-contained operating system built from first principles.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages