1
0

check for PSE and BIOS SMAP

git-svn-id: svn://kolibrios.org@838 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2008-07-28 14:49:38 +00:00
parent 2a2b5a8ff8
commit 1146b67279
4 changed files with 58 additions and 52 deletions
kernel/branches/kolibri_pe

View File

@ -258,12 +258,43 @@ dfl1:
and ax, bx
and dx, bx
cmp ax, dx
jnz cpugood
mov si, not386
jz sayerr
xor eax, eax
cpuid
cmp eax, 0
mov si, sz_nopse
jbe sayerr
mov eax, 1
cpuid
bt edx, 3
mov si, sz_nopse
jnc sayerr
xor ebx, ebx
mov es, bx
mov edi, 0x9104
mov ecx, 20
mov edx, 0x534D4150
mov [es:0x9100], ebx
mov eax, 0xe820
int 0x15
mov si, sz_nosmap
jc sayerr
cmp eax, 0x534D4150
je cpugood
sayerr:
call print
jmp $
cpugood:
cpugood:
push 0
popf

View File

@ -13,6 +13,9 @@
$Revision$
sz_nosmap db 'No BIOS memory table. System halted.', 0
sz_nopse db 'Page size extensions not supported. System halted.', 0
d80x25_bottom:
db 186,' KolibriOS is based on MenuetOS and comes with ABSOLUTELY '

View File

@ -13,6 +13,9 @@
$Revision$
sz_nosmap db 'No BIOS memory table. System halted.', 0
sz_nopse db 'Page size extensions not supported. System halted.', 0
d80x25_bottom:
db 186,' Kolibri OS ®á­®¢ ­  ­  Menuet OS ¨ ­¥ ¯à¥¤®áâ ¢«ï¥â '

View File

@ -12,40 +12,13 @@ MEM_WB equ 6 ;write-back memory
MEM_WC equ 1 ;write combined memory
MEM_UC equ 0 ;uncached memory
align 4
proc mem_test
mov eax, cr0
and eax, not (CR0_CD+CR0_NW)
or eax, CR0_CD ;disable caching
mov cr0, eax
wbinvd ;invalidate cache
xor edi, edi
mov ebx, 'TEST'
@@:
add edi, 0x100000
xchg ebx, dword [edi]
cmp dword [edi], 'TEST'
xchg ebx, dword [edi]
je @b
mov [MEM_AMOUNT-OS_BASE], edi
and eax, not (CR0_CD+CR0_NW) ;enable caching
mov cr0, eax
mov eax, edi
ret
endp
align 4
proc init_mem
mov ecx, [0x2F0000 + 0x9100]
test ecx, ecx
jz .nosmap
xor eax, eax
mov esi, 0x2F0000 + 0x9104
xor eax, eax
@@:
cmp dword [esi+16], 1
jne .next
@ -58,13 +31,9 @@ proc init_mem
add esi, 20
loop @B
mov [MEM_AMOUNT-OS_BASE], eax
jmp @F
.nosmap:
call mem_test
and eax, -4096
mov eax, [MEM_AMOUNT-OS_BASE]
@@:
mov [MEM_AMOUNT-OS_BASE], eax
mov [pg_data.mem_amount-OS_BASE], eax
shr eax, 12