]> Projects (at) Tadryanom (dot) Me - AdrOS.git/commit
fix: replace hardcoded 0xC0000000 in slab.c with hal_mm_phys_to_virt()
authorTulio A M Mendes <[email protected]>
Tue, 10 Feb 2026 04:04:05 +0000 (01:04 -0300)
committerTulio A M Mendes <[email protected]>
Tue, 10 Feb 2026 04:04:05 +0000 (01:04 -0300)
commit8300757e23b49af40aa2b01616f412d5220cb5f2
treef1e5dbda652a22440efbd83b55a92ed6ced47fdf
parent8b88a19f78e03b4d1f53a55206cbe6cf9d35671d
fix: replace hardcoded 0xC0000000 in slab.c with hal_mm_phys_to_virt()

slab.c used 'base + 0xC0000000U' to convert physical to virtual
addresses, which is x86 higher-half specific. This breaks on ARM,
RISC-V, and MIPS where the kernel virtual base differs.

Add hal_mm_phys_to_virt(), hal_mm_virt_to_phys(), and
hal_mm_kernel_virt_base() to the HAL mm interface with proper
implementations for x86 (0xC0000000 offset) and identity-mapped
stubs for ARM, RISC-V, MIPS.

Passes: make, cppcheck, QEMU smoke test.
include/hal/mm.h
src/hal/arm/mm.c
src/hal/mips/mm.c
src/hal/riscv/mm.c
src/hal/x86/mm.c
src/mm/slab.c