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

View File

@ -246,24 +246,55 @@ dfl1:
; TEST FOR 386+
mov bx, 0x4000
pushf
pop ax
mov dx, ax
xor ax, bx
push ax
popf
pushf
pop ax
and ax, bx
and dx, bx
cmp ax, dx
jnz cpugood
mov si, not386
mov bx, 0x4000
pushf
pop ax
mov dx, ax
xor ax, bx
push ax
popf
pushf
pop ax
and ax, bx
and dx, bx
cmp ax, dx
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:
call print
jmp $
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 ¨ ­¥ ¯à¥¤®áâ ¢«ï¥â '
@ -59,7 +62,7 @@ curvideo_msg db " [a]
mode0 db "320x200, EGA/CGA 256 梥⮢",13,10,0
mode9 db "640x480, VGA 16 梥⮢",13,10,0
mode9 db "640x480, VGA 16 梥⮢",13,10,0
usebd_msg db " [b] „®¡ ¢¨âì ¤¨áª¨, ¢¨¤¨¬ë¥ ç¥à¥§ BIOS:",0
on_msg db " ¢ª«",13,10,0

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