Subversion Repositories Kolibri OS

Compare Revisions

No changes between revisions

Regard whitespace Rev 853 → Rev 854

/kernel/branches/kolibri_pe/boot/init.asm
File deleted
/kernel/branches/kolibri_pe/boot/boot
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/kernel/branches/kolibri_pe/boot/boot.asm
12,6 → 12,11
include "../kglobals.inc"
include "../lang.inc"
 
CR0_PE equ 0x00000001 ;protected mode
CR0_WP equ 0x00010000 ;write protect
CR0_PG equ 0x80000000 ;paging
 
 
public _enter_bootscreen
public _leave_bootscreen
 
60,7 → 65,7
cli
 
mov eax, cr0
or eax, 0x80000001
or eax, CR0_PG+CR0_WP+CR0_PE
mov cr0, eax
 
jmp pword 0x08:__setvars
/kernel/branches/kolibri_pe/boot/start.asm
0,0 → 1,135
 
format MS COFF
 
include '../macros.inc'
 
$Revision: 849 $
 
include "../const.inc"
 
public __start
 
extrn _high_code
extrn __os_stack
extrn _boot_mbi
extrn _sys_pdbr
 
extrn _gdts
extrn __edata
 
section '.start' code readable align 16
 
use32
 
align 4
 
mboot:
dd 0x1BADB002
dd 0x00010003
dd -(0x1BADB002 + 0x00010003)
dd mboot
dd 0x100000
dd __edata; - OS_BASE
dd LAST_PAGE
dd __start
 
align 16
__start:
cld
 
mov esp, __os_stack +(0x100000000-OS_BASE)
push 0
popf
 
cmp eax, 0x2BADB002
mov ecx, sz_invboot
jne .fault
 
bt dword [ebx], 3
mov ecx, sz_nomods
jnc .fault
 
bt dword [ebx], 6
mov ecx, sz_nommap
jnc .fault
 
mov [_boot_mbi+(0x100000000-OS_BASE)], ebx
 
xor eax, eax
cpuid
cmp eax, 0
mov ecx, sz_nopse
jbe .fault
 
mov eax, 1
cpuid
bt edx, 3
mov ecx, sz_nopse
jnc .fault
 
; ENABLE PAGING
 
mov ecx, 32
mov edi, _sys_pdbr+(OS_BASE shr 20)+(0x100000000-OS_BASE)
mov eax, PG_LARGE+PG_SW
@@:
stosd
add eax, 4*1024*1024
loop @B
 
mov dword [_sys_pdbr+(0x100000000-OS_BASE)], PG_LARGE+PG_SW
mov dword [_sys_pdbr+(0x100000000-OS_BASE)+4], PG_LARGE+PG_SW+4*1024*1024
mov dword [_sys_pdbr+(0x100000000-OS_BASE)+(page_tabs shr 20)], _sys_pdbr+PG_SW+(0x100000000-OS_BASE)
 
mov ebx, cr4
or ebx, CR4_PSE
and ebx, not CR4_PAE
mov cr4, ebx
 
mov eax, _sys_pdbr+(0x100000000-OS_BASE)
mov ebx, cr0
or ebx,CR0_PG+CR0_WP
 
mov cr3, eax
mov cr0, ebx
 
mov ebx, [_boot_mbi+(0x100000000-OS_BASE)]
 
mov edx, [ebx+20]
mov esi, [ebx+24]
mov ecx, LAST_PAGE
test edx, edx
jz .no_mods
.scan_mod:
mov ecx, [esi+4]
add esi, 16
dec edx
jnz .scan_mod
 
.no_mods:
add ecx, 4095
and ecx, not 4095
 
lgdt [_gdts+(0x100000000-OS_BASE)]
jmp pword 0x08:_high_code
 
 
.fault:
; push ecx
; call _lcls
; call __bprintf
_hlt:
hlt
jmp _hlt
 
sz_invboot db 'Invalid multiboot loader magic value',0x0A
db 'Halted',0
 
sz_nomods db 'No modules loaded',0x0A
db 'Halted',0
 
sz_nommap db 'No memory table', 0x0A
db 'Halted',0
 
sz_nopse db 'Page size extensions not supported',0x0A
db 'Halted',0