From 10d3761be1041446d06745ccf30ab7d12ec3edc7 Mon Sep 17 00:00:00 2001 From: Gregory Bowne Date: Mon, 5 Jan 2026 00:46:14 -0800 Subject: [PATCH] Enhance cpu.h with Intel model definitions and struct Added Intel model definitions and CPU info structure. --- kernel/cpu.h | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/kernel/cpu.h b/kernel/cpu.h index d2e165f..4eefd2e 100644 --- a/kernel/cpu.h +++ b/kernel/cpu.h @@ -2,8 +2,42 @@ #define CPU_H #include +#include -void cpuid(uint32_t function, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx); +// Specific Intel Model Definitions for your targets +#define INTEL_FAM4_486_DX 0x00 // Also 0x01 +#define INTEL_FAM4_486_SX 0x02 +#define INTEL_FAM4_486_DX2 0x03 +#define INTEL_FAM4_486_DX4 0x08 +#define INTEL_FAM5_PENTIUM 0x01 // P5 +#define INTEL_FAM5_PENTIUM_MMX 0x04 // P55C +#define INTEL_FAM6_PENTIUM_PRO 0x01 // P6 +#define INTEL_FAM6_PENTIUM_II 0x05 // Deschutes +#define INTEL_FAM6_PENTIUM_III 0x07 // Katmai/Coppermine +#define INTEL_FAM15_P4_WILLY 0x00 // Willamette +#define INTEL_FAM15_P4_NORTH 0x02 // Northwood +#define INTEL_FAM15_P4_PRES 0x03 // Prescott + +typedef struct { + char vendor[13]; + uint32_t family; + uint32_t model; + uint32_t stepping; + uint32_t type; + uint32_t max_leaf; + + // Feature flags (optional, but very helpful later) + bool has_fpu; + bool has_mmx; + bool has_sse; +} cpu_info_t; + +// Function Prototypes +void cpuid(uint32_t leaf, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx); +bool cpu_check_cpuid_support(void); void identify_cpu(void); +// Helper to get the current CPU info after identification +cpu_info_t* cpu_get_info(void); + #endif // CPU_H