]> Projects (at) Tadryanom (dot) Me - AdrOS.git/commit
feat: implement CPUID feature detection + HAL wrapper
authorTulio A M Mendes <[email protected]>
Tue, 10 Feb 2026 06:53:50 +0000 (03:53 -0300)
committerTulio A M Mendes <[email protected]>
Tue, 10 Feb 2026 06:53:50 +0000 (03:53 -0300)
commitaa28c4b8e4379da7048134890baed5fbb70668ee
tree8b466a320725e4a3727de3d93237e070be1b5900
parenta7288b8ecff0eeb2ede38fc471f26ec1fc140d57
feat: implement CPUID feature detection + HAL wrapper

Add x86 CPUID detection (src/arch/x86/cpuid.c) that queries:
- Leaf 0: vendor string, max leaf
- Leaf 1: feature flags (PAE, NX, APIC, SEP, SSE, SSE2, HTT, etc)
- Leaf 1 EBX: topology (APIC ID, logical CPUs)
- Extended leaves: NX, Long Mode, SYSCALL, brand string

HAL wrapper (include/hal/cpu_features.h):
- hal_cpu_detect_features() / hal_cpu_get_features() / hal_cpu_print_features()
- x86 impl in src/hal/x86/cpu_features.c
- Weak default stub in src/kernel/cpu_features.c

Called from kernel_main() right after console_init().
QEMU output: GenuineIntel, PAE APIC SEP SSE SSE2 FXSR HYPERVISOR.

Passes: make, cppcheck, QEMU smoke test.
include/arch/x86/cpuid.h [new file with mode: 0644]
include/hal/cpu_features.h [new file with mode: 0644]
src/arch/x86/cpuid.c [new file with mode: 0644]
src/hal/x86/cpu_features.c [new file with mode: 0644]
src/kernel/cpu_features.c [new file with mode: 0644]
src/kernel/main.c