r/kerneldevelopment • • Jun 20 '26

Entrypoint Name

10 Upvotes

Hi All!

I'm developing an OS and I had hoped to get an opinion from this group. There are 2 kinds of processes that my OS loads from the filesystem: user processes and kernel processes. User processes are started by the programmer with the usual `int main(int argc, char **argv)` and the `_start` symbol is provided at compile time and is what the scheduler calls. Kernel processes are passed arguments by the scheduler and the entrypoint takes the form `void* (*)(void*)`. The programmer has to provide the entrypoint.

My question is what the name of the entrypoint for kernel processes should be. It seems to me that I have two options: I can either be consistent for the programmer and call it "main" or I can be consistent for the scheduler and call it "_start". I don't have enough experience to know if there's a hard reason to prefer one or the other at this level, so I was hoping to get community guidance/feedback on this. Any input would be appreciated.

Thank you and have a great weekend!


r/kerneldevelopment • • Mar 22 '26

We all love new features, or do we?

10 Upvotes

Yes I know a very VSauce intro but anyways I did some hard work on purpleK2 in the last few months (I think months by now). I implemented stuff like execve and mmap (which is huge!!). I also did a little bit of magic and ported mlibc. Porting mlibc was alright I guess, I just dont like writing build system stuff (especially make) since its just annoying.
I also wrote a shell that has some very cool features ngl. The shells name is aurum because gold or something. Next up I want to implement an evdev type of system and improve the VMM a bit (a linked list maybe wasnt the best idea). I also had horrible timing with porting mlibc because just after I implemented the basic sysdeps, they changed how sysdeps worked ;-;

Anyways yea as usual a link to the repo: https://github.com/purpleK2/kernel/tree/dev-unstable
And to the new shell: https://github.com/purpleK2/aurum
mlibc: https://github.com/purpleK2/mlibc


r/kerneldevelopment • • Mar 14 '26

frog-kernel: Userspace and Syscalls as well as devfs via VFS

10 Upvotes

​After a few days of inconsistent work I managed to get some basic syscalls working including spawn() which is basically just a wrapper for the kernel ELF loader to load a given program and pass the caller's PID to it. I also managed to get the VFS working with a minimal devfs so that the TTY, framebuffer, and input devices such as the PS/2 mouse and keyboard are all exposed via file reads and writes to /dev subdirectories. I'm trying to take the "everything is a file" approach to the extreme and plan on implementing IPC via another VFS driver in which programs can read and write buffers to /ipc/... I haven't yet worked out the details on that yet though so the design may change. I deleted the past posts because I felt bad for spamming this sub and I also renamed the project to align more with my sporadic thought process (I fear I may become Terry Davis). The GitHub repo has a somewhat decent list of what I've done and what I wish to achieve. Please feel free to comment and critique!

The small red line at the top is intentional and is there to demonstrate writing directly to the framebuffer via /dev/fb0 (I couldn't really write more to the framebuffer because I haven't yet implemented proper syscalls to expand the program's address space but that shouldn't take more than a day or so.)


r/kerneldevelopment • • Mar 03 '26

Showcase ChudOS: 5000 lines demo

Thumbnail
github.com
10 Upvotes

I've been working on ChudOS since September as my first hobby kernel, and I recently hit 5k lines, so I decided I should publicize it a little. So far, I support 64-bit only; I have a level 4 paging driver (shit and unstable), a simple multitasking base, an FDC driver, and a work-in-progress FAT-like filesystem called GemFS. I have a pretty okay amount of documentation in my README, and have been writing more documentation in the Google Docs below (the kernel document does have comments for suggestions). I would really love for someone (please god anyone) to look at this since I've had no public discussions about this and am dying to converse about it.

ChudOS Docs: https://docs.google.com/document/d/1FdEFoUY3P8NTGNuTcX7dHmrKeZ8ksw3xekvUJscVn4g/edit?usp=sharing

GemFS Docs: https://docs.google.com/document/d/1qEJagVxrZ-UV0t6bwQdxYufGYKVyllQlnzAKFAdFjmo/edit?usp=sharing


r/kerneldevelopment • • Feb 23 '26

kernel dev friendly bootloader for Raspberry Pi and other ARMv8-A based SBC

Thumbnail neutron-wiki.pages.dev
10 Upvotes

Below is the github repo https://github.com/serene-brew/Neutron

This bootloader unlike others is designed for kernel developers who wants to design their own custom kernels. Devs can configure the bootloader accordingly for their kernel and use it

Drop a star for support and contribute if interested :D

I have documented the entire bootloader stable version v1.1.3 and the link is above.


r/kerneldevelopment • • Jan 23 '26

Yet another hobby OS

Thumbnail
github.com
10 Upvotes

r/kerneldevelopment • • Jan 12 '26

Managarm: End of 2025 Update

Thumbnail managarm.org
10 Upvotes

r/kerneldevelopment • • Nov 16 '25

Question Where do you guys take x86-64 and hardware documentation from? Do you use Intel manuals only?

Thumbnail reddit.com
10 Upvotes

r/kerneldevelopment • • Sep 30 '25

PurpleK2 Operating System Kernel

10 Upvotes

It has the following features
- ACPI (via uACPI)
- Fully fledged VFS (with CPIO init ram disk)
- Complete memory management (PMM, VMM, Paging, Heap)
- Module loader using relocatable ELFs
- RTL8139 Ethernet Card Driver
- Simple Device System
- TGA image rendering
- PCI and PCIe support


r/kerneldevelopment • • Sep 30 '25

My kernel

10 Upvotes

https://codeberg.org/HaxTed/TarkixOS

It currently has:

  • GDT

  • IDT

  • Stupid PMM

  • Serial and more..

It's very broken and the code is really bad, but check it out!


r/kerneldevelopment • • Sep 14 '26

Showcase I wrote a complete beginner's guide to building a small OS from scratch.

9 Upvotes

r/kerneldevelopment • • Jan 30 '26

Showcase Implementing mutexes for my operating system's kernel!

Thumbnail kamkow1lair.pl
9 Upvotes

r/kerneldevelopment • • Aug 25 '26

Should I add SMP later on or right now?

8 Upvotes

Hi reddit, I'm wondering if I should do SMP now or later when I finish interrupts?


r/kerneldevelopment • • Nov 27 '25

Request For Code Review Asking for advice from more experienced developers

Post image
8 Upvotes

Hello, first and foremost, the code is here.

I am looking for some advice on code organization, as well as some guidance on the next steps. So far I've got a GDT, some basic interrupt catching and easy serial+framebuffer console. APIC is not yet set up. I'm still on the page table provided by Limine.

I think I should work on a physical page frame allocator, but I don't know whether to pick a bitmap or stack allocator. I am leaning towards a stack allocator, though a buddy allocator also sounds interesting, but I don't entirely understand it. Even if I was dead set on something, I wouldn't know where to begin.

Thanks


r/kerneldevelopment • • Nov 02 '25

Question Interrupt delays with E1000

8 Upvotes

While working on networking specifically TCP, I’ve noticed that that sometimes I get huge (multiple seconds) delays between packets.

Looking at wireshark packets are sent instantly from the sender, but it takes a long time before I receive the interrupt. At first I thought I had a bug with disabling the interrupts, but after long testing sessions I concluded that they are enabled when the interrupt should come.

The driver also instantly acknowledges the interrupts. This delay only happens sometimes, I’d say 1/3 of the time.

Anyone experienced similar problems?

This is what I use with QEMU:

-device e1000,netdev=net0 -netdev user,id=net0,hostfwd=tcp::80-:80 -object filter-dump,id=net0,netdev=net0,file=dump.dat


r/kerneldevelopment • • Oct 02 '25

Question How to practically learn addressing methods in "Understanding linux kernel" book?

8 Upvotes

It's written a lot about logical addresses, physical addresses, segmentation and paging. Which of the today's microcontrollers/processors are good for trying different configurations given in the book?


r/kerneldevelopment • • Sep 30 '25

AstralisOS (renamed main branch of Open95)

8 Upvotes

https://github.com/STierProgrammer/AstralisOS
Currently has: a bootstub (terrible one), gdt, idt, paging, serial, pmm, slab allocator, HAL and that's it.


r/kerneldevelopment • • Feb 28 '26

how can I implement both blocking and non blocking keyboard event

7 Upvotes

Hello! I would like to know how in an OS you can implement both blocking and non blocking keyboard event currently I just expose the keyboard to the user with "/dev/keyboard" so he just reads a stream of event from there but when there is nothing to read `int64_t VFS_read(int fd, void *buffer, size_t size)` just return 0 that's great when we don't want to wait but in some case (like in a shell) we don't want to waste cpu, do I need to make two keyboard device? exemple of user program interacting with the keyboard:

org 0x400000
bits 32


main:
    mov eax, 0xc
    mov esi, console_path
    mov ebx, 2
    int 0x80    ; opening the console device


    mov [fd_cons], edx


    mov eax, 0xc
    mov esi, keyboard_path
    mov ebx, 1
    int 0x80    ; opening the keyboard


    mov [fd_key], edx


.loop:
    mov eax, 0xd
    xor edx, edx
    mov ecx, 1
    mov ebx, [fd_key]
    mov edi, key
    int 0x80    ; tries to read from the keyboard


    or ecx, ecx
    jz .loop    ; the keyboard is empty retry


    mov bl, [key.mask]
    and bl, 01000b
    jz .loop    ; it's not a keypress (released)


    mov eax, 0x10   ; key event to ascii
    mov esi, key
    int 0x80


    mov [ascii], ebx


    mov eax, 0xe
    xor edx, edx
    mov ecx, 1
    mov ebx, [fd_cons]
    mov esi, ascii
    int 0x80            ; printing to the console


    jmp .loop


    call exit


exit:
    mov eax, 0x0
    int 0x80


    ret


key:
    .code: db 0
    .mask: db 0


fd_cons dd 0
fd_key dd 0
ascii db 0


console_path db "/dev/console"
keyboard_path db "/dev/keyboard"

github: https://github.com/Novice06/Novix


r/kerneldevelopment • • Jan 11 '26

Discussion Side project idea

7 Upvotes

Would anyone here be interested in making a an 64-bit version of DOS that's every bit as spartan as the original but for modern 64 bit machines just for fun to see what happens?

I'm talking no paging (identity mapped or MMU off on non-x86), a small number of system calls that are as similar to the original ones as possible, a text only interface on a raw framebuffer, all the classic DOS commands, a FAT32 filesystem, boot directly from UEFI and use ACPI at runtime via uACPI or an FDT using libfdt, and some basic multi-tasking and multi-processor support. Both the kernel and applications would be PE32+ executables using the UEFI/MS ABIs.

So a decently narrow scope, at least to start with, for something that can actually be completed in a decent time frame and which would be an interesting little experiment and possibly a good educational codebase if done right.

The code would be modern C (C23) and assembly using Clang and the LLVM toolchain.


r/kerneldevelopment • • Oct 11 '25

Discussion Hybrid (?) Memory Management (Theory and Discussion)

7 Upvotes

I apologize in advance for the length of this post...

To begin, I selected the discussion tag for this post even though it may be interpreted as a question... I am asking various questions, but would like an open community discussion to determine the best possible Hybrid Memory Management Model (HMMM). In my prior C Kernel projects, I utilized a FLAT HEAP MM. I want to make a dynamic memory manager with two parts and a ruleset implemented to dynamically manage memory on kernel initialization (after GRUB/2 or my custom hybrid bootloader passes boot services off to the kernel to handle). Moreover, I have beginner to intermediate knowledge of memory management, but I want to challenge myself in developing this proposed or tweaked HMMM.

Anyhow, to the point, I drafted this set of guidelines for the memory manager to dynamically set up memory:

1.) SLAB memory management model will be the master memory manager/controller.,

2.) HEAP memory management model will be the slave memory manager/controller.

3.) Minimum SLAB byte size will be 4KB. The maximum SLAB byte size will be 32MB.

4.) SLAB byte size is conditional, based on machine code block sizes (1, 4, 8, 16, 32, 64, 256, 512). For instance, or to explain further: SLAB sizes in KB range (under 1MB) will begin with a minimum size of 4KB, then 8KB, 16KB, 32KB, 64KB, 256KB, 512KB. SLAB sizes in MB range will begin with a minimum size of 1MB, then 4MB, 8MB, 16MB, and 32MB.

5.) Minimum SLAB count (total SLAB entries in static linear array) is 63. The maximum SLAB count is 65,535, or the maximum possible 16-bit integer value. This rule is conditional; refer to rule 7.

6.) SLAB 0 (first possible SLAB in index) is reserved for the SLAB Header. This rule is conditional; refer to rule 7.

7.) If a SLAB memory management model is not possible (the memory available is under the applicable size of the guidelines) a singular SLAB of the entire available memory will be used, the first 64 bytes will the the SLAB header which will have set flags to declare the SLAB is the only one and is to be treated as a HEAP (this forces the kernel to fallback to legacy control of memory, in this case will fallback to my FLAT HEAP model).

8.) HEAP Headers will grow downward from the end of the SLAB (64 bytes is reserved for the HEAP Header); the header will be reversed so the beginning will be the top bytes of the SLAB, then decrement to fill the header. HEAP Headers will be trailed downward by memory structure identifiers, which will describe the physical memory location within the SLAB of the HEAP memory blocks (32-bit value) and a HEAP Attributes/Flags (4-bit value), and a HEAP byte size (28-bit value).

9.) HEAP "slices" within SLABs will grow from the end of the last used byte within the SLAB, rounded up to the nearest 1KB range, and be stacked in continuous blocks bound to 32-bit values within the SLAB. For instance, or to explain further: A single SLAB consists of 4KB, a program uses 2KB of the SLAB, but now there is 2KB of usable space within the SLAB, the HEAP allocator will generate the HEAP header at the 4KB location downward, then generate a downward-growing HEAP entry list. The first HEAP will start at the 2KB memory boundary within the SLAB and begin adding smaller "memory hungry" programs to fill the SLAB before overwriting the HEAP entry list (the HEAP entry list will be generated temporarily before the HEAP program is added to the SLAB memory, this is a safeguard to prevent a program being added to the virtual SLAB HEAP that potentially overwrites the HEAP entry list).

10.) HEAP'd memory will not exceed the physical byte size of 1 SLAB. For instance, to explain further: if a SLAB is 4KB and a program requests 6KB of memory, the program will be preferably stored as a continuous SLAB chain, or fragmented across active SLABs. The program's memory must be linked as though the SLABs are put 1 after the other, as though the process can access all 6KB in a FLAT memory model. In this case, if a SLAB is already used by a HEAP model but has the leftover 2KB, the SLAB will be ignored... this is because the SLABs (if placed side-by-side) do not convey a 6KB FLAT memory model. The same goes for a HEAP'd program; if the program needs only 512 bytes but the HEAP'd SLAB only has 510 bytes available, the memory model will find the next active SLAB with 512 bytes of memory available.

Theory:

SLAB'ing Memory Management:

The idea is that a SWAP space or physical memory would be available in, let's say, 4GB; the memory management system would be initialized by the kernel to SLAB the 4GB of total usable memory by taking the minimum SLAB count (63) and dividing 4GB by 63, providing 64MB SLABS... 65MB SLABs breaks rule 3 and 4 exceeding 32MB maximum SLABs and optimal machine block size (64), so the system will rerun the calculation but this time instead of using the minimum SLAB value this time be begin with the minimum MB SLAB size (1MB)... so 4GB / 1MB = 4096 possible SLABs minus 1 for the SLAB Header which gives 4095 usable SLABs.

Again, let's try 16GB of memory (now a 64-bit system). 16GB / 63 = 260MB SLABs... exceeds rule 3 and rule 4, rerun the calculation using the lowest possible value (1MB). 16GB / 1MB = 16384 total SLABs minus 1 (SLAB Header), leaving the system with 16383 usable SLABs.

HEAP'ing Memory Management:

The idea for HEAP'ing is that because HEAP memory models do not have dedicated blocks of memory allocated, and rather it's first-come come first-served (imo), HEAP'ing will take advantage of SLABs not fully utilized. To further explain, a SLAB index is made with 64 SLABs at 4KB per SLAB. Since SLAB 0 is reserved for a SLAB header (acts as a Memory Management Global Descriptor Table), SLAB 1 is the next available... let's say a program requests 6KB of memory, SLABs 1 and 2 are used for this allocation and linked together in the SLAB 0 Header (kind of like a FAT cluster chain), since SLAB 2 is not fully used, it is marked with an attribute that declares SLAB 2 is ready for HEAP'ing... the memory management system will mark the last 64 bytes of the SLAB with the HEAP header (growing downward) then generate the HEAP array downwards from the bottom of the HEAP header (this is done to prevent HEAP'd memory within SLABs from overwriting the HEAP array or the used SLAB memory). If the current SLABs are still open/being used, and another program requests to use memory (without requesting to inactive SLAB) under 2KB - (64 byte HEAP Header + 32 byte HEAP entry), SLAB 2 will be filled until it can no longer be filled.

Or a 4KB SLAB is active with nothing loaded into its memory, multiple programs request to use memory, the kernel will invoke the memory manager to use the active SLAB and store all the program memory into the SLAB with the HEAP header and HEAP entry list at the top of the SLAB downwards.

SLAB'ing and HEAP'ing together:

Because memory maps are messy, the largest memory hole the system provides will determine the outcome of the total amount of SLABs being active at once before being stored in SWAP. Because SLABs will have inactive and active scheduling, the memory used in each SLAB might as well be taken advantage of fully... even if it means cramming 32+ other programs into each active SLABs. HEAP'ing is only used when memory is available in SLABs that is adequate to meet the program's memory demand request.

Limitations:

Since the total possible SLABs is limited to a 16-bit maximum integer (65535 or FFFFh). The total amount of memory this memory management model can map at 32MB SLABs is 2047GB of physical/virtual RAM.

Questions:

1.) Does this hybrid model seem feasible, or should I just stick with SLAB'ing or HEAP'ing my memory instead?

2.) Based on this community's level of Kernel Development (seeing other posts), for someone with beginner-intermediate memory management knowledge, does this seem like a good challenge to work on within, let's say, a month? (For reference, it took me about a week to make my hybrid bootloader and basic terminal kernel that handles FS, Video Graphics, and Priority-Based Task Scheduling (PIT interval of 10ms).

EDIT 1:

I forgot to mention that when I SLAB the usable memory within RAM, the SLABs are numbered from 1 to a maximum of 65535 (SLAB 0 is reserved for the SLAB header and never leaves active SLAB memory), which can be LBA mapped into a SWAP partition... the LBA mapping is done by calculating (SLAB.Number - 1) * (SLAB.ByteSize / SWAP.LBA.ByteSize) = SWAP.LBA.Offset. In most cases, the SWAP will exceed the total RAM size, but in cases it does not, RAM will just keep all the active SLABs and switch out the total inactive SLABs within SWAP (4GB of RAM = 4096 SLABs at 1MB but SWAP is only 1GB which leaves only 1024 SLABs at 1MB so RAM will be 3074 SLABs active and SWAP will be 1024 SLABs inactive... in the case SWAP exceeds RAM size the SWAP will hold inactive SLABs still but will act as the slower extended memory, this could also be theorized to work in systems that don't have PAE capabilities extending 4GB memory limitation to 4GB + SWAP.ByteSize).


r/kerneldevelopment • • Sep 25 '26

Discussion How would you improve a scheduler in a hobby OS?

6 Upvotes

Apple has been improving the CPU scheduler in iOS 27 despite having years of legacy code behind it.

That got me thinking:

What could we borrow from that idea for a hobby OS?

Not Apple’s entire scheduler. Just the principle of improving an existing scheduler incrementally — better workload awareness, latency handling, priorities, etc.

Even a tiny kernel could experiment with this on 2–8 cores.

What scheduler improvement would you try first in a hobby OS?


r/kerneldevelopment • • Feb 28 '26

Nyxian (FOSS Native iOS virtual kernel for unjailbroken iOS written in C and integrated C language IDE) (Update post)

6 Upvotes

r/kerneldevelopment • • Feb 25 '26

FOSDEM 2026 - os-test: Measuring POSIX compliance on every single OS

Thumbnail
fosdem.org
6 Upvotes

r/kerneldevelopment • • Jan 27 '26

Question so, given im mid rewrite, I would like some help nailing down the kernel structure

6 Upvotes

so, basically, im designing this kernel to be stable and secure

im already working on a sorta secure ram zone, and access keys for each program's memory, and possibly a hypervisor, but, my main question, is should I follow an existing standard or should I attempt to create my own?


r/kerneldevelopment • • Oct 21 '26

Been building my own x86_64 microkernel OS from scratch for the last 6 months (Rust, userspace GUI, ported musl & TCC). Finally got it to a playable state.

Post image
5 Upvotes