pefiaOS , a bare-metal x86 operating system with a graphical shell
- 6 Devlogs
- 41 Total hours
I am building an x86 OS from scratch using C, with some included apps.
I am building an x86 OS from scratch using C, with some included apps.
67 hours !!!!!!!!
This update was mainly about improving the web browser and fixing bugs I found across the OS.
The browser is now much more capable than before. I added a much better CSS engine, a lot more JavaScript features, proper form support with POST requests, cookies, animated GIFs, media placeholders, and lots of networking improvements. I also changed the homepage to DuckDuckGo Lite, so you can actually search the web from inside pefiaOS.
I also fixed several kernel bugs, including memory corruption issues, framebuffer bugs, safer memory management, more reliable timing, and network driver improvements.
Building the OS is easier now too. If you don’t have the cross compiler installed, it can now use your system GCC instead. I also improved VM compatibility by adding better diagnostics when booting with the wrong firmware.
There is still a lot I want to add, like UTF-8 support, certificate verification, paging, and user mode, but this is the biggest browser update pefiaOS has had so far.
This update was mostly focused on replacing a lot of the “fake OS” parts with real operating system infrastructure.
The biggest milestone was getting interrupts working. I added my own GDT, built an IDT with exception and IRQ handlers, remapped the PIC, programmed the PIT to 100 Hz, and implemented kernel threads with a handwritten x86 context switch. The scheduler is still cooperative because the heap and window manager aren’t thread safe enough for preemption yet, but background threads can finally run independently.
I also wrote an ATA PIO driver capable of reading and writing real IDE disks using LBA28 addressing. On top of that I rewrote the VFS into a writable, heap-backed filesystem, so applications can now create, modify and delete files instead of relying on a compile-time file table. Persistence is still missing, but FAT32 can now be built on top of the driver.
The desktop gained a lot of new functionality too. The code editor now supports syntax highlighting and line numbers, the terminal gained proper filesystem commands like mkdir, touch, rm, cat, echo > file, and ps, and I added both C and Python-style interpreters using the same recursive descent expression engine.
Graphics also received a major upgrade. The desktop now runs at 1920x1080 and I replaced the old 1-bit bitmap font with grayscale anti-aliased glyphs generated from Consolas. The renderer blends glyph coverage into the framebuffer, making text much easier to read without changing any existing layouts.
I also improved the desktop itself with window snapping, a scrollable Start menu, a live Settings app for themes and system settings, interactive browser text inputs, and a number of browser rendering improvements including larger page support and faster text drawing.
The hardest part was getting all these systems working together. Interrupts initially caused repeated triple faults because my descriptor tables were wrong, the scheduler had to coexist with the existing window manager, and changing the VFS meant updating almost every built-in application.
To make sure nothing regressed, I added a boot self-test that verifies the interpreter, writable VFS, scheduler, timer interrupts and ATA disk driver every time the OS starts.
Things I’d love people to test:
This update doesn’t add one huge feature, but it lays the groundwork for the next major milestones: paging, user-mode processes, ELF loading, and a persistent filesystem.
This week I added two new games (Snake and Breakout, bringing the total to seven), expanded the shell with new built-ins and command history, and cleaned up the build system. Everything boots and runs in QEMU.
The ring buffer approach makes movement O(1) instead of O(n):
uint16_t s_body[SN_CAP]; /* ring buffer of cell indices */
int s_head, s_len;
Input and movement run on separate clocks. Input latches every 33 ms, movement every 130 - 4×score ms (minimum 60 ms). This way no keypresses drop and difficulty scales naturally.
The grid is 16 pixel cells, clamped to window size. Apples spawn via rejection sampling. Filling the entire board wins the round.
26.6 fixed point physics handles shallow angles that integer pixels would quantise to zero. Paddle english depends on where you hit it:
int off = bx - g->k_px;
g->k_bvy = -g->k_bvy;
g->k_bvx = (off << 6) / (pw / 6);
Ball starts stuck to the paddle, launches with Space. Three lives, then game over.
Adding two games touched almost no window-manager code. Two enum entries in games.h, two lines per dispatch switch in games.c, and the Start menu entry in taskbar.c. The WM handles everything else automatically.
Added five new built-ins: free, uptime, history, ver, and fixed echo to print blank lines. Terminal got uptime too.
#define PEFIA_VERSION "pefiaOS 0.3 (Stardance)"
All three places that display version now build from this single define.
Fixed header dependency tracking:
CFLAGS += -MMD -MP
-include $(OBJS:.o=.d)
Editing a header now correctly rebuilds only the objects that include it. Cleaned up boot.asm trailing whitespace too.
Verified in my virtual machine: both games launch and play correctly, Terminal shows the new version string, all shell commands work.
Seven games on a kernel I wrote from scratch!! :D
This update was all about making pefiaOS capable of running real time applications. The desktop was originally designed around event driven apps, so games needed quite a bit of work before they were even possible.
Once those were working, I had to answer the obvious question: can it run DOOM? It turns out it can. I integrated PureDOOM by writing a platform layer that hooks the engine into my own memory allocator, timer, input system, framebuffer, and virtual filesystem. Since there’s no disk driver yet, the shareware WAD is embedded directly into the kernel, meaning DOOM now runs inside a normal desktop window on pefiaOS itself. Seeing the real 1993 DOOM running on an operating system I built from scratch has easily been one of the most rewarding moments of the project so far, and it also kinda shows that it can do something cool too, not just boring kernels and such.
PefiaOS Browser Engine Update - 12:35AM
⸻
Bug Fix
⸻
Result
I have currently written the operating system from scratch, created a GUI (Graphical User Interface) and a window manager. I have apps such as a terminal with Linux-inspired commands and a working Browser written from scratch! Google doesn’t serve plain HTTP anymore, so getting to google.com meant implementing modern cryptography inside my own kernel. I ended up writing SHA-256, HMAC/HKDF, AES-128-GCM and X25519 myself before finally getting the handshake to complete. Most of the debugging came down to tiny mistakes—one incorrect byte somewhere could make the whole connection fail. Once that finally worked, I could build the browser on top of it. Right now it has a basic HTTP client and a renderer that supports enough HTML and CSS to display text with word wrapping, links and scrolling.