-
Notifications
You must be signed in to change notification settings - Fork 3
/
CPU_Manufacturer.asm
86 lines (68 loc) · 1.54 KB
/
CPU_Manufacturer.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
;==============================================================================
;
; UASM64 Library
;
; https://github.com/mrfearless/UASM64-Library
;
;==============================================================================
.686
.MMX
.XMM
.x64
option casemap : none
IF @Platform EQ 1
option win64 : 11
ENDIF
option frame : auto
include UASM64.inc
.DATA
szCPU_Manufacturer_String DB 16 DUP (0)
.CODE
UASM64_ALIGN
;------------------------------------------------------------------------------
; CPU_Manufacturer
;
; Return a string with the CPU manufacturer.
;
; Parameters:
;
; There are no parameters.
;
; Returns:
;
; RAX contains a pointer to a string containing the CPU manufacturer or 0 if
; not supported.
;
; See Also:
;
; CPU_ManufacturerID, CPU_Brand
;
;------------------------------------------------------------------------------
CPU_Manufacturer PROC FRAME USES RBX RCX RDX RDI
Invoke CPU_CPUID_Supported
.IF rax == FALSE
jmp CPU_Manufacturer_Error
.ENDIF
xor rax, rax
xor rbx, rbx
xor rcx, rcx
xor rdx, rdx
mov eax, 0
cpuid
; Zero out string
lea rdi, szCPU_Manufacturer_String
mov rax, 0
mov qword ptr [rdi+00d], rax
mov qword ptr [rdi+08d], rax
; Store vendor string from registers
mov dword ptr [rdi+0], ebx
mov dword ptr [rdi+4], edx
mov dword ptr [rdi+8], ecx
lea rax, szCPU_Manufacturer_String
jmp CPU_Manufacturer_Exit
CPU_Manufacturer_Error:
mov rax, 0
CPU_Manufacturer_Exit:
ret
CPU_Manufacturer ENDP
END