Subversion Repositories Kolibri OS

Rev

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