]> 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)
commit7e3b16c68a46148e919836067f0ef9b18900bf9b
tree08d7aa8d197b7a0b65d27e5faf8df09d4c865d02
parent8d1051b321994c4a09af6c86b47dc21546420ff8
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