Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

21 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 

Repository files navigation

Hi there πŸ‘‹ My name is k!M Olsen.


πŸ› οΈ Tech Stack & Systems

  • Languages: C, C++17, Rust, Go, Zig, Python, Bash, Lua, x86/ARM Assembly
  • Systems & Kernel: Linux (Slackware, Debian, Fedora, Ubuntu, Mint), x86_64 Long Mode, PAE Paging, POSIX Multithreading
  • Graphics & Audio: Raylib, SDL2, Pygame, Custom GLSL Shaders, Procedural Audio
  • Security & Ops: SIEM Monitoring, Incident Response & Automation

πŸš€ Featured Projects

🌟 SectorZero-64

An open-source x86_64 bare-metal bootloader and C kernel (GPLv3).

  • Transitions from 16-bit real mode directly into 64-bit long mode.
  • Implements custom PAE paging, PML4 table setup, and inline assembly CPUID feature checks.
πŸ” View Bootloader Architecture & Mode Transition
 +-----------------------------------------------------------------------+
 |                       [16-BIT REAL MODE]                              |
 |  β€’ BIOS loads Stage 1 MBR at physical address 0x7C00                  |
 |  β€’ Enable A20 Line & load Stage 2 / Kernel via BIOS INT 0x13          |
 |  β€’ Load 32-bit Global Descriptor Table (lgdt)                         |
 +-----------------------------------------------------------------------+
                               |
                               | Set CR0.PE = 1 (Protection Enable)
                               | Far Jump (ljmp 0x08:protected_mode)
                               v
 +-----------------------------------------------------------------------+
 |                     [32-BIT PROTECTED MODE]                           |
 |  β€’ Reload data/stack segment registers (DS, SS, ES, FS, GS)           |
 |  β€’ Check CPUID (0x80000001 -> EDX bit 29) for Long Mode support       |
 |  β€’ Build 4-Level Page Tables (Identity Map):                          |
 |      [PML4] ---> [PDPT] ---> [PD] ---> [2MB Huge Pages / PT]          |
 +-----------------------------------------------------------------------+
                               |
                               | 1. Load PML4 base into CR3
                               | 2. Set CR4.PAE = 1 (Physical Addr Ext)
                               | 3. Set EFER.LME = 1 (MSR 0xC0000080)
                               | 4. Set CR0.PG = 1 (Paging Enable)
                               v
 +-----------------------------------------------------------------------+
 |                   [IA-32e COMPATIBILITY SUB-MODE]                     |
 |  β€’ CPU is now in Long Mode, but executing 32-bit instructions         |
 |  β€’ Load 64-bit GDT (Code Segment with L-bit = 1, D-bit = 0)           |
 +-----------------------------------------------------------------------+
                               |
                               | Far Jump (ljmp 0x08:long_mode_start)
                               | Flushes instruction pipeline
                               v
 +-----------------------------------------------------------------------+
 |                        [64-BIT LONG MODE]                             |
 |  β€’ Setup 64-bit stack pointer (RSP) & clear segment registers         |
 |  β€’ Jump to 64-bit C Kernel entry point (kmain)                        |
 +-----------------------------------------------------------------------+
πŸ” View Memory Map
 Physical Address                  Memory Region / Contents
 +------------------+---------------------------------------------------------+
 | 0x00000000       | Real Mode IVT (Interrupt Vector Table) & BIOS Data Area |
 |  ...             | (Reserved by BIOS during 16-bit initialization)         |
 +------------------+---------------------------------------------------------+
 | 0x00001000       | 64-Bit Page Tables (Identity Mapped, 4KB Aligned)       |
 |  β”œβ”€ 0x00001000   |  β€’ PML4 (Page Map Level 4)            [CR3 Base]        |
 |  β”œβ”€ 0x00002000   |  β€’ PDPT (Page Directory Pointer Table)                  |
 |  └─ 0x00003000   |  β€’ PD   (Page Directory - 2MB Huge Pages)               |
 +------------------+---------------------------------------------------------+
 | 0x00007000       | Kernel / Bootloader Stack (Grows downward <-- )         |
 +------------------+---------------------------------------------------------+
 | 0x00007C00       | Stage 1 MBR Bootloader (512 Bytes, 0xAA55 Signature)    |
 +------------------+---------------------------------------------------------+
 | 0x00007E00       | Stage 2 Bootloader / GDT (32-bit & 64-bit Descriptors)  |
 |  ...             | (Or low-memory C Kernel entry at 0x8000 / 0x10000)      |
 +------------------+---------------------------------------------------------+
 | 0x000A0000       | Legacy Video RAM (VRAM)                                 |
 +------------------+---------------------------------------------------------+
 | 0x000B8000       | VGA Text Mode Buffer (80x25 chars, 2 bytes per cell)    |
 +------------------+---------------------------------------------------------+
 | 0x000C0000       | Video BIOS & Expansion ROMs                             |
 | 0x000F0000       | Motherboard BIOS ROM (64KB)                             |
 +==================+=========================================================+
 | 0x00100000 (1MB) | 64-Bit C Kernel (`kmain` ELF / Flat Binary Image)       |
 |  ...             | Free Extended Memory (Heap, Frame Allocator, Stack)     |
 +------------------+---------------------------------------------------------+
  • Instead of navigating real-mode to long-mode transitions, SectorZero-ARM boots directly into a flat 64-bit address space (AArch64), giving you immediate access to modern C development and Memory-Mapped I/O (MMIO).
πŸ” View Aarch644 Bootloader Pipeline
 +-----------------------------------------------------------------------+
 |                    [VIDEOCORE IV / VI GPU FIRMWARE]                   |
 |  β€’ ROM Bootloader initializes SDRAM & reads FAT32 boot partition      |
 |  β€’ Loads `kernel8.img` to physical address 0x00080000                 |
 |  β€’ Releases ARM Cortex-A53 / A72 cores in 64-bit AArch64 state        |
 +-----------------------------------------------------------------------+
                               |
                               | All 4 Cores start at _start (0x80000)
                               | Read MPIDR_EL1 (Aff0 bitmask 0x03)
                               v
 +-----------------------------------------------------------------------+
 |                     [MULTI-CORE PARKING & EL CHECK]                   |
 |  β€’ Cores 1, 2, 3 (Core ID != 0) ---> Enter low-power WFE loop         |
 |  β€’ Core 0 (BSP) checks `CurrentEL` register:                          |
 |      - If EL3 (Secure Monitor): Configure SCR_EL3 & drop to EL2       |
 |      - If EL2 (Hypervisor):     Set HCR_EL2.RW = 1 (64-bit EL1)       |
 +-----------------------------------------------------------------------+
                               |
                               | 1. Disable EL1 traps (CPACR_EL1)
                               | 2. Set SPSR_EL2 = 0x3C5 (EL1h, DAIF masked)
                               | 3. Set ELR_EL2 = el1_entry
                               | 4. Execute `eret` (Exception Return)
                               v
 +-----------------------------------------------------------------------+
 |                      [EL1 KERNEL INITIALIZATION]                      |
 |  β€’ Set 64-bit Stack Pointer (`SP_EL1`) below code base (0x00080000)   |
 |  β€’ Zero-out `.bss` section via 64-bit `str xzr` loop                  |
 |  β€’ Install Exception Vector Table (`VBAR_EL1` aligned to 2KB / 0x800) |
 |  β€’ (Optional) Configure MMU: `MAIR_EL1`, `TCR_EL1`, `TTBR0_EL1`       |
 +-----------------------------------------------------------------------+
                               |
                               | Branch with Link (`bl kmain`)
                               v
 +-----------------------------------------------------------------------+
 |                       [AArch64 C KERNEL (EL1)]                        |
 |  β€’ Initialize PL011 / Mini-UART via MMIO for serial console           |
 |  β€’ Query VideoCore Mailbox (Channel 8) for Board Rev & Framebuffer    |
 |  β€’ Unmask IRQ (`msr daifclr, #2`) & start ARM Generic Timer           |
 +-----------------------------------------------------------------------+
πŸ” View Memory Map
 Physical Address                  Memory Region / Contents
 +------------------+---------------------------------------------------------+
 | 0x00000000       | ARM Stub / Spin Tables (Multicore release addresses)    |
 |  β”œβ”€ 0x000000D8   |  β€’ Core 0–3 Mailbox Spin Addresses (0xD8, 0xE0, 0xE8..) |
 |  └─ 0x00000100   |  β€’ Device Tree Blob (DTB) / ATAGs passed by GPU         |
 +------------------+---------------------------------------------------------+
 | 0x00001000       | Free Low Memory (Often used for Identity Page Tables)   |
 |  ...             |  β€’ PGD -> PUD -> PMD (TTBR0_EL1 base if MMU enabled)    |
 +------------------+---------------------------------------------------------+
 | 0x0007FFFF       | EL1 Kernel Stack Top (`SP_EL1` grows downward <-- )     |
 +==================+=========================================================+
 | 0x00080000       | `kernel8.img` Load Address (`_start` Entry Point)       |
 |  β”œβ”€ .text.boot   |  β€’ Core parking, EL2->EL1 drop, BSS clear               |
 |  β”œβ”€ .text / .ro  |  β€’ AArch64 C Kernel (`kmain`), Vector Table (`VBAR_EL1`)|
 |  β”œβ”€ .data        |  β€’ Initialized global variables                         |
 |  └─ .bss         |  β€’ Zero-initialized data (Page-aligned end)             |
 +------------------+---------------------------------------------------------+
 | Kernel End       | Dynamic Memory / Kernel Heap & Page Frame Allocator     |
 +------------------+---------------------------------------------------------+
 | 0x3C000000+      | VideoCore GPU Shared RAM (Framebuffer allocated via     |
 | (Config-based)   | Mailbox Property Tag `0x00040001`)                      |
 +==================+=========================================================+
 | 0x3F000000 (Pi3) | BCM2837 / BCM2711 MMIO Peripherals Base                 |
 | 0xFE000000 (Pi4) |  β”œβ”€ +0x0000B880 : VideoCore Mailbox (Read/Write/Status) |
 |                  |  β”œβ”€ +0x00200000 : GPIO Controller (Alt-Func Pin Muxing) |
 |                  |  β”œβ”€ +0x00201000 : PL011 UART0 (TX/RX, Baud Rate Divs)   |
 |                  |  └─ +0x00215000 : Auxiliary Mini-UART (UART1)           |
 +------------------+---------------------------------------------------------+
 | 0x40000000 (Pi3) | ARM Local Peripherals (Core Timer Routing & IRQ Ctrl)   |
 | 0xFF840000 (Pi4) | GIC-400 (Generic Interrupt Controller - GICD / GICC)    |
 +------------------+---------------------------------------------------------+

πŸ“Š GitHub Stats

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors