2024-01-14 02:39:36 +01:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; ;;
|
|
|
|
;; Copyright (C) KolibriOS team 2004-2024. All rights reserved. ;;
|
|
|
|
;; Distributed under terms of the GNU General Public License ;;
|
|
|
|
;; ;;
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
2024-05-22 17:15:14 +02:00
|
|
|
|
2024-01-14 02:39:36 +01:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; ;;
|
|
|
|
;; 16 BIT ENTRY FROM BOOTSECTOR ;;
|
|
|
|
;; ;;
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
2017-12-16 21:21:10 +01:00
|
|
|
|
|
|
|
os_code = code_l - tmp_gdt
|
2021-11-05 00:52:56 +01:00
|
|
|
if defined pretest_build
|
|
|
|
PREBOOT_TIMEOUT = 0 ; seconds
|
|
|
|
else
|
|
|
|
PREBOOT_TIMEOUT = 5
|
|
|
|
end if
|
2017-12-16 21:21:10 +01:00
|
|
|
|
|
|
|
use16
|
2024-01-14 02:39:36 +01:00
|
|
|
org 0
|
|
|
|
; struct kernel_header
|
|
|
|
jmp start_of_code ; jump
|
|
|
|
db 'KolibriOS ' ; signature
|
2024-06-05 10:45:07 +02:00
|
|
|
db 'v0.7.7.0 ',13,10,13,10,0 ; FIXME: get distribution version from git tag
|
2024-01-14 02:39:36 +01:00
|
|
|
dd B32-KERNEL_BASE ; offset of the kernel's 32-bit entry point
|
|
|
|
|
|
|
|
include "boot/bootstr.inc" ; language-independent boot messages
|
2017-12-16 21:21:10 +01:00
|
|
|
include "boot/preboot.inc"
|
|
|
|
|
2024-06-05 10:45:07 +02:00
|
|
|
; Language support for locales: de_DE, es_ES, ru_RU (CP866), et_EE, en_US.
|
2024-06-01 03:37:18 +02:00
|
|
|
if lang eq de_DE
|
2024-06-05 10:45:07 +02:00
|
|
|
include "boot/bootstr-de_DE.inc" ; German system boot messages
|
2024-06-01 03:37:18 +02:00
|
|
|
else if lang eq es_ES
|
2024-06-05 10:45:07 +02:00
|
|
|
include "boot/bootstr-es_ES.inc" ; Spanish system boot messages
|
2024-06-01 03:37:18 +02:00
|
|
|
else if lang eq ru_RU
|
2024-06-05 10:45:07 +02:00
|
|
|
include "boot/bootstr-ru_RU.inc" ; Russian system boot messages
|
|
|
|
include "boot/bootfont-ru_RU.inc" ; Russian font
|
2024-06-01 03:37:18 +02:00
|
|
|
else if lang eq et_EE
|
2024-06-05 10:45:07 +02:00
|
|
|
include "boot/bootstr-et_EE.inc" ; Estonian system boot messages
|
|
|
|
include "boot/bootfont-et_EE.inc" ; Estonian font
|
2017-12-16 21:21:10 +01:00
|
|
|
else
|
2024-06-05 10:45:07 +02:00
|
|
|
include "boot/bootstr-en_US.inc" ; English system boot messages (default)
|
2017-12-16 21:21:10 +01:00
|
|
|
end if
|
|
|
|
|
2024-01-14 02:39:36 +01:00
|
|
|
include "boot/bootcode.inc" ; 16 bit system boot code
|
2017-12-16 21:21:10 +01:00
|
|
|
include "bus/pci/pci16.inc"
|
|
|
|
include "detect/biosdisk.inc"
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; ;;
|
|
|
|
;; SWITCH TO 32 BIT PROTECTED MODE ;;
|
|
|
|
;; ;;
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
|
|
|
|
; CR0 Flags - Protected mode and Paging
|
|
|
|
|
|
|
|
mov ecx, CR0_PE+CR0_AM
|
|
|
|
|
|
|
|
; Enabling 32 bit protected mode
|
|
|
|
|
|
|
|
sidt [cs:old_ints_h]
|
|
|
|
|
|
|
|
cli ; disable all irqs
|
|
|
|
cld
|
|
|
|
mov al, 255 ; mask all irqs
|
|
|
|
out 0xa1, al
|
|
|
|
out 0x21, al
|
|
|
|
l.5:
|
|
|
|
in al, 0x64 ; Enable A20
|
|
|
|
test al, 2
|
|
|
|
jnz l.5
|
|
|
|
mov al, 0xD1
|
|
|
|
out 0x64, al
|
|
|
|
l.6:
|
|
|
|
in al, 0x64
|
|
|
|
test al, 2
|
|
|
|
jnz l.6
|
|
|
|
mov al, 0xDF
|
|
|
|
out 0x60, al
|
|
|
|
l.7:
|
|
|
|
in al, 0x64
|
|
|
|
test al, 2
|
|
|
|
jnz l.7
|
|
|
|
mov al, 0xFF
|
|
|
|
out 0x64, al
|
|
|
|
|
|
|
|
lgdt [cs:tmp_gdt] ; Load GDT
|
|
|
|
mov eax, cr0 ; protected mode
|
|
|
|
or eax, ecx
|
|
|
|
and eax, 10011111b *65536*256 + 0xffffff ; caching enabled
|
|
|
|
mov cr0, eax
|
|
|
|
jmp pword os_code:B32 ; jmp to enable 32 bit mode
|
|
|
|
|
|
|
|
align 8
|
|
|
|
tmp_gdt:
|
|
|
|
|
|
|
|
dw 23
|
2024-01-14 02:39:36 +01:00
|
|
|
dd tmp_gdt+KERNEL_BASE
|
2017-12-16 21:21:10 +01:00
|
|
|
dw 0
|
|
|
|
code_l:
|
|
|
|
dw 0xffff
|
|
|
|
dw 0x0000
|
|
|
|
db 0x00
|
|
|
|
dw 11011111b *256 +10011010b
|
|
|
|
db 0x00
|
|
|
|
|
|
|
|
dw 0xffff
|
|
|
|
dw 0x0000
|
|
|
|
db 0x00
|
|
|
|
dw 11011111b *256 +10010010b
|
|
|
|
db 0x00
|
|
|
|
|
|
|
|
include "data16.inc"
|
|
|
|
|
2024-06-01 03:37:18 +02:00
|
|
|
if ~ lang eq es_ES
|
2024-01-14 02:39:36 +01:00
|
|
|
diff16 "end of bootcode",0,$+KERNEL_BASE
|
2017-12-16 21:21:10 +01:00
|
|
|
end if
|