Files
Espresso/arch/x86/cpuid_asm.asm

47 lines
914 B
NASM
Raw Permalink Normal View History

2025-10-20 21:57:30 -05:00
.global get_cpu_brand_string
.type get_cpu_brand_string, @function
get_cpu_brand_string:
pushad # Save all general-purpose registers
mov ebx, eax # Save buffer pointer to ebx
mov eax, 0x80000000
cpuid
cmp eax, 0x80000004 # Check if brand string is supported
jb .not_supported
mov esi, ebx # Copy address to ESI
mov eax, 0x80000002
cpuid
mov [esi], eax
mov [esi + 4], ebx
mov [esi + 8], ecx
mov [esi + 12], edx
mov eax, 0x80000003
cpuid
mov [esi + 16], eax
mov [esi + 20], ebx
mov [esi + 24], ecx
mov [esi + 28], edx
mov eax, 0x80000004
cpuid
mov [esi + 32], eax
mov [esi + 36], ebx
mov [esi + 40], ecx
mov [esi + 44], edx
jmp .done
.not_supported:
mov byte [ebx], 0 # Null-terminate if not supported
.done:
popad
ret