Espresso 0.0.2a
This commit is contained in:
@ -1,44 +1,51 @@
|
||||
.global get_cpu_brand_string
|
||||
global get_cpu_brand_string
|
||||
|
||||
.type get_cpu_brand_string, @function
|
||||
section .text
|
||||
|
||||
; void get_cpu_brand_string(char* buffer)
|
||||
|
||||
get_cpu_brand_string:
|
||||
pushad # Save all general-purpose registers
|
||||
pushad ; Save registers
|
||||
|
||||
mov ebx, eax # Save buffer pointer to ebx
|
||||
mov edi, eax ; EAX = pointer to output buffer
|
||||
|
||||
mov eax, 0x80000000
|
||||
cpuid
|
||||
cmp eax, 0x80000004 # Check if brand string is supported
|
||||
cmp eax, 0x80000004
|
||||
jb .not_supported
|
||||
|
||||
mov esi, ebx # Copy address to ESI
|
||||
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
|
||||
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
|
||||
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 [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 [ebx], 0 # Null-terminate if not supported
|
||||
mov byte [edi], 0
|
||||
|
||||
.done:
|
||||
popad
|
||||
|
||||
Reference in New Issue
Block a user