mirror of
https://github.com/subhobhai943/SUB-OS.git
synced 2026-10-25 16:52:29 +00:00
- Implement AArch64 HAL, vector table (16 aligned vectors), GICv2, Generic Timer, Stage-1 MMU (39-bit VA), PL011 UART - Build unified multi-architecture abstraction layer in include/arch/arch.h - Create interactive Linux-like Kconfig TUI menuconfig in scripts/kconfig/menuconfig.py - Support make menuconfig, defconfig, x86_64_defconfig, aarch64_defconfig - Update master Makefile for cross-compiling x86_64 (x86_64-elf-) and AArch64 (aarch64-linux-gnu-) - Dynamic architecture awareness across printk, uname, neofetch, and LazyBox
45 lines
970 B
C
45 lines
970 B
C
#ifndef _ARCH_X86_64_CPUID_H
|
|
#define _ARCH_X86_64_CPUID_H
|
|
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
|
|
typedef struct {
|
|
char vendor[13];
|
|
char model[49];
|
|
uint32_t family;
|
|
uint32_t model_id;
|
|
uint32_t stepping;
|
|
bool has_fpu;
|
|
bool has_tsc;
|
|
bool has_msr;
|
|
bool has_pae;
|
|
bool has_apic;
|
|
bool has_sse;
|
|
bool has_sse2;
|
|
bool has_sse3;
|
|
bool has_sse4_1;
|
|
bool has_sse4_2;
|
|
bool has_avx;
|
|
bool has_rdrand;
|
|
} cpu_info_t;
|
|
|
|
static inline void cpuid(uint32_t leaf, uint32_t* eax, uint32_t* ebx, uint32_t* ecx, uint32_t* edx) {
|
|
#if defined(__x86_64__)
|
|
__asm__ volatile("cpuid"
|
|
: "=a"(*eax), "=b"(*ebx), "=c"(*ecx), "=d"(*edx)
|
|
: "a"(leaf), "c"(0));
|
|
#else
|
|
(void)leaf;
|
|
if (eax) *eax = 0;
|
|
if (ebx) *ebx = 0;
|
|
if (ecx) *ecx = 0;
|
|
if (edx) *edx = 0;
|
|
#endif
|
|
}
|
|
|
|
void cpuid_detect(cpu_info_t* info);
|
|
const cpu_info_t* cpuid_get_info(void);
|
|
|
|
#endif // _ARCH_X86_64_CPUID_H
|