From 1146b672793f55474bfddbe2639c0d4ee708e7c9 Mon Sep 17 00:00:00 2001 From: "Sergey Semyonov (Serge)" Date: Mon, 28 Jul 2008 14:49:38 +0000 Subject: [PATCH] check for PSE and BIOS SMAP git-svn-id: svn://kolibrios.org@838 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/branches/kolibri_pe/boot/bootcode.inc | 65 +++++++++++++++----- kernel/branches/kolibri_pe/boot/booteng.inc | 3 + kernel/branches/kolibri_pe/boot/bootru.inc | 5 +- kernel/branches/kolibri_pe/init.inc | 37 +---------- 4 files changed, 58 insertions(+), 52 deletions(-) diff --git a/kernel/branches/kolibri_pe/boot/bootcode.inc b/kernel/branches/kolibri_pe/boot/bootcode.inc index 74581fc9db..7f8b3eb914 100644 --- a/kernel/branches/kolibri_pe/boot/bootcode.inc +++ b/kernel/branches/kolibri_pe/boot/bootcode.inc @@ -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 diff --git a/kernel/branches/kolibri_pe/boot/booteng.inc b/kernel/branches/kolibri_pe/boot/booteng.inc index aa7fc2f3f3..b9771dfdd6 100644 --- a/kernel/branches/kolibri_pe/boot/booteng.inc +++ b/kernel/branches/kolibri_pe/boot/booteng.inc @@ -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 ' diff --git a/kernel/branches/kolibri_pe/boot/bootru.inc b/kernel/branches/kolibri_pe/boot/bootru.inc index 619c780f85..91f7d881e3 100644 --- a/kernel/branches/kolibri_pe/boot/bootru.inc +++ b/kernel/branches/kolibri_pe/boot/bootru.inc @@ -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 diff --git a/kernel/branches/kolibri_pe/init.inc b/kernel/branches/kolibri_pe/init.inc index ddc2cb2aa3..7234942ee6 100644 --- a/kernel/branches/kolibri_pe/init.inc +++ b/kernel/branches/kolibri_pe/init.inc @@ -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