Kernel Structure and Assembly
Contents
Assembly (x86 / x86_64)
x86
Directories:
asm/x86/boot/asm/x86/cpu/asm/x86/mem/asm/x86/util/
Purpose:
- boot sector
- GDT
- IDT
- ISR stubs
- paging
- port I/O
- CPU utilities
These files must be integrated into a real boot pipeline.
x86_64
Directories:
asm/x64/boot/asm/x64/cpu/asm/x64/mem/asm/x64/util/
Purpose:
- 64-bit kernel entry
- GDT/IDT
- paging helpers
- port I/O
- CPU utilities
Requires a bootloader that already enabled long mode.
Kernel Directory
The kernel directory provides:
- architecture-specific startup code
- kernel entry point
- initialization sequence
- panic handler
- scheduler stub
- memory map stub
Key directories:
kernel/kernel/arch/x86_64/kernel/mm/kernel/sched/kernel/debug/
Key files:
kernel/init.ckernel/kernel.hkernel/debug/panic.ckernel/arch/x86_64/startup.asmkernel/arch/x86_64/entry.c
Example Kernel Entry
void kmain(void) {
kernel_init();
kernel_run();
}
C++ Layer
Files:
cpp/core/core.hppcpp/utils/vector.hppcpp/utils/string.hpp
Purpose:
- Minimal C++ wrappers without exceptions or RTTI.
Linker Script
File:
ld/kernel.ld
Purpose:
- Defines kernel memory layout and entry point.
Extending mck
You can add:
- drivers
- modules
- architecture-specific code
- memory management
- filesystem
- scheduler
- multitasking
- device drivers
mck is designed to be extended freely.