@@ -25,7 +25,7 @@ int g_maxCPUID;
2525BOOL g_CPU_supports_MMX;
2626
2727// GLOBAL: GOLDP 0x10065ee4
28- char g_cpuManufacturer[13 ];
28+ char g_cpuManufacturer[16 ];
2929
3030// STUB: GOLDP 0x10032b80
3131void SetGolImport (GolImport* p_import)
@@ -62,43 +62,43 @@ NAKED void DetectCPU()
6262#ifdef _MSC_VER
6363#ifdef _M_IX86
6464 __asm {
65- push ebx ; Save ebx register (eax, ecx, edx are caller saved)
66- pushfd ; Push EFLAGS register on the stack
67- pop eax ; EAX = EFLAGS value
68- mov edx, eax ; EDX = EAX = EFLAGS value
69- xor eax, 0x200000 ; EDX = EFLAGS value, EAX = EFLAGS ^ 0x200000
70- push eax ; Push modified EFLAGS value to the stack
71- popfd ; Set the EFLAGS register to the modified value
72- pushfd ; Push EFLAGS regsiter on the stack (again)
73- pop eax ; EAX = current EFLAGS value; EDX = previous EFLAGS value
74- cmp eax, edx ; Compre current and modified EFLAGS value
75- jz no_cpuid ; If they are identical, then the CPU does not support CPUID
76-
77- xor eax, eax ; EAX =0 : Highest Function Parameter and Manufacturer ID
65+ push ebx ; Save ebx register (eax, ecx, edx are caller saved)
66+ pushfd ; Push EFLAGS register on the stack
67+ pop eax ; EAX = EFLAGS value
68+ mov edx, eax ; EDX = EAX = EFLAGS value
69+ xor eax, 0x200000 ; EDX = EFLAGS value, EAX = EFLAGS ^ 0x200000
70+ push eax ; Push modified EFLAGS value to the stack
71+ popfd ; Set the EFLAGS register to the modified value
72+ pushfd ; Push EFLAGS regsiter on the stack (again)
73+ pop eax ; EAX = current EFLAGS value; EDX = previous EFLAGS value
74+ cmp eax, edx ; Compre current and modified EFLAGS value
75+ jz no_cpuid ; If they are identical, then the CPU does not support CPUID
76+
77+ xor eax, eax ; EAX =0 : Highest Function Parameter and Manufacturer ID
7878#if _MSC_VER > 1300
79- cpuid ; Run CPUID (0 ) [Highest Function Parameter and Manufacturer ID ]
79+ cpuid ; Run CPUID (0 ) [Highest Function Parameter and Manufacturer ID ]
8080#else
8181 __emit 0x0f
8282 __emit 0xa2
8383#endif
84- mov [g_maxCPUID],eax ; CPUID (0 ) -> EAX = Highest Function Parameter (=maximum EAX for CPUID )
85- mov dword ptr 0 [g_cpuManufacturer],ebx ; CPUID (0 ) -> EBX = characters [0 ,3 ] of manufacturer ID
86- xor eax,eax ; EAX = 0
87- mov dword ptr 4 [g_cpuManufacturer],edx ; CPUID (0 ) -> EDX = characters [4 ,7 ] of manufacturer ID
88- mov 12 [g_cpuManufacturer], al ; Set terminating zero
89- inc eax ; EAX = 1
90- mov dword ptr 8 [g_cpuManufacturer],ecx ; CPUID (0 ) -> ECX = characters [8 ,12 ] of manufacturer ID
91- mov [g_CPUID_detected],eax ; Store we succesfully detected cpuid
84+ mov [g_maxCPUID],eax ; CPUID (0 ) -> EAX = Highest Function Parameter (=maximum EAX for CPUID )
85+ mov dword ptr 0 [g_cpuManufacturer],ebx ; CPUID (0 ) -> EBX = characters [0 ,3 ] of manufacturer ID
86+ xor eax,eax ; EAX = 0
87+ mov dword ptr 4 [g_cpuManufacturer],edx ; CPUID (0 ) -> EDX = characters [4 ,7 ] of manufacturer ID
88+ mov dword ptr 12 [g_cpuManufacturer], eax ; Set terminating zero
89+ inc eax ; EAX = 1
90+ mov dword ptr 8 [g_cpuManufacturer],ecx ; CPUID (0 ) -> ECX = characters [8 ,12 ] of manufacturer ID
91+ mov [g_CPUID_detected],eax ; Store we succesfully detected cpuid
9292
9393#if _MSC_VER > 1300
94- cpuid ; Run CPUID (1 ) [Processor Info and Feature Bits]
94+ cpuid ; Run CPUID (1 ) [Processor Info and Feature Bits]
9595#else
9696 __emit 0x0f
9797 __emit 0xa2
9898#endif
99- and edx,0x800000 ; Mask bit 23 of EDX : mmx feature (=64 -bit SIMD )
100- shr edx,0x17 ; Convert mmx feature bit to boolean
101- mov dword ptr [g_CPU_supports_MMX],edx ; Store MMX feature
99+ and edx,0x800000 ; Mask bit 23 of EDX : mmx feature (=64 -bit SIMD )
100+ shr edx,0x17 ; Convert mmx feature bit to boolean
101+ mov dword ptr [g_CPU_supports_MMX],edx ; Store MMX feature
102102
103103 no_cpuid:
104104 pop ebx ; Restore EBX
0 commit comments