Subversion Repositories Kolibri OS

Compare Revisions

No changes between revisions

Regard whitespace Rev 848 → Rev 851

/kernel/branches/kolibri_pe/boot/boot
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/kernel/branches/kolibri_pe/boot/boot.asm
0,0 → 1,69
 
format MS COFF
 
 
include '../macros.inc'
 
$Revision: 849 $
 
__REV__ = __REV
 
include "../proc32.inc"
include "../kglobals.inc"
include "../lang.inc"
 
public _enter_bootscreen
public _leave_bootscreen
 
public _bx_from_load
 
extrn __setvars
 
section '.boot' code readable align 16
 
 
_enter_bootscreen:
 
org 0
 
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 "bootstr.inc" ; language-independent boot messages
include "preboot.inc"
 
if lang eq en
include "booteng.inc" ; english system boot messages
else if lang eq ru
include "bootru.inc" ; russian system boot messages
include "ru.inc" ; Russian font
else if lang eq et
include "bootet.inc" ; estonian system boot messages
include "et.inc" ; Estonian font
else
include "bootge.inc" ; german system boot messages
end if
 
include "../data16.inc"
 
include "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 0x08:__setvars
 
align 4
_leave_bootscreen:
/kernel/branches/kolibri_pe/boot/bootcode.inc
32,9 → 32,9
print:
; in: si->string
mov al, 186
call putchar
call word putchar
mov al, ' '
call putchar
call word putchar
 
printplain:
; in: si->string
/kernel/branches/kolibri_pe/boot/init.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 '.init' 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