]> 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)
commit58188693a547ef8db68eb8016ca8617ce3b56cd3
tree4690a7e49f1363709e2724d2c181a0b49bdac7ef
parent85fec960a57169e44f9e257867b068a14466e72c
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