Files
Espresso/arch/x86/cpuid_asm.asm
2026-02-12 20:33:46 -06:00

54 lines
988 B
NASM

global get_cpu_brand_string
section .text
; void get_cpu_brand_string(char* buffer)
get_cpu_brand_string:
pushad ; Save registers
mov edi, eax ; EAX = pointer to output buffer
mov eax, 0x80000000
cpuid
cmp eax, 0x80000004
jb .not_supported
mov esi, edi ; Buffer pointer → ESI
; ---- CPUID leaf 0x80000002 ----
mov eax, 0x80000002
cpuid
mov [esi], eax
mov [esi+4], ebx
mov [esi+8], ecx
mov [esi+12], edx
; ---- CPUID leaf 0x80000003 ----
mov eax, 0x80000003
cpuid
mov [esi+16], eax
mov [esi+20], ebx
mov [esi+24], ecx
mov [esi+28], edx
; ---- CPUID leaf 0x80000004 ----
mov eax, 0x80000004
cpuid
mov [esi+32], eax
mov [esi+36], ebx
mov [esi+40], ecx
mov [esi+44], edx
mov byte [esi+48], 0 ; Null terminator
jmp .done
.not_supported:
mov byte [edi], 0
.done:
popad
ret