Files
pepperOS/src/arch/x86/cpuid.c
2026-03-20 10:04:16 +01:00

21 lines
563 B
C

/*
* @author xamidev <xamidev@riseup.net>
* @brief x86 CPU identification
* @license GPL-3.0-only
*/
#include <stdint.h>
#include <stddef.h>
/*
* cpuid - Wrapper for CPUID instruction
* @leaf: Requested leaf (input EAX)
* @eax: EAX register value (output)
* @ebx: EBX register value (output)
* @ecx: ECX register value (output)
* @edx: EDX register value (output)
*/
void cpuid(uint32_t leaf, uint32_t* eax, uint32_t* ebx, uint32_t* ecx, uint32_t* edx)
{
__asm__ volatile("cpuid" : "=a"(*eax), "=b"(*ebx), "=c"(*ecx), "=d"(*edx) : "a"(leaf));
}