u/thatmagicalcat

▲ 732 r/rust

I started working on this little project on 9th March this year. It's been an incredible journey!

It started with a question of "how hard could it be?" and just yesterday I finally hit the ultimate milestone: IT RUNS DOOM!

Details:

  • Github repo: https://github.com/thatmagicalcat/magicalos
  • Architecture: x86_64
  • Language: Rust (with two C dependencies)
  • Bootloader: Limine (initially i was using GRUB/multiboot2 and later i realized it is such a pain in the back)
  • C standard Library: mlibc

link to YouTube video: https://youtu.be/xVSqd90Xpos?si=mXFQHOzxMLhDzwFY

building an OS in Rust feels like having a superpower, cargo is so awesome! and the amount of "stupid" bugs the compiler caught before i even hit the metal is probably the only reason i haven't lost all of my hair yet :p

i even wrote a little async runtime in MagicalOS and the way rust handles concurrency is honestly mind-blowing for me

I already loved rust, but this project made me love rust even more!

I would love to hear your thoughts or answers any questions!

u/thatmagicalcat — 13 days ago
▲ 1.1k r/Btechtards+1 crossposts

So i started working on this little project on 9th March this year during my board exams (probably not the best timing, i know TT). It's been an incredible journey!

It started with a question of "how hard could it be?" and just yesterday I finally hit the ultimate milestone: IT RUNS DOOM!

I made a post on X yesterday and the response was insane, so i wanted to share the technical details here!

  • Github repo: https://github.com/thatmagicalcat/magicalos
  • Architecture: x86_64
  • Language: Rust (with two C dependencies)
  • Bootloader: Limine (initially i was using GRUB/multiboot2 and later i realized it is such a pain in the back)
  • C standard Library: mlibc

Porting doom:

  • VESA Framebuffer: Linear Framebuffer (LFB) initialized via the bootloader
  • Virtual Device: I had to create a device node in my Virtual File System (VFS) so that the userspace programs can access framebuffer and keyboard
  • Rendering: The program opens /dev/fb0 and then mmap it to get a pointer to the LFB. Implemented DG_DrawFrame() function provided by doomgeneric, it essentially copies the pixel data over to the mmap'ed LFB
  • Input: I already had a little PS/2 keyboard driver, i had to create a keyboard event device in my Virtual File System (VFS) which the user program can access by opening /dev/kbd

It's still a work in progress but seeing the game DOOM running flawlessly on a kernel I made myself in rust is an unmatched feeling.

I would love to hear your thoughts or answers any questions!

u/thatmagicalcat — 13 days ago