19 |
; * along with this program ; if not, write to the Free Software |
; * along with this program ; if not, write to the Free Software |
20 |
; * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
; * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
21 |
; * |
; * |
22 |
; * $Id: cpuid.asm,v 1.5 2004-03-22 22:36:24 edgomez Exp $ |
; * $Id: cpuid.asm,v 1.8 2004-08-22 11:46:10 edgomez Exp $ |
23 |
; * |
; * |
24 |
; ***************************************************************************/ |
; ***************************************************************************/ |
25 |
|
|
27 |
|
|
28 |
%macro cglobal 1 |
%macro cglobal 1 |
29 |
%ifdef PREFIX |
%ifdef PREFIX |
30 |
|
%ifdef MARK_FUNCS |
31 |
|
global _%1:function |
32 |
|
%define %1 _%1:function |
33 |
|
%else |
34 |
global _%1 |
global _%1 |
35 |
%define %1 _%1 |
%define %1 _%1 |
36 |
|
%endif |
37 |
|
%else |
38 |
|
%ifdef MARK_FUNCS |
39 |
|
global %1:function |
40 |
%else |
%else |
41 |
global %1 |
global %1 |
42 |
%endif |
%endif |
43 |
|
%endif |
44 |
%endmacro |
%endmacro |
45 |
|
|
46 |
;============================================================================= |
;============================================================================= |
71 |
|
|
72 |
ALIGN 32 |
ALIGN 32 |
73 |
%ifdef FORMAT_COFF |
%ifdef FORMAT_COFF |
74 |
SECTION .rodata data |
SECTION .rodata |
75 |
%else |
%else |
76 |
SECTION .rodata data align=16 |
SECTION .rodata align=16 |
77 |
%endif |
%endif |
78 |
|
|
79 |
vendorAMD: |
vendorAMD: |
108 |
push edi |
push edi |
109 |
push ebp |
push ebp |
110 |
|
|
111 |
|
sub esp, 12 ; Stack space for vendor name |
112 |
|
|
113 |
xor ebp, ebp |
xor ebp, ebp |
114 |
|
|
115 |
; CPUID command ? |
; CPUID command ? |
129 |
; get vendor string, used later |
; get vendor string, used later |
130 |
xor eax, eax |
xor eax, eax |
131 |
cpuid |
cpuid |
132 |
mov [esp-12], ebx ; vendor string |
mov [esp], ebx ; vendor string |
133 |
mov [esp-12+4], edx |
mov [esp+4], edx |
134 |
mov [esp-12+8], ecx |
mov [esp+8], ecx |
135 |
test eax, eax |
test eax, eax |
136 |
|
|
137 |
jz near .cpu_quit |
jz near .cpu_quit |
162 |
|
|
163 |
; AMD cpu ? |
; AMD cpu ? |
164 |
lea esi, [vendorAMD] |
lea esi, [vendorAMD] |
165 |
lea edi, [esp-12] |
lea edi, [esp] |
166 |
mov ecx, 12 |
mov ecx, 12 |
167 |
cld |
cld |
168 |
repe cmpsb |
repe cmpsb |
181 |
|
|
182 |
mov eax, ebp |
mov eax, ebp |
183 |
|
|
184 |
|
add esp, 12 |
185 |
|
|
186 |
pop ebp |
pop ebp |
187 |
pop edi |
pop edi |
188 |
pop esi |
pop esi |