Espresso 0.0.2a
This commit is contained in:
46
arch/x86/cpuid_asm.asm
Normal file
46
arch/x86/cpuid_asm.asm
Normal file
@ -0,0 +1,46 @@
|
||||
.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
|
||||
|
||||
Reference in New Issue
Block a user