GRUB Now!!!

git-svn-id: svn://kolibrios.org@848 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2008-08-08 13:30:55 +00:00
parent ebacfa0899
commit 7cb2a21b33
16 changed files with 186 additions and 552 deletions

View File

@ -891,6 +891,7 @@ rd_find_lfn:
;
;--------------------------------------------------------------
fs_RamdiskRead:
cmp byte [esi], 0
jnz @f
or ebx, -1

View File

@ -20,6 +20,7 @@ $Revision$
;
;==========================================================================
use16
putchar:
; in: al=character
@ -124,6 +125,11 @@ conv_abs_to_THS:
mov dl,0 ; dl=0 (drive 0 (a:))
pop bx
retn
sayerr:
call print
jmp $
; needed variables
BPB_SecPerTrk dw 0 ; sectors per track
BPB_NumHeads dw 0 ; number of heads
@ -147,34 +153,22 @@ FirstDataSector dw 0 ; begin of data
include 'bootvesa.inc' ;Include source for boot vesa
start_of_code:
cld
; \begin{diamond}[02.12.2005]
; if bootloader sets ax = 'KL', then ds:si points to loader block
cmp ax, 'KL'
jnz @f
mov word [cs:cfgmanager.loader_block], si
mov word [cs:cfgmanager.loader_block+2], ds
@@:
; \end{diamond}[02.12.2005]
; if bootloader sets cx = 'HA' and dx = 'RD', then bx contains identifier of source hard disk
; (see comment to bx_from_load)
cmp cx, 'HA'
jnz no_hd_load
cmp dx,'RD'
jnz no_hd_load
mov word [cs:bx_from_load], bx ; {SPraid}[13.03.2007]
no_hd_load:
xor ecx, ecx
xor edx, edx
xor esi, esi
xor edi, edi
xor ebp, ebp
; set up stack
mov ax, 3000h
mov ss, ax
mov sp, 0EC00h
; set up segment registers
push cs
pop ds
push cs
pop es
mov eax, 0x3000
mov ss, ax
mov esp, 0EC00h
mov ebx, 0x1000
mov ds, bx
mov es, bx
; set videomode
mov ax, 3
@ -218,6 +212,7 @@ end if
lodsb
stosw
loop @b
; draw spaces
mov si, space_msg
mov dx, 25 - d80x25_top_num - d80x25_bottom_num
@ -243,66 +238,10 @@ dfl1:
_setcursor d80x25_top_num,0
; 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
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:
push 0
popf
sti
; set up esp
movzx esp, sp
push 0
pop es
and word [es:0x9031], 0
@ -409,13 +348,6 @@ wait_loop: ; variant 2
apm_end:
_setcursor d80x25_top_num, 0
;CHECK current of code
cmp [cfgmanager.loader_block], -1
jz noloaderblock
les bx, [cfgmanager.loader_block]
cmp byte [es:bx], 1
mov si, loader_block_error
jnz sayerr
push 0
pop es
@ -425,7 +357,6 @@ noloaderblock:
call calc_vmodes_table
call check_first_parm ;check and enable cursor_pos
; \begin{diamond}[30.11.2005]
cfgmanager:
; settings:
@ -829,368 +760,6 @@ end if
mov al, [preboot_dma]
mov [es:0x901F], al
; VRR_M USE
mov al,[preboot_vrrm]
mov [es:0x9030], al
mov [es:0x901E], byte 1
; BOOT DEVICE
mov al, [preboot_device]
dec al
mov [boot_dev], al
; READ DISKETTE TO MEMORY
; cmp [boot_dev],0
jne no_sys_on_floppy
mov si,diskload
call print
xor ax, ax ; reset drive
xor dx, dx
int 0x13
; do we boot from CD-ROM?
mov ah, 41h
mov bx, 55AAh
xor dx, dx
int 0x13
jc .nocd
cmp bx, 0AA55h
jnz .nocd
mov ah, 48h
push ds
push es
pop ds
mov si, 0xa000
mov word [si], 30
int 0x13
pop ds
jc .nocd
push ds
lds si, [es:si+26]
test byte [ds:si+10], 40h
pop ds
jz .nocd
; yes - read all floppy by 18 sectors
; TODO: !!!! read only first sector and set variables !!!!!
; ...
; TODO: !!! then read flippy image track by track
mov cx, 0x0001 ; startcyl,startsector
.a1:
push cx dx
mov al, 18
mov bx, 0xa000
call boot_read_floppy
mov si, movedesc
push es
push ds
pop es
mov cx, 256*18
mov ah, 0x87
int 0x15
pop es
pop dx cx
test ah, ah
jnz sayerr_floppy
add dword [si+8*3+2], 512*18
inc dh
cmp dh, 2
jnz .a1
mov dh, 0
inc ch
cmp ch, 80
jae ok_sys_on_floppy
pusha
mov al, ch
shr ch, 2
add al, ch
aam
xchg al, ah
add ax, '00'
mov si, pros
mov [si], ax
call printplain
popa
jmp .a1
.nocd:
; no - read only used sectors from floppy
; now load floppy image to memory
; at first load boot sector and first FAT table
; read only first sector and fill variables
mov cx, 0x0001 ; first logical sector
xor dx, dx ; head = 0, drive = 0 (a:)
mov al, 1 ; read one sector
mov bx, 0xB000 ; es:bx -> data area
call boot_read_floppy
; fill the necessary parameters to work with a floppy
mov ax, word [es:bx+24]
mov word [BPB_SecPerTrk], ax
mov ax, word [es:bx+26]
mov word [BPB_NumHeads], ax
mov ax, word [es:bx+22]
mov word [BPB_FATSz16], ax
mov ax, word [es:bx+17]
mov word [BPB_RootEntCnt], ax
mov ax, word [es:bx+11]
mov word [BPB_BytsPerSec], ax
mov ax, word [es:bx+14]
mov word [BPB_RsvdSecCnt], ax
mov ax, word [es:bx+19]
mov word [BPB_TotSec16], ax
mov al, byte [es:bx+13]
mov byte [BPB_SecPerClus], al
mov al, byte [es:bx+16]
mov byte [BPB_NumFATs], al
; count of clusters in FAT12 ((size_of_FAT*2)/3)
mov ax, word [BPB_FATSz16]
mov cx, word [BPB_BytsPerSec]
xor dx, dx
mul cx
shl ax, 1
mov cx, 3
div cx ; now ax - number of clusters in FAT12
mov word [end_of_FAT], ax
; load first FAT table
mov cx, 0x0002 ; startcyl,startsector ; TODO!!!!!
xor dx, dx ; starthead,drive
mov al, byte [BPB_FATSz16] ; no of sectors to read
add bx, word [BPB_BytsPerSec] ; es:bx -> data area
call boot_read_floppy
mov bx, 0xB000
; and copy them to extended memory
mov si, movedesc
mov [si+8*2+3], bh ; from
mov ax, word [BPB_BytsPerSec]
shr ax, 1 ; words per sector
mov cx, word [BPB_RsvdSecCnt]
add cx, word [BPB_FATSz16]
mul cx
push ax ; save to stack count of words in boot+FAT
xchg ax, cx
push es
push ds
pop es
mov ah, 0x87
int 0x15
pop es
test ah, ah
jz @f
sayerr_floppy:
mov dx, 0x3f2
mov al, 0
out dx, al
mov si, memmovefailed
jmp sayerr_plain
@@:
pop ax ; restore from stack count of words in boot+FAT
shl ax, 1 ; make bytes count from count of words
and eax, 0ffffh
add dword [si+8*3+2], eax
; copy first FAT to second copy
; TODO: BPB_NumFATs !!!!!
add bx, word [BPB_BytsPerSec] ; !!! TODO: may be need multiply by BPB_RsvdSecCnt !!!
mov byte [si+8*2+3], bh ; bx - begin of FAT
mov ax, word [BPB_BytsPerSec]
shr ax, 1 ; words per sector
mov cx, word [BPB_FATSz16]
mul cx
mov cx, ax ; cx - count of words in FAT
push es
push ds
pop es
mov ah, 0x87
int 0x15
pop es
test ah, ah
jnz sayerr_floppy
mov ax, cx
shl ax, 1
and eax, 0ffffh ; ax - count of bytes in FAT
add dword [si+8*3+2], eax
; reading RootDir
; TODO: BPB_NumFATs
add bx, ax
add bx, 100h
and bx, 0ff00h ; bx - place in buffer to write RootDir
push bx
mov bx, word [BPB_BytsPerSec]
shr bx, 5 ; divide bx by 32
mov ax, word [BPB_RootEntCnt]
xor dx, dx
div bx
push ax ; ax - count of RootDir sectors
mov ax, word [BPB_FATSz16]
xor cx, cx
mov cl, byte [BPB_NumFATs]
mul cx
add ax, word [BPB_RsvdSecCnt] ; ax - first sector of RootDir
mov word [FirstDataSector], ax
pop bx
push bx
add word [FirstDataSector], bx ; Begin of data region of floppy
; read RootDir
call conv_abs_to_THS
pop ax
pop bx ; place in buffer to write
push ax
call boot_read_floppy ; read RootDir into buffer
; copy RootDir
mov byte [si+8*2+3], bh ; from buffer
pop ax ; ax = count of RootDir sectors
mov cx, word [BPB_BytsPerSec]
mul cx
shr ax, 1
mov cx, ax ; count of words to copy
push es
push ds
pop es
mov ah, 0x87
int 0x15
pop es
mov ax, cx
shl ax, 1
and eax, 0ffffh ; ax - count of bytes in RootDir
add dword [si+8*3+2], eax ; add count of bytes copied
; Reading data clusters from floppy
mov byte [si+8*2+3], bh
push bx
mov di, 2 ; First data cluster
.read_loop:
mov bx, di
shr bx, 1 ; bx+di = di*1.5
jnc .even
test word [es:bx+di+0xB200], 0xFFF0 ; TODO: may not be 0xB200 !!!
jmp @f
.even:
test word [es:bx+di+0xB200], 0xFFF ; TODO: may not be 0xB200 !!!
@@:
jz .skip
; read cluster di
;.read:
;conv cluster di to abs. sector ax
; ax = (N-2) * BPB_SecPerClus + FirstDataSector
mov ax, di
sub ax, 2
xor bx, bx
mov bl, byte [BPB_SecPerClus]
mul bx
add ax, word [FirstDataSector]
call conv_abs_to_THS
pop bx
push bx
mov al, byte [BPB_SecPerClus] ; number of sectors in cluster
call boot_read_floppy
push es
push ds
pop es
pusha
;
mov ax, word [BPB_BytsPerSec]
xor cx, cx
mov cl, byte [BPB_SecPerClus]
mul cx
shr ax, 1 ; ax = (BPB_BytsPerSec * BPB_SecPerClus)/2
mov cx, ax ; number of words to copy (count words in cluster)
;
mov ah, 0x87
int 0x15 ; copy data
test ah, ah
popa
pop es
jnz sayerr_floppy
; skip cluster di
.skip:
mov ax, word [BPB_BytsPerSec]
xor cx, cx
mov cl, byte [BPB_SecPerClus]
mul cx
and eax, 0ffffh ; ax - count of bytes in cluster
add dword [si+8*3+2], eax
mov ax, word [end_of_FAT] ; max cluster number
pusha
; draw percentage
; total clusters: ax
; read clusters: di
xchg ax, di
mov cx, 100
mul cx
div di
aam
xchg al, ah
add ax, '00'
mov si, pros
cmp [si], ax
jz @f
mov [si], ax
call printplain
@@:
popa
inc di
cmp di, word [end_of_FAT] ; max number of cluster
jnz .read_loop
pop bx ; clear stack
ok_sys_on_floppy:
mov si, backspace2
call printplain
mov si, okt
call printplain
no_sys_on_floppy:
xor ax, ax ; reset drive
xor dx, dx
int 0x13
mov dx, 0x3f2 ; floppy motor off
mov al, 0
out dx, al
; GET SMAP
xor ebx, ebx
mov es, bx
mov edi, 0x9104
mov ecx, 20
mov edx, 0x534D4150
@@:
mov [es:0x9100], ebx
mov eax, 0xe820
int 0x15
jc .nosmap
cmp eax, 0x534D4150
jne .nosmap
test ebx, ebx
jz .nosmap
add edi, ecx
jmp @B
.nosmap:
; SET GRAPHICS
xor ax, ax
@ -1234,3 +803,4 @@ setgr:
gmok2:
push ds
pop es

View File

@ -13,10 +13,6 @@
$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 ¨ ­¥ ¯à¥¤®áâ ¢«ï¥â '
db '­¨ª ª¨å £ àa­â¨©. ',186

View File

@ -31,8 +31,8 @@ preboot_device db 0 ; boot device
preboot_blogesc = 0 ; start immediately after bootlog
preboot_biosdisk db 2 ; use V86 to access disks through BIOS (1-yes, 2-no)
if $>0x200
ERROR: prebooting parameters must fit in first sector!!!
end if
; if $>0x200
;ERROR: prebooting parameters must fit in first sector!!!
; end if
hdsysimage db 'KOLIBRI IMG' ; load from
image_save db 'KOLIBRI IMG' ; save to

View File

@ -198,6 +198,7 @@ OS_TEMP equ 0xDFC00000
kernel_tabs equ (page_tabs+ (OS_BASE shr 10)) ;0xFDE00000
master_tab equ (page_tabs+ (page_tabs shr 10)) ;0xFDFF70000
LOAD_BASE equ 0x00100000
OS_BASE equ 0xE0000000
window_data equ OS_BASE
@ -283,7 +284,7 @@ TMP_STACK_TOP equ 0x006CC00
FONT_II equ (OS_BASE+0x006DC00)
FONT_I equ (OS_BASE+0x006E600)
sys_pgdir equ (OS_BASE+0x006F000)
;sys_pgdir equ (OS_BASE+0x006F000)
DRIVE_DATA equ (OS_BASE+0x0070000)

View File

@ -245,15 +245,15 @@ proc init_LFB
mov eax, [LFBAddress]
or eax, PG_LARGE+PG_UW
mov [sys_pgdir+(LFB_BASE shr 20)], eax
mov [_sys_pdbr+(LFB_BASE shr 20)], eax
add eax, 0x00400000
mov [sys_pgdir+4+(LFB_BASE shr 20)], eax
mov [_sys_pdbr+4+(LFB_BASE shr 20)], eax
mov dword [exp_lfb+4], LFB_BASE
bt [cpu_caps], CAPS_PGE
jnc @F
or dword [sys_pgdir+(LFB_BASE shr 20)], PG_GLOBAL
or dword [_sys_pdbr+(LFB_BASE shr 20)], PG_GLOBAL
@@:
mov dword [LFBAddress], LFB_BASE
mov eax, cr3 ;flush TLB
@ -462,7 +462,7 @@ proc page_fault_handler
.lfb:
shr ebx, 22
mov edx, [sys_pgdir + ebx*4]
mov edx, [_sys_pdbr + ebx*4]
mov [master_tab + ebx*4], edx
jmp .exit
@ -483,7 +483,7 @@ align 4
jz .check_ptab ;òàáëèöà ñòðàíèö íå ñîçäàíà
.check_ptab:
mov edx, [sys_pgdir + ebx*4]
mov edx, [_sys_pdbr + ebx*4]
test edx, PG_MAP
jnz @F
@ -498,7 +498,7 @@ align 4
cld
rep stosd
mov [sys_pgdir + ebx*4], edx
mov [_sys_pdbr + ebx*4], edx
@@:
mov [master_tab + ebx*4], edx
jmp .exit

View File

@ -395,7 +395,7 @@ proc create_app_space stdcall, app_size:dword,img_base:dword,img_size:dword
rep stosd
mov ecx, 1024-(OS_BASE shr 20)/4
mov esi, sys_pgdir+(OS_BASE shr 20)
mov esi, _sys_pdbr+(OS_BASE shr 20)
rep movsd
mov edi, [dir_addr]

View File

@ -78,7 +78,7 @@ v86_create:
; thx to Serge, system is located at high addresses
add edi, (OS_BASE shr 20) - 4
push esi
mov esi, (OS_BASE shr 20) + sys_pgdir
mov esi, (OS_BASE shr 20) + _sys_pdbr
mov ecx, 0x80000000 shr 22
rep movsd

View File

@ -29,17 +29,6 @@ kernel_restart_bootblock:
; table for move to extended memory (int 15h, ah=87h)
align 8
movedesc:
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
db 0xff,0xff,0x0,0xa0,0x00,0x93,0x0,0x0
db 0xff,0xff,0x0,0x00,0x10,0x93,0x0,0x0
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
fwmovedesc:
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0

View File

@ -99,8 +99,8 @@ szIMPORTS db 'IMPORTS',0
read_firstapp db '/sys/'
firstapp db 'LAUNCHER',0
char db '/sys/FONTS/CHAR.MT',0
char2 db '/sys/FONTS/CHAR2.MT',0
char db '/rd/1/FONTS/CHAR.MT',0
char2 db '/rd/1/FONTS/CHAR2.MT',0
bootpath db '/KOLIBRI '
bootpath2 db 0
@ -135,9 +135,9 @@ mode_320_240_8:
dw 320,240,8,60
bx_from_load: dw 'r1' ; структура для хранения параметров- откуда гашрузились, берется ниже из bx ; {SPraid}[13.03.2007]
; a,b,c,d - винчестеры, r - рам диск
; # диска... символ, а не байт. '1', а не 1
;bx_from_load: dw 'r1' ; структура для хранения параметров- откуда гашрузились, берется ниже из bx ; {SPraid}[13.03.2007]
; ; a,b,c,d - винчестеры, r - рам диск
; ; # диска... символ, а не байт. '1', а не 1
@ -259,16 +259,21 @@ tss0_l:
db (tss shr 16) and 0xFF
db 10001001b
dw (tss shr 16) and 0xFF00
code_16:
dw 0xFFFF
dw 0
db 1
db cpl0
dw 0
endofcode:
gdte:
align 16
__edata: ;equ $-OS_BASE
align 4096
_sys_pdbr rb 4096
_sys_pdbr rd 1024
rb 8192-512

View File

@ -218,7 +218,10 @@ SendCommandToHDD:
test AL,08h
jnz @@WaitHDReady
; Çàãðóçèòü êîìàíäó â ðåãèñòðû êîíòðîëëåðà
pushfd
cli
mov DX,[ATABasePortAddr]
inc DX ;ðåãèñòð "îñîáåííîñòåé"
mov AL,[ATAFeatures]
@ -250,7 +253,9 @@ SendCommandToHDD:
mov AL,[ATACommand]
inc DX ;ðåãèñòð êîìàíä
out DX,AL
sti
popfd
; Ñáðîñèòü ïðèçíàê îøèáêè
mov [DevErrorCode],0
jmp @@End_2

View File

@ -11,5 +11,7 @@ $Revision$
include 'dev_fd.inc'
include 'dev_hdcd.inc'
include 'getcache.inc'
include 'sear_par.inc'
; jmp __12345
include 'sear_par.inc'
;__12345:

View File

@ -23,6 +23,7 @@ $Revision$
mov [fat32part],1
search_partitions_ide0_1:
call set_FAT32_variables
cmp [problem_partition],0
jne search_partitions_ide1
inc byte [DRIVE_DATA+2]

View File

@ -106,11 +106,14 @@ endg
reserve_hd1:
pushfd
cli
cmp [hd1_status],0
cmp [hd1_status],0 ;FIXME use mutex
je reserve_ok1
sti
popfd
call change_task
jmp reserve_hd1
@ -122,7 +125,7 @@ reserve_hd1:
mov eax,[eax+CURRENT_TASK+TASKDATA.pid]
mov [hd1_status],eax
pop eax
sti
popfd
ret
;********************************************
@ -138,26 +141,30 @@ reserve_hd_channel:
cmp [hdbase], 0x1F0
jne .IDE_Channel_2
.IDE_Channel_1:
pushfd
cli
cmp [IDE_Channel_1],0
je .reserve_ok_1
sti
popfd
call change_task
jmp .IDE_Channel_1
.IDE_Channel_2:
pushfd
cli
cmp [IDE_Channel_2],0
je .reserve_ok_2
sti
popfd
call change_task
jmp .IDE_Channel_2
.reserve_ok_1:
mov [IDE_Channel_1], 1
popfd
push eax
mov al, 1
jmp @f
.reserve_ok_2:
mov [IDE_Channel_2], 1
popfd
push eax
mov al, 3
@@:

View File

@ -40,7 +40,7 @@ proc Parser_params
locals
buff db 4 dup(?) ; for test cd
endl
mov eax,[bx_from_load]
mov eax,[bx_from_load+OS_BASE+LOAD_BASE]
mov ecx,sysdir_path
mov [ecx-64],dword 'sys'
cmp al,'r' ; if ram disk

View File

@ -118,7 +118,6 @@ mboot:
dd LAST_PAGE
dd __start
align 16
__start:
cld
@ -165,7 +164,7 @@ __start:
mov dword [_sys_pdbr-OS_BASE], PG_LARGE+PG_SW
mov dword [_sys_pdbr-OS_BASE+4], PG_LARGE+PG_SW+4*1024*1024
mov dword [_sys_pdbr-OS_BASE+(page_tabs shr 20)], sys_pgdir+PG_SW-OS_BASE
mov dword [_sys_pdbr-OS_BASE+(page_tabs shr 20)], _sys_pdbr+PG_SW-OS_BASE
mov ebx, cr4
or ebx, CR4_PSE
@ -220,6 +219,57 @@ sz_nommap db 'No memory table', 0x0A
sz_nopse db 'Page size extensions not supported',0x0A
db 'Halted',0
org $-0x100000
align 4
_enter_bootscreen:
use16
mov eax, cr0
and eax, not 0x80000001
mov cr0, eax
jmp far 0x1000:start_of_code
version db 'Kolibri OS version 0.7.1.0 ',13,10,13,10,0
include "boot/bootstr.inc" ; language-independent boot messages
include "boot/preboot.inc"
if lang eq en
include "boot/booteng.inc" ; english system boot messages
else if lang eq ru
include "boot/bootru.inc" ; russian system boot messages
include "boot/ru.inc" ; Russian font
else if lang eq et
include "boot/bootet.inc" ; estonian system boot messages
include "boot/et.inc" ; Estonian font
else
include "boot/bootge.inc" ; german system boot messages
end if
include "data16.inc"
include "boot/bootcode.inc" ; 16 bit system boot code
include "bus/pci/pci16.inc"
include "detect/biosdisk.inc"
;include "boot/shutdown.inc" ; shutdown or restart
cli
mov eax, cr0
or eax, 0x80000001
mov cr0, eax
jmp pword os_code:__setvars
org $+0x100000
align 4
_leave_bootscreen:
use32
; CLEAR 0x280000 - HEAP_BASE
@ -239,61 +289,48 @@ sz_nopse db 'Page size extensions not supported',0x0A
; mov ecx, (uglobals_size/4)+4
; rep stosd
; SAVE & CLEAR 0-0xffff
; xor esi, esi
; mov edi,0x2F0000
; mov ecx,0x10000 / 4
; rep movsd
; xor edi, edi
; mov ecx,0x10000 / 4
; rep stosd
; call test_cpu
bts [cpu_caps-OS_BASE], CAPS_TSC ;force use rdtsc
; call init_BIOS32
mov dword [sys_pgdir-OS_BASE], PG_LARGE+PG_SW
mov dword [sys_pgdir-OS_BASE+4], PG_LARGE+PG_SW+4*1024*1024
; mov dword [sys_pgdir-OS_BASE], PG_LARGE+PG_SW
; mov dword [sys_pgdir-OS_BASE+4], PG_LARGE+PG_SW+4*1024*1024
mov ecx, 32
lea edi, [sys_pgdir-OS_BASE+0xE00]
mov eax, PG_LARGE+PG_SW
@@:
stosd
add eax, 4*1024*1024
loop @B
; mov ecx, 32
; lea edi, [sys_pgdir-OS_BASE+0xE00]
; mov eax, PG_LARGE+PG_SW
;@@:
; stosd
; add eax, 4*1024*1024
; loop @B
mov ebx, cr4
or ebx, CR4_PSE
and ebx, not CR4_PAE
mov cr4, ebx
; mov ebx, cr4
; or ebx, CR4_PSE
; and ebx, not CR4_PAE
; mov cr4, ebx
mov eax, sys_pgdir-OS_BASE
mov ebx, cr0
or ebx,CR0_PG+CR0_WP
; mov eax, sys_pgdir-OS_BASE
; mov ebx, cr0
; or ebx,CR0_PG+CR0_WP
mov cr3, eax
mov cr0, ebx
; mov cr3, eax
; mov cr0, ebx
lgdt [gdts]
jmp pword os_code:high_code
; lgdt [gdts]
; jmp pword os_code:high_code
align 4
bios32_entry dd ?
tmp_page_tabs dd ?
;use16
;org $-0x10000
;include "boot/shutdown.inc" ; shutdown or restart
;org $+0x10000
;use32
__DEBUG__ fix 1
__DEBUG_LEVEL__ fix 1
org OS_BASE+$
MEM_WB equ 6 ;write-back memory
@ -465,8 +502,6 @@ high_code:
mov ax,tss0
ltr ax
xchg bx, bx
mov ecx, 1280*1024
fastcall _balloc
mov [_display_data], eax
@ -483,8 +518,36 @@ high_code:
call _init_mm
mov [pg_data.pg_mutex], 0
hlt
mov esi, 0x100000
mov ecx, (_leave_bootscreen-0x100000)/4
mov edi, 0x10000
cld
rep movsd
jmp far 0x60:_enter_bootscreen;
align 4
__setvars:
mov ax,os_stack
mov dx,app_data
mov ss,ax
mov esp, __os_stack
mov ds, dx
mov es, dx
mov fs, dx
mov gs, dx
; SAVE & CLEAR 0-0xffff
xor esi, esi
mov edi,0x2F0000
mov ecx,0x10000 / 4
rep movsd
xor edi, edi
xor eax, eax
mov ecx,0x10000 / 4
rep stosd
; SAVE REAL MODE VARIABLES
mov ax, [BOOT_VAR + 0x9031]
@ -492,7 +555,7 @@ high_code:
; --------------- APM ---------------------
; init selectors
mov ebx, [BOOT_VAR+0x9040] ; offset of APM entry point
mov ebx, [BOOT_VAR +0x9040] ; offset of APM entry point
movzx eax, word [BOOT_VAR+0x9050] ; real-mode segment base address of
; protected-mode 32-bit code segment
movzx ecx, word [BOOT_VAR+0x9052] ; real-mode segment base address of
@ -545,6 +608,7 @@ high_code:
je @f
cmp [SCR_MODE],word 0x12 ; VGA 640x480
je @f
mov ax,[BOOT_VAR+0x9001] ; for other modes
mov [BytesPerScanLine],ax
@@:
@ -701,7 +765,7 @@ high_code:
stdcall kernel_alloc, [mem_BACKGROUND]
mov [img_background], eax
mov [SLOT_BASE + 256 + APPDATA.dir_table], sys_pgdir - OS_BASE
mov [SLOT_BASE + 256 + APPDATA.dir_table], _sys_pdbr - OS_BASE
; REDIRECT ALL IRQ'S TO INT'S 0x20-0x2f
@ -740,7 +804,6 @@ include 'detect/disks.inc'
; mov [dma_hdd],1
; CALCULATE FAT CHAIN FOR RAMDISK
call calculatefatchain
@ -756,7 +819,7 @@ include 'detect/disks.inc'
; LOAD FONTS I and II
stdcall read_file, char, FONT_I, 0, 2304
stdcall read_file, char2, FONT_II, 0, 2560
stdcall read_file, char2, FONT_II, 0, 2560
mov esi,boot_fonts
call boot_log
@ -868,13 +931,13 @@ include 'detect/disks.inc'
mov esi,boot_tsc
call boot_log
cli
call _rdtsc
mov ecx,eax
mov esi,250 ; wait 1/4 a second
call delay_ms
call _rdtsc
sti
sub eax,ecx
shl eax,2
mov [CPU_FREQ],eax ; save tsc / sec
@ -941,7 +1004,6 @@ include 'detect/disks.inc'
; no_st_network:
; LOAD FIRST APPLICATION
cli
cmp byte [BOOT_VAR+0x9030],1
jne no_load_vrr_m
@ -1012,8 +1074,7 @@ first_app_found:
mov esi,boot_allirqs
call boot_log
cli ;guarantee forbidance of interrupts.
mov al,0 ; unmask all irq's
mov al,0 ; unmask all irq's
out 0xA1,al
out 0x21,al
@ -1034,8 +1095,6 @@ first_app_found:
setnz [dma_hdd]
mov [timer_ticks_enable],1 ; for cd driver
; stdcall init_uart_service, DRV_ENTRY
sti
call change_task
@ -1058,7 +1117,8 @@ boot_log:
mov ecx,0x80ffffff ; ASCIIZ string with white color
mov edx,esi
mov edi,1
call dtext
call dtext
mov [novesachecksum],1000
call checkVga_N13
@ -2113,10 +2173,11 @@ sysfn_terminate2:
test eax,eax
jz .not_found
mov ecx,eax
pushfd
cli
call sysfn_terminate
mov [application_table_status],0
sti
popfd
and dword [esp+32],0
ret
.not_found:
@ -4579,8 +4640,6 @@ _rdtsc:
rerouteirqs:
cli
mov al,0x11 ; icw4, edge triggered
out 0x20,al
call pic_delay
@ -4624,8 +4683,6 @@ picl1: call pic_delay
out 0x21,al
call pic_delay
cli
ret