Working kernel written on C and userspace-ready #1

Merged
sonya merged 61 commits from dev into main 2026-05-03 09:13:20 +00:00
Owner
No description provided.
karina added 61 commits 2026-05-03 09:07:00 +00:00
Replace the vendored POSIX-UEFI runtime with a small local EFI entry and header so the bootloader depends only on the UEFI interfaces it actually uses.

Made-with: Cursor
- Add IOSerial: PL011 (0x0900_0000) TX with FIFO-full polling, yield while waiting
- Add Arch/IO.h (32-bit MMIO with DSB) and Arch/CPU.h (yield, WFI)
- Extend types.h (e.g. ASCII, Address, Int/UInt aliases)
- Wire KernelMain to IOSerialPutString for early boot output
- Drop .sourcekit-lsp config; note IO glob in CMake (commented)
Rewrite kernel in C
ref: renamed types.h to Types.h for match naming convention; also add…
build: switched to ninja
Build/debugging
Feat/dtb
build: removed drun, dcrun, crun and combined it as flags to run
PMM
feat(arm64): higher-half kernel, VMM, and working MMU bring-up
fix: TimerReset in GIC.c now uses kTimerFrequency
feat: GICv2 and timer
feat(scheduler): working scheduler
feat(rand): also implemented rand
- Bootloader: reallocate memory map buffer when ExitBootServices fails,
  so GetMemoryMap doesn't scribble past the old allocation on retry.
- vectors.S: actually store sp_el0 into the exception frame. Previously
  it was read into x24 and then… vanished. EL0 tasks would wake up with
  a corrupted stack pointer. Not great.
- Serial: split hardcoded 0x09000000 into a fallback default; add
  SerialUpdate() so the DTB-parsed UART address actually gets used.
- DTB: add bounds check on reserved[] with PMM's 3 extra slots accounted
  for, so malformed/overstuffed DTBs don't silently corrupt memory.
- PMM.h: bump kVMMaxReservedRegions 128→256, define kPMMReservedRegionCount.
- Types.h: remove `#define loop while(1)`. while(true) is fine.
- Rename IOSerial* → Serial* — the IO prefix was redundant, Serial.c
  already lives under IO/.
fix(VMM): use correct APTable encoding for table descriptors

fix(vmm): changed flags to match ARMv8
Member

what the fuck

what the fuck
Member

LGTM🔥

LGTM🔥
sonya merged commit e328bc8ef8 into main 2026-05-03 09:13:20 +00:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: 0xKSor/ksOS#1