-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhelpers.asm
More file actions
76 lines (66 loc) · 1.11 KB
/
helpers.asm
File metadata and controls
76 lines (66 loc) · 1.11 KB
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
.586
.MODEL FLAT,SYSCALL
ASSUME ds:FLAT
ASSUME es:FLAT
.DATA
defString DB 'unknown CPU',0
.CODE
cpuGetBrandString PROC PUBLIC USES ebx esi edi,buf:DWORD,buflen:DWORD
mov ecx,buflen
cmp ecx,48
jbe end
mov edi,buf
mov eax,80000000h
cpuid
cmp eax,80000004h
jb short @F
mov eax,80000002h
cpuid
mov [edi],eax
mov [edi+4],ebx
mov [edi+8],ecx
mov [edi+12],edx
add edi,16
mov eax,80000003h
cpuid
mov [edi],eax
mov [edi+4],ebx
mov [edi+8],ecx
mov [edi+12],edx
add edi,16
mov eax,80000004h
cpuid
mov [edi],eax
mov [edi+4],ebx
mov [edi+8],ecx
mov [edi+12],edx
add edi,15
eos:
cmp BYTE PTR [edi],' '
jne terminate
dec edi
jmp eos
terminate:
inc edi
xor eax,eax
mov BYTE PTR [edi],al
jmp end
@@:
mov ecx,buflen
mov eax,ds
mov es,eax
xor eax,eax
lea edi,defString
cld
repnz scasb
mov eax,buflen
sub eax,ecx
mov ecx,eax
lea esi,defString
mov edi,buf
cld
rep movsb
end:
ret
cpuGetBrandString ENDP
END