345,6 → 345,9 |
proc test_cpu |
locals |
cpu_type dd ? |
cpu_id dd ? |
cpu_Intel dd ? |
cpu_AMD dd ? |
endl |
|
xor eax, eax |
351,7 → 354,6 |
mov [cpu_type], eax |
mov [cpu_caps-OS_BASE], eax |
mov [cpu_caps+4-OS_BASE], eax |
mov [cpu_phys_addr_width-OS_BASE], 32 |
|
pushfd |
pop eax |
376,6 → 378,7 |
pop eax |
xor eax, ecx |
je .end_cpuid |
mov [cpu_id], 1 |
|
xor eax, eax |
cpuid |
383,7 → 386,13 |
mov [cpu_vendor-OS_BASE], ebx |
mov [cpu_vendor+4-OS_BASE], edx |
mov [cpu_vendor+8-OS_BASE], ecx |
|
cmp ebx, dword [intel_str-OS_BASE] |
jne .check_AMD |
cmp edx, dword [intel_str+4-OS_BASE] |
jne .check_AMD |
cmp ecx, dword [intel_str+8-OS_BASE] |
jne .check_AMD |
mov [cpu_Intel], 1 |
cmp eax, 1 |
jl .end_cpuid |
mov eax, 1 |
393,20 → 402,6 |
mov [cpu_caps-OS_BASE], edx |
mov [cpu_caps+4-OS_BASE], ecx |
|
bt edx, CAPS_PAE |
jnc @f |
mov [cpu_phys_addr_width-OS_BASE], 36 |
@@: |
mov eax, 0x80000000 |
cpuid |
cmp eax, 0x80000008 |
jb @f |
mov eax, 0x80000008 |
cpuid |
mov [cpu_phys_addr_width-OS_BASE], al |
@@: |
|
mov eax, [cpu_sign-OS_BASE] |
shr eax, 8 |
and eax, 0x0f |
ret |
413,6 → 408,36 |
.end_cpuid: |
mov eax, [cpu_type] |
ret |
|
.check_AMD: |
cmp ebx, dword [AMD_str-OS_BASE] |
jne .unknown |
cmp edx, dword [AMD_str+4-OS_BASE] |
jne .unknown |
cmp ecx, dword [AMD_str+8-OS_BASE] |
jne .unknown |
mov [cpu_AMD], 1 |
cmp eax, 1 |
jl .unknown |
mov eax, 1 |
cpuid |
mov [cpu_sign-OS_BASE], eax |
mov [cpu_info-OS_BASE], ebx |
mov [cpu_caps-OS_BASE], edx |
mov [cpu_caps+4-OS_BASE], ecx |
shr eax, 8 |
and eax, 0x0f |
ret |
.unknown: |
mov eax, 1 |
cpuid |
mov [cpu_sign-OS_BASE], eax |
mov [cpu_info-OS_BASE], ebx |
mov [cpu_caps-OS_BASE], edx |
mov [cpu_caps+4-OS_BASE], ecx |
shr eax, 8 |
and eax, 0x0f |
ret |
endp |
|
iglobal |