Subversion Repositories Kolibri OS

Rev

Rev 7586 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
7129 dunkaist 1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                                      ;;
3
;;                  16 BIT ENTRY FROM BOOTSECTOR                        ;;
4
;;                                                                      ;;
5
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6
 
7
include 'macros.inc'
8
include 'struct.inc'
7140 clevermous 9
include 'lang.inc'
7129 dunkaist 10
include 'encoding.inc'
11
include 'const.inc'
12
 
13
os_code = code_l - tmp_gdt
9249 Boppan 14
if defined pretest_build
15
  PREBOOT_TIMEOUT = 0 ; seconds
16
else
17
  PREBOOT_TIMEOUT = 5
18
end if
7129 dunkaist 19
 
20
use16
21
                  org   0x0
22
        jmp     start_of_code
23
 
24
if lang eq sp
25
include "kernelsp.inc"  ; spanish kernel messages
26
else if lang eq et
27
version db    'Kolibri OS  versioon 0.7.7.0+    ',13,10,13,10,0
28
else
29
version db    'Kolibri OS  version 0.7.7.0+     ',13,10,13,10,0
30
end if
31
 
32
include "boot/bootstr.inc"     ; language-independent boot messages
33
include "boot/preboot.inc"
34
 
35
if lang eq ge
36
include "boot/bootge.inc"     ; german system boot messages
37
else if lang eq sp
38
include "boot/bootsp.inc"     ; spanish system boot messages
39
else if lang eq ru
40
include "boot/bootru.inc"      ; russian system boot messages
41
include "boot/ru.inc"          ; Russian font
42
else if lang eq et
43
include "boot/bootet.inc"      ; estonian system boot messages
44
include "boot/et.inc"          ; Estonian font
45
else
46
include "boot/booten.inc"      ; english system boot messages
47
end if
48
 
49
include "boot/bootcode.inc"    ; 16 bit system boot code
50
include "bus/pci/pci16.inc"
51
include "detect/biosdisk.inc"
52
 
53
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
54
;;                                                                      ;;
55
;;                  SWITCH TO 32 BIT PROTECTED MODE                     ;;
56
;;                                                                      ;;
57
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
58
 
59
 
60
; CR0 Flags - Protected mode and Paging
61
 
62
        mov     ecx, CR0_PE+CR0_AM
63
 
64
; Enabling 32 bit protected mode
65
 
66
        sidt    [cs:old_ints_h]
67
 
68
        cli                             ; disable all irqs
69
        cld
70
        mov     al, 255                 ; mask all irqs
71
        out     0xa1, al
72
        out     0x21, al
73
   l.5:
74
        in      al, 0x64                ; Enable A20
75
        test    al, 2
76
        jnz     l.5
77
        mov     al, 0xD1
78
        out     0x64, al
79
   l.6:
80
        in      al, 0x64
81
        test    al, 2
82
        jnz     l.6
83
        mov     al, 0xDF
84
        out     0x60, al
85
   l.7:
86
        in      al, 0x64
87
        test    al, 2
88
        jnz     l.7
89
        mov     al, 0xFF
90
        out     0x64, al
91
 
92
        lgdt    [cs:tmp_gdt]            ; Load GDT
93
        mov     eax, cr0                ; protected mode
94
        or      eax, ecx
95
        and     eax, 10011111b *65536*256 + 0xffffff ; caching enabled
96
        mov     cr0, eax
97
        jmp     pword os_code:B32       ; jmp to enable 32 bit mode
98
 
99
align 8
100
tmp_gdt:
101
 
102
        dw     23
103
        dd     tmp_gdt+0x10000
104
        dw     0
105
code_l:
106
        dw     0xffff
107
        dw     0x0000
108
        db     0x00
109
        dw     11011111b *256 +10011010b
110
        db     0x00
111
 
112
        dw     0xffff
113
        dw     0x0000
114
        db     0x00
115
        dw     11011111b *256 +10010010b
116
        db     0x00
117
 
118
include "data16.inc"
119
 
120
if ~ lang eq sp
121
diff16 "end of bootcode",0,$+0x10000
122
end if
123
 
124
use32
125
org $+0x10000
126
 
127
align 4
128
B32: