Skip to content

Conversation

@Galfurian
Copy link
Member

Release v0.9.5

This release focuses on kernel stability, comprehensive testing infrastructure, and proper memory zone management with DMA support.

Major Changes

Memory Management & DMA Zone

  • DMA Zone Implementation: Added dedicated DMA zone with proper bootloader and paging support for ISA device compatibility
  • Memory Zones: Implemented three-zone architecture (DMA, LowMem, HighMem) with proper virtual memory mapping
  • Virtual Memory: Enhanced VMEM subsystem with collision detection and range validation
  • Bug Fixes: Disabled COW for initial user stack and PT_LOAD segments to prevent spurious panics

Testing Infrastructure

  • Unit Test Framework: Refined and expanded kernel unit test framework with subsystem-specific test suites
  • New Test Suites: Added comprehensive tests for GDT, IDT, ISR, paging, scheduler, and memory management
  • Memory Tests: 50+ new tests covering buddy allocator, slab allocator, DMA isolation, HighMem mapping, VMA lifecycle, and TLB consistency
  • Stress Testing: Added adversarial and edge-case tests for memory allocators and paging

Kernel Stability & Correctness

  • Release Mode Fixes: Corrected volatile semantics in spinlocks, mutexes, timer, scheduler, and RTC to prevent aggressive optimization
  • Signal Handling: Fixed SIGILL infinite loop by adding default handler check for synchronous faults
  • ISR Handling: Simplified and normalized interrupt/exception handling with safer pt_regs stack frame
  • Syscall: Fixed ENOSYS return value to properly return negative error codes
  • I/O Assembly: Corrected inline assembly constraints for I/O port operations
  • Scheduler: Fixed timer to only trigger scheduling on user-mode interrupts
  • vsprintf: Added NULL pointer handling for string formatting

Code Quality & Refactoring

  • Stack Helpers: Replaced unsafe stack manipulation macros with inline functions using compiler barriers
  • PS/2 Driver: Improved code organization with extracted helper functions and section headers
  • RTC Driver: Consolidated CMOS reads into single helper function with proper inline assembly
  • ISR Macros: Simplified interrupt service routine macros for better maintainability
  • Exception Handling: Made PRINT_REGS safe for kernel exceptions

Build System & Platform Support

  • macOS Support: Added macOS build workflow to CI pipeline
  • QEMU Flags: Adjusted optimization from O3 to O2 and added -no-reboot flag for better debugging
  • CMake: Improved build configuration and enabled glob configure dependencies

Features

  • FHS Initialization: Enabled Filesystem Hierarchy Standard directory structure initialization
  • Module Loading: Improved multiboot module handling to treat missing modules as success

Statistics

  • Commits: 105 commits since v0.9.4
  • Test Coverage: 50+ new kernel subsystem tests added
  • Memory Zones: 3-zone architecture (DMA, LowMem, HighMem) fully implemented

Upgrade Notes

No breaking changes expected. This is a drop-in upgrade from v0.9.4.

Testing

All unit tests pass in both Debug and Release builds. QEMU integration tests validated on Linux.

Galfurian and others added 30 commits February 3, 2026 10:00
- Build job only (no tests)
- Tests on Intel (macos-14) and Apple Silicon (macos-14-large)
- Uses Homebrew: nasm, cmake, i686-elf-gcc
- Critical: CMAKE_TOOLCHAIN_FILE=tools/toolchain-i686-elf.cmake
- Verifies successful build artifacts
- 30 minute timeout per job
…ation

feature(kernel): enable FHS initialization
- Simplify runner with straightforward test registry (no X-macros)
- Add test_utils with safe non-destructive testing utilities
- Refactor GDT tests to verification-only patterns
- Remove destructive test files (exception, idt, interrupt)
- Focus on GDT tests for framework stabilization
- Update .gitignore for summary files
- Remove GDT/IDT-specific copy functions from test_utils
- test_utils now contains only generic utilities (macros and helpers)
- Add gdt_safe_copy as static inline in test_gdt.c
- Use standard memcpy for safe read-only access
- Keep test_utils.c for future non-inline utilities
Galfurian and others added 29 commits February 4, 2026 17:00
feat(memory): comprehensive DMA zone allocator implementation with memory subsystem testing
Initial executable segments should be mapped as present, not COW.
COW is for fork() where there's an existing backing frame to copy.
Initial loads have no previous frame, causing immediate page faults.
Initial process stack should be mapped as present, not COW.
COW is for fork() with shared backing. Initial stack has no previous frame.
Don't call scheduler_run() when interrupted from kernel mode.
Kernel mode interrupts don't save complete pt_regs frame.
- Add __ps2_delay() for busy-wait delays with memory barriers
- Add __ps2_blind_read_buffer() for clearing output buffer before writes
- Add __ps2_flush_output_buffer() for flushing data with timeout
- Refactor ps2_write_data/command to use __ps2_blind_read_buffer
- Refactor ps2_initialize to use new helper functions throughout
- Eliminates repeated delay loops and buffer flush patterns
- Compiler was eliminating CMOS register reads in Release builds
- Replaced read_register() calls with direct inline assembly in rtc_read_datetime()
- Added NMI disable, I/O wait cycles, and memory barriers
- Improved diagnostics: UIP timeout, all-zero/0xFF reads, mirrored index detection
- Added proper I/O wait helper using port 0x80
- RTC now works correctly in both Debug and Release modes
Replaced 7 duplicate inline assembly blocks with calls to __rtc_read_cmos_direct().
Improves code readability while maintaining unoptimizable inline assembly behavior.
- Fixed volatile semantics in paging test loops to prevent optimization
- Added proper memory barriers and volatile declarations
- Ensured tests work correctly in both Debug and Release builds
…frame

- Replaced ISR_NOERR/ISR_ERR macros with single unified ISR macro
- Added intelligent privilege level detection (kernel vs user mode)
- Normalize stack frame by conditionally pushing SS/UESP in kernel mode
- Ensures pt_regs struct alignment matches actual stack layout
- Fixes crashes when accessing SS register from kernel exceptions
…rnel exceptions

- Removed overly complex stack frame normalization logic
- Simplified isr_common to standard register save/restore
- Made PRINT_REGS conditional: only access SS/UESP for user mode exceptions
- Prevents crashes when exception handlers try to print register state
- Exception frame is now simpler and less error-prone
fix(syscall): return negative ENOSYS for invalid syscall numbers
Changed port I/O constraints from 'dN' to 'd' to force dx register usage.
The 'dN' constraint allowed compiler to use immediate values in Release mode,
but assembly instructions always used %%dx, causing I/O on wrong ports.

This fixed years-long issue where OS only booted in Debug mode.
Reverted temporary changes used for debugging:
- Removed forced Release compilation for userspace programs and libc
- Restored normal CMAKE_BUILD_TYPE optimization flags
- Changed log levels back from DEBUG to NOTICE

The critical I/O port fix remains in place.
Fix Release boot by correcting port I/O inline asm constraints
@Galfurian Galfurian merged commit 82f4314 into main Feb 9, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant