r/osdev

▲ 25 r/osdev+2 crossposts

hi!
i made a memory allocation library/learning resource. i wanted to learn more about them and i couldn't find one comprehensive source of knowledge, so i decided that i'll make one of my own:].
it currently has these basic allocator types: arena (linear), stack, pool, free list, free tree, tracking, buddy, slab.
i gave my best to describe everything clearly in the readme, also added svg diagrams (written in Typst, btw). i plan to implement a bucket/size-segregated free list allocator as well.
hoping anyone will find this resource useful!
https://github.com/nihiL7331/oo-alloc

u/Financial_Travel_543 — 5 hours ago
▲ 23 r/osdev+1 crossposts

Do you know any not POSIX compliant OS that tries to do things differently?

Hello, it appears to me like the whole world is focused around making OSes that are all POSIX compliant. That means that they are basically the same, with a few personal touches here an there. My question is if there is some project that attempts to do something different, putting new ideas on the table.

reddit.com
u/ZenitDS — 12 hours ago
▲ 12 r/osdev

ZenOS: SMP Preemptive operating system project

Screenshot (Taken In-OS)

Screenshot (Taken In-OS)

Boot Screen

It is an operating system I am working on since 2 - 3 years.

It has got quite a lot of features now, and I have just released it's first version today.

Hence decided to post about its existence here.

Links: GitHub

It also has a package repository (Zen can download from the internet, basic HTTP/1.0)

It is a fully-from-scratch OS, with around 100 syscalls (i know thats massive), and most of the beauty is in the userland, it has a Window manager, Harp, and around 30 applications total.

It is Multicore, multithreading, preemptive (RR), supports disk, PS/2, USB, networking, and a lot more.

It has many ports such as BusyBox, Doom, Figlet, Lua, FreeType, etc. It boots up in <1 second. Am currently working on porting ClassiCube (yay)

Runs on mlibc, and follows the "Everything is a file" philosophy a bit. All programs are run from disk, with full disk support and FatFs.

Here's an excerpt from the README :

Kernel

  • - 64-bit x86_64 monolithic kernel
  • - Symmetric Multiprocessing (SMP)
  • - Preemptive round-robin SMP scheduler
  • - ELF64 userspace execution
  • - Dynamic loader
  • - Unix-style process model
  • - High-resolution timing via HPET
  • - ACPI-based hardware discovery and power management

Syscalls

  • 100+ POSIX-compatible / custom syscalls covering major app and C library needs.

Hardware & Drivers

  • - Framebuffer output
  • - PS/2 keyboard and mouse
  • - USB HID keyboard and mouse (xHCI)
  • - PC speaker
  • - Serial port for debugging and logging
  • - Local APIC and IOAPIC interrupt handling
  • - ATA disk driver (DMA/PIO, 28-bit LBA)
  • - PCI bus
  • - Intel e1000 Ethernet driver
  • - RTC, HPET

Networking

  • - TCP/IP stack
  • - DNS resolution
  • - **zen** — a package manager that fetches and installs packages over HTTP
  • - **wget** — downloads files over HTTP/1.0

Filesystem

  • - VFS layer with support for multiple mountpoints
  • - FAT32 via a port of [FatFs](https://elm-chan.org/fsw/ff/) by CHAN
  • - Native host-side disk image tooling (`fat_man`)

Userspace & Libc

Applications

I/O & Display

reddit.com
u/Rishies2010 — 12 hours ago
▲ 78 r/osdev

Added ext2/ext3 driver to my OS!

Finally got around to adding support for ext2/ext3 support to my operating system. Decided to go with read only for now as the intent is to get content from other OSes into Retro Rocket not the opposite.

Well worth a couple of hours effort, for one the spec was clean, straightforward and didnt contradict itself. Compare that to FAT32, and the difference is amazing...

u/braindigitalis — 1 day ago
▲ 0 r/osdev

Я разрабатываю свою ос, мне нужны идеи и помощь.

Всем привет, я пишу здесь об этом так как не знаю что добавить. Я делаю собственное ядро на VoidLang основанном на C++, но оно немного кривое, пока что работоспособных прототипов нет (кроме Linux дистрибутива созданного мной 2 месяца назад, в самом начале проекта основанного на спор), вот некоторые изменения файловой системы:

***.vx (ранее .void, это исполняемые файлы по типу .exe)***
***.vkr (новые файлы, модули ядра)***
***.vsec (системы безопасности)***
***.vdat (контейнеры данных вместо .vd)***
***.varc (ранее .xsr, разница в том что новые не сжимают файлы, как можно понять является архивом)***
***.vcfg (файл конфиги)***
***.vme (ранее .vud, файл пользователя)***
***.vsav (файл сохранений)***
***.vth (файл темы)***
***.vlog (файл для логов системы и приложений)***
***.vfn (файл для шрифта)***
***.vsh (скрипты)***
***.vai (файл для ИИ модулей на будущее)***

Дополнительно:

Спасибо всем, кто даёт обратную связь. Чтобы сразу снять возможные вопросы и избежать путаницы, поясняю главные технические моменты, которые уже всплывали в других обсуждениях:

  1. Мой VoidLang (HolyVoid) — это не LLVM-проект и не клон C.
    Я не использую сторонние компиляторы для продакшена. Мой язык базируется на синтаксисе C++, но это самописный транслятор, который я называю HolyVoid. Сейчас для прототипирования он конвертирует код (.vc) напрямую в чистый C++, который потом собирается GCC. Это временная мера, чтобы отладить синтаксис. В финальной версии транслятор будет генерировать сразу готовый .vx-файл (мой исполняемый формат) напрямую в байт-код, минуя GCC и LLVM. Никакой LLVM на целевом железе не нужен.
  2. Почему не GCC, не Clang и не общепринятые форматы.
    Я пишу не просто софт, а закрытую экосистему. Каждый файл в ней (.vx, .vkr, .vdat) имеет не только расширение, но и вшитую цифровую подпись. Ядро просто не запустит код, если он не подписан моим ключом разработчика. Использование чужих открытых форматов (ELF, PE) ломает эту модель безопасности на корню. Поэтому все форматы свои.
  3. «Всратость» форматов — это осознанный архитектурный выбор.
    Новые форматы (.vx, .vkr, .vdrv, .vfeel, .vsoul, .vdat, .varc, .vcfg, .vme, .vsav, .vth, .vlog, .vfn, .vsh, .vai) — это не рандомный список. Каждый тип имеет свою структуру заголовка с магическим числом и своё место в системе. Драйверы разделены на классы (.vdrv для стандартных устройств, .vfeel для сенсоров, .vsoul для ИИ-ускорителей), чтобы ядро могло их изолировать. Это не неудобно, это дисциплина.

Если у вас есть технические вопросы по архитектуре микроядра, по системе объектов Void или по модели безопасности — задавайте. Я отвечу, когда смогу. Интернет нестабилен, но проект жив.

reddit.com
u/DapperActivity8705 — 1 day ago
▲ 359 r/osdev

A 32-bit x86 hobby OS written from scratch with a custom graphical desktop environment

Hello r/osdev,

I wanted to share my hobby operating system project, YG-OS. It is a 32-bit x86 OS written entirely from scratch in C, C++, and Assembly without any external dependencies or standard C libraries.

Key features of the project include:

Custom real-mode bootloader with VESA mode negotiation (800x600x32).

Double-buffered software rendering with a layered window compositor.

Flat greyscale workstation-themed desktop environment.

Custom in-memory flat-file system (YGFS).

Custom physical and virtual memory management.

Live PCI configuration space enumeration and memory diagnostics during boot.

A suite of built-in applications including a terminal, calculator, paint program, and an agenda.

Dynamic runtime localization (English and Turkish).

The project is open-source and includes a build system for WSL It can be tested in QEMU or booted on real hardware via USB.

Source Code, Screenshots & Documentation

https://github.com/YGCODES1/YG-OS

I would appreciate any feedback code reviews, or questions regarding the architecture and implementation

u/DifficultBarber9439 — 2 days ago
▲ 272 r/osdev

My OS works on real hardware !!!!!

My OS works on real hardware too!!!!!

Specs: 32Bit - No mem management - IDE Disk - PS/2 Mouse+KB - 1024x728 Display w/ 16bit color. Doesn't the GUI look so NICE though.. Also looking for people with a PC with IDE disk to test my custom file system, if so join the discord.

And again... No AI code was used. and heres the repo: https://github.com/Brenmax2/BrenmaxOS/tree/main I'm still learning so dont expect perfect code :(

Discord: https://discord.gg/a84QQnUQNk

u/brenmax123 — 3 days ago
▲ 10 r/osdev

Bare-metal OS for Cortex-M7 from scratch

https://i.redd.it/sv0w5efvh32h1.gif

Hi everyone,

I'm not entirely sure if I should post in this thread since my OS targets embedded hardware. However, after sharing it on the embedded sub, I think my work might interest some of you.

For a while now, I've been working on Mk, a bare-metal OS that I developed in C and Assembly with no external dependencies (no HAL and no RTOS).

It was designed to run on the STM32F746G-DISCO and STM32F746G-Eval2 boards. They embed an ARM Cortex-M7 running at 216MHz, 8MB of RAM and no MMU. Initially, my goal was just to implement a small scheduler, but I stacked layers one after the other to make it as complete as possible. Currently, I think I've added enough layers to claim it's a small OS.

Mk features:

A Kernel

  • Preemptive, priority-based multitasking scheduler (fixed-priority, O(1) selection via CLZ)
  • Trusted Execution Environment (TEE) using the Cortex-M7 MPU (privileged and unprivileged mode)
  • Synchronization primitives: mutex, semaphore, event flags, mailbox
  • Fixed-size memory pools
  • Synchronous and asynchronous callback execution system

A Dynamic ELF Loader

Mk can load and execute external .elf files at runtime, relocated into 64 KB pages of external SDRAM. Programs reference Mk's own API symbols directly via extern — the full kernel symbol table is embedded in the firmware at a fixed address — so external applications require no copy of the kernel API in their own binary. Shared libraries can be added to overcome the 64 KB page limit. See the sym2srec tool for details on the symbol embedding mechanism.

A File System

  • FAT32 with multi-partition support
  • Concurrent access from multiple tasks (per-volume mutex)
  • Full POSIX-like API for file and directory manipulation
  • Supports SD/MMC cards and USB Mass Storage Class (MSC) devices

A USB Stack

  • Multitasking USB host stack built on the STM32F7 OTG peripheral
  • Supported device classes: HUB, HID (keyboard, mouse, joystick, gamepad), MSC

A Graphical Engine

  • Hardware-accelerated 2D rendering
  • Drawing primitives (rectangles, circles, lines, arcs), BMP 24/32-bit image rendering
  • Full Unicode text rendering (UTF-8/16/32)
  • UI widget library: buttons, text fields, edit fields, graphs, cursors, layers

A Shell

Built-in interactive shell with support for both native and dynamically loaded commands.

Links

Short demo of Mk in action: https://www.youtube.com/watch?v=cj7DHqhJ5gc

This is my first operating system, and I hope you'll find it interesting. There are still a few bugs to iron out, though I've done my best to eliminate as many as possible.

For those who'd like to dig into how it works, here are the key files:

Boot sequence: The system enters the ResetHandler() routine. The system is then initialized in mk_system_init(), which calls mk_main(), responsible for launching the kernel and all other subsystems.

Kernel core: The kernel lives under these sources and includes directories. Every system call is dispatched through the SVC exception, handled in mk_scheduler_handle().

Application prototype: A minimal application example can be found here (a simple BlinkLed). It must be paired with a linker script, an application descriptor (mk_application_data) and compiled with the following flags: -fPIC -shared. Symbol resolution at runtime is handled in mk_application_loadDynamic() and in this sources directory.

Other example applications can be found here: a Pong game and the built-in Shell.

Graphical Engine: The graphics engine is composed of several tasks that execute painting callbacks, input-listening callbacks, and process drawing requests submitted by applications. Each module is isolated and interactions between components go through asynchronous requests. The rendering pipeline entry point is mk_display_painter(), the listening entry point is mk_display_listener() and the request manager entry point is mk_display_handler().

File System: The file system layer is handled by multiple tasks running in parallel. One dedicated task is responsible for managing concurrent accesses to a given file. Each access is performed through synchronous or asynchronous requests, handled in mk_file_handle().

An early version of the documentation can be found here. It still needs some work.

I'd be happy to answer any questions or discuss any part of the implementation.

reddit.com
u/EmbSoft3 — 2 days ago
▲ 50 r/osdev+1 crossposts

PineCore a 32-bit DOS kernel, based on the night kernel.

So back in 2016 a bunch people (mercury and maarten) got together and started making a 32bit replacement kernel for freedos to attempt to answer what would DOS of been like as a real 32bit operating system and now that this is kinda working i thought id share where the project is up to 10 years later..

This bare metal kernel can finally run command.com (freecom in this case) and launch real mode applications and protected mode (only djgpp) applications via v86 mode and provides a vcpi and dpmi hostm this is still a WIP but its gettng there and it only took 10 years haha.

originally written in asm and slowly it was moved over to C.

releases are only available through the discord at the moment as this is still miles off from being a fully working replacement kernel but its cool that it can finally dos!. it can run along side the freedos kernel or its own native environment.

it has two shells the pine shell is a bit more like a linux/dos shell and then you can run freecom in a virtual terminal.

u/doscore — 3 days ago
▲ 4 r/osdev

OS Testing Strategies

With tutorial-os-definitive-edition, one of the major changes I made was to add real testing to the codebase. I wanted to adhere to the no external library, framework or dependency rule.

So, what did I do? For C, it was simply building my own assert and diag style of testing. For Rust, the built in test framework with cfg test.

With both languages, I made a specific folder where I wrote test code for most parts of the source code.

At compile time, I also have a make file that uses clippy, clang and clang for analysis of the code and generates a file for that output along with my build artifacts.

This means, I have static code analysis at compile time, a dedicated test runner on the rust side whenever I want and tests that run when the OS is loading on the device.

https://github.com/RPDevJesco/tutorial-os-testing-output/tree/master

If anyone has any other testing strategies I could use, I would love to hear about it.

reddit.com
u/JescoInc — 2 days ago
▲ 200 r/osdev

I'm getting tired of AI slop. Why is there so much!!!

Every 3rd post is an AI slop post. Like the AI blue color just gives it away. How does someone feal pleasure from showing off stuff that they didnt even make???? Its so annoying there should be a new rule saying NO AI. These 15 year old kids need to stop posting ai slop.

Im actual aboutta crashout.

reddit.com
u/Lost_Plate7077 — 4 days ago
▲ 1 r/osdev

error please someone explain me this

when i am swithcing to 32 bit protected mode before the far jmp i am doing [bits 32] but it is giving me error on qemu if i put after the far jump then it is working fine , i want to ask why is this happening

[bits 16]


switch_to_pm:
    cli
    lgdt[gdt_descriptor]
    mov eax , cr0
    or eax , 0x1
    mov cr0 , eax


    [bits 32]


    jmp CODE_SEG:init_pm
    


init_pm:
    mov ax , DATA_SEG
    mov ds , ax
    mov ss , ax
    mov es , ax
    mov fs , ax
    mov gs , ax


    mov ebp , 0x90000
    mov esp , ebp


    jmp BEGIN_PM[bits 16]


switch_to_pm:
    cli
    lgdt[gdt_descriptor]
    mov eax , cr0
    or eax , 0x1
    mov cr0 , eax


    [bits 32]


    jmp CODE_SEG:init_pm
    


init_pm:
    mov ax , DATA_SEG
    mov ds , ax
    mov ss , ax
    mov es , ax
    mov fs , ax
    mov gs , ax


    mov ebp , 0x90000
    mov esp , ebp


    jmp BEGIN_PM
reddit.com
u/Sensitive-Can9232 — 2 days ago
▲ 22 r/osdev

Problems Porting DOOMgeneric

Just created my own x86 libc that works fine in my OS, but when I ran doomgeneric it just crashes, someone could help me? I'd appreciate it very much. To test the doomgeneric Im loading ELF (btw it has the ELF header)

https://github.com/ArTicZera/DOOMgeneric-attempt

u/ArT1cZer4 — 3 days ago
▲ 55 r/osdev

Baby Steps towards OS dev

Hi guys. Today I set up QEMU on my device and started going through the DTS file to understand the memory layout. I wrote a simple UART driver to print characters, strings, decimal, and hexadecimal values to the screen. I first implemented it in assembly, and then rewrote it in C. It didn’t give the expected output at first, so I went deeper and found that C was using the stack, but I hadn’t set it up in the linker script. After fixing that, everything started working.

I also allocated heap by manually defining a heap start address and managing offsets myself. It was really fun.

u/0x6461726B — 3 days ago
▲ 83 r/osdev+2 crossposts

I built an 8‑bit CPU, assembler, and emulator – now I need collaborators to finish the C compiler backend and make a usable computer

I’m a 17‑year‑old solo developer, and I’ve spent the last while designing and building a complete custom 8‑bit CPU architecture. The CPU has a 24‑bit address bus, a flat memory model, and a custom instruction set. It’s all implemented in a cycle‑accurate emulator written in C. I also have an assembler and a 40×24 text screen device (ASCII framebuffer, no terminal emulation), all working.

I’ve just pushed everything to GitLab as three separate repositories:

Planned interrupt system
The CPU will support both internal and external interrupts. An internal interrupt instruction saves all ALU flags, register state, and a return address onto the stack, then jumps to an address held in dedicated address registers. return from interrupt restores everything and returns. External interrupts (e.g., from a keyboard) use input ports 0‑2 for the interrupt vector address and port 3 for data input. The hardware side still needs to be implemented in the emulator, but the specification is firm.

What I need help with
My goal is to turn this into a usable computer, and for that I need a C compiler. I’ve been writing a backend for the Fuzix Compiler Kit (FCC), targeting my CPU. It’s close — arithmetic, control flow, inline assembly, and variable storage all work. I’m currently implementing function calls. After that, there’s global variables, structs, and maybe floating point to do.

The problem: I’m exhausted working alone, and the compiler backend is the last big mountain. I’m looking for people who’d like to collaborate on this project with me.

How you could help (any of these):

  • Help finish the FCC backend (function calls, global variables, structs). The backend code isn’t public yet, but I can share it privately with serious collaborators.
  • Write a small ROM monitor or bootloader in assembly.
  • Add a keyboard input device to the emulator (that triggers those external interrupts).
  • Implement the interrupt hardware in the emulator (spec ready).
  • Test the toolchain (assembler, emulator, compiler) as features come online.
  • Just bounce ideas around — I’ve been working in a bubble and would love to talk shop.

If you’re into custom CPUs, retargetable compilers, or 8‑bit systems in general, I think you’ll find this a really fun challenge.

Comment here or DM me if you’re interested. Links to the repos are above. Thanks for reading!

u/DavidMik_ — 4 days ago
▲ 136 r/osdev

Finally got my custom File system done!!!!!

it's been almost a week. finally finished my first ever file system with no folders, no files bigger than 4gb and no good whatsoever. im still learning. it uses ide interface also. If anyone has a real hardware with IDE interface please join the discord so i can see if my FS works on a pc with IDE.

SPECS:

- 4gb max file size

- allocation table DIY

- limited entries

View my low budget repo: https://github.com/Brenmax2/BrenmaxOS

JOIN THE DISCORD: https://discord.gg/8j8rVx8Gh3

u/brenmax123 — 4 days ago