forked from KolibriOS/kolibrios
test_cpu: simplify & detect physical address width
git-svn-id: svn://kolibrios.org@4593 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
dc04bfc89f
commit
39d0c4cbda
@ -147,9 +147,6 @@ msg_www db 'please visit www.kolibrios.org',13,10,0
|
||||
end if
|
||||
msg_CR db 13,10,0
|
||||
|
||||
intel_str db "GenuineIntel",0
|
||||
AMD_str db "AuthenticAMD",0
|
||||
|
||||
szHwMouse db 'ATI2D',0
|
||||
szPS2MDriver db 'PS2MOUSE',0
|
||||
;szCOM_MDriver db 'COM_MOUSE',0
|
||||
@ -551,6 +548,7 @@ debug_step_pointer rd 1
|
||||
lba_read_enabled rd 1 ; 0 = disabled , 1 = enabled
|
||||
pci_access_enabled rd 1 ; 0 = disabled , 1 = enabled
|
||||
|
||||
cpu_phys_addr_width rb 1 ; also known as MAXPHYADDR in Intel manuals
|
||||
hdd_appl_data rb 1 ; 0 = system cache, 1 - application cache
|
||||
cd_appl_data rb 1 ; 0 = system cache, 1 - application cache
|
||||
|
||||
|
@ -345,15 +345,13 @@ align 4
|
||||
proc test_cpu
|
||||
locals
|
||||
cpu_type dd ?
|
||||
cpu_id dd ?
|
||||
cpu_Intel dd ?
|
||||
cpu_AMD dd ?
|
||||
endl
|
||||
|
||||
xor eax, eax
|
||||
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
|
||||
@ -378,7 +376,6 @@ proc test_cpu
|
||||
pop eax
|
||||
xor eax, ecx
|
||||
je .end_cpuid
|
||||
mov [cpu_id], 1
|
||||
|
||||
xor eax, eax
|
||||
cpuid
|
||||
@ -386,13 +383,7 @@ proc test_cpu
|
||||
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
|
||||
@ -402,42 +393,26 @@ proc test_cpu
|
||||
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
|
||||
.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
|
||||
|
Loading…
Reference in New Issue
Block a user