]> Projects (at) Tadryanom (dot) Me - AdrOS.git/commit
fix: deep audit — VA collision, arch pollution, broken stubs
authorTulio A M Mendes <[email protected]>
Fri, 13 Feb 2026 06:07:43 +0000 (03:07 -0300)
committerTulio A M Mendes <[email protected]>
Fri, 13 Feb 2026 06:07:43 +0000 (03:07 -0300)
commit71fe7ad382d1c12efa3d85c4a9e544c0e88d1160
tree8965f1359a665157bd3db2984112e0c6d8984d82
parentd52e8cbb2d11f6b2bef9a518c64b1191bb90f5a0
fix: deep audit — VA collision, arch pollution, broken stubs

Critical bug fix:
- VDSO and E1000 both mapped at VA 0xC0230000 — silent corruption!
  VDSO moved to 0xC0280000, E1000 moved to 0xC0330000-0xC0371FFF

New centralized VA map (include/kernel_va_map.h):
- All fixed kernel VA allocations documented in one header
- IOAPIC, VDSO, ACPI, ATA DMA, E1000, LAPIC all use KVA_* defines
- Prevents future VA collisions — single source of truth

Architecture pollution fixes:
- syscall.c SET_THREAD_AREA: replaced x86 gdt_set_gate_ext() with
  hal_cpu_set_tls() HAL call (was #if __i386__ inline)
- e1000_netif.c: replaced x86 'pause' asm with cpu_relax() from
  spinlock.h (arch-agnostic)
- tty.c: removed dead uart_console.h include (switched to
  console_put_char in previous commit)

Broken code fix:
- pmm_print_stats(): was declared in pmm.h but never implemented —
  now prints Total/Used/Free RAM in KB and MB
- kconsole 'mem' command: replaced [TODO] stub with pmm_print_stats()

Files using centralized KVA_* defines:
- vdso.c, e1000.c, acpi.c, ata_dma.c, ioapic.c, lapic.c

Build: clean, cppcheck: clean, smoke: 19/19 pass
12 files changed:
include/kernel_va_map.h [new file with mode: 0644]
src/arch/x86/acpi.c
src/arch/x86/ioapic.c
src/arch/x86/lapic.c
src/drivers/e1000.c
src/hal/x86/ata_dma.c
src/kernel/kconsole.c
src/kernel/syscall.c
src/kernel/tty.c
src/kernel/vdso.c
src/mm/pmm.c
src/net/e1000_netif.c