Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
2288 clevermous 1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;
2455 mario79 3
;; Copyright (C) KolibriOS team 2004-2012. All rights reserved.
2288 clevermous 4
;; PROGRAMMING:
5
;; Ivan Poddubny
6
;; Marat Zakiyanov (Mario79)
7
;; VaStaNi
8
;; Trans
9
;; Mihail Semenyako (mike.dld)
10
;; Sergey Kuzmin (Wildwest)
11
;; Andrey Halyavin (halyavin)
12
;; Mihail Lisovin (Mihasik)
13
;; Andrey Ignatiev (andrew_programmer)
14
;; NoName
15
;; Evgeny Grechnikov (Diamond)
16
;; Iliya Mihailov (Ghost)
17
;; Sergey Semyonov (Serge)
18
;; Johnny_B
19
;; SPraid (simba)
20
;; Hidnplayr
21
;; Alexey Teplov ()
22
;; Rus
23
;; Nable
24
;; shurf
25
;; Alver
26
;; Maxis
27
;; Galkov
28
;; CleverMouse
29
;; tsdima
30
;; turbanoff
31
;; Asper
32
;; art_zh
33
;;
34
;; Data in this file was originally part of MenuetOS project which is
35
;; distributed under the terms of GNU GPL. It is modified and redistributed as
36
;; part of KolibriOS project under the terms of GNU GPL.
37
;;
38
;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa
39
;; PROGRAMMING:
40
;;
41
;; Ville Mikael Turjanmaa, villemt@itu.jyu.fi
42
;; - main os coding/design
43
;; Jan-Michael Brummer, BUZZ2@gmx.de
44
;; Felix Kaiser, info@felix-kaiser.de
45
;; Paolo Minazzi, paolo.minazzi@inwind.it
46
;; quickcode@mail.ru
47
;; Alexey, kgaz@crosswinds.net
48
;; Juan M. Caravaca, bitrider@wanadoo.es
49
;; kristol@nic.fi
50
;; Mike Hibbett, mikeh@oceanfree.net
51
;; Lasse Kuusijarvi, kuusijar@lut.fi
52
;; Jarek Pelczar, jarekp3@wp.pl
53
;;
54
;; KolibriOS is distributed in the hope that it will be useful, but WITHOUT ANY
55
;; WARRANTY. No author or distributor accepts responsibility to anyone for the
56
;; consequences of using it or for whether it serves any particular purpose or
57
;; works at all, unless he says so in writing. Refer to the GNU General Public
58
;; License (the "GPL") for full details.
59
;
60
;; Everyone is granted permission to copy, modify and redistribute KolibriOS,
61
;; but only under the conditions described in the GPL. A copy of this license
62
;; is supposed to have been given to you along with KolibriOS so you can know
63
;; your rights and responsibilities. It should be in a file named COPYING.
64
;; Among other things, the copyright notice and this notice must be preserved
65
;; on all copies.
66
;;
67
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
68
 
3383 hidnplayr 69
format binary as "mnt"
70
 
2288 clevermous 71
include 'macros.inc'
2381 hidnplayr 72
include 'struct.inc'
2288 clevermous 73
 
74
$Revision: 3732 $
75
 
76
 
77
USE_COM_IRQ     equ 1      ; make irq 3 and irq 4 available for PCI devices
3627 Serge 78
VESA_1_2_VIDEO  equ 0      ; enable vesa 1.2 bank switch functions
2288 clevermous 79
 
80
; Enabling the next line will enable serial output console
3556 hidnplayr 81
;debug_com_base  equ 0x3f8  ; 0x3f8 is com1, 0x2f8 is com2, 0x3e8 is com3, 0x2e8 is com4, no irq's are used
3507 clevermous 82
; The following constant, if nonzero, duplicates debug output to the screen.
83
debug_direct_print equ 0
2288 clevermous 84
 
85
include "proc32.inc"
86
include "kglobals.inc"
87
include "lang.inc"
3539 clevermous 88
include "encoding.inc"
2288 clevermous 89
 
90
include "const.inc"
91
max_processes    equ   255
92
tss_step         equ   (128+8192) ; tss & i/o - 65535 ports, * 256=557056*4
93
 
94
 
95
os_stack       equ  (os_data_l-gdts)    ; GDTs
96
os_code        equ  (os_code_l-gdts)
97
graph_data     equ  (3+graph_data_l-gdts)
98
tss0           equ  (tss0_l-gdts)
99
app_code       equ  (3+app_code_l-gdts)
100
app_data       equ  (3+app_data_l-gdts)
101
app_tls        equ  (3+tls_data_l-gdts)
102
pci_code_sel   equ  (pci_code_32-gdts)
103
pci_data_sel   equ  (pci_data_32-gdts)
104
 
105
 
106
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
107
;;
108
;;   Included files:
109
;;
110
;;   Kernel16.inc
111
;;    - Booteng.inc   English text for bootup
112
;;    - Bootcode.inc  Hardware setup
113
;;    - Pci16.inc     PCI functions
114
;;
115
;;   Kernel32.inc
116
;;    - Sys32.inc     Process management
117
;;    - Shutdown.inc  Shutdown and restart
118
;;    - Fat32.inc     Read / write hd
119
;;    - Vesa12.inc    Vesa 1.2 driver
120
;;    - Vesa20.inc    Vesa 2.0 driver
121
;;    - Vga.inc       VGA driver
122
;;    - Stack.inc     Network interface
123
;;    - Mouse.inc     Mouse pointer
124
;;    - Scincode.inc  Window skinning
125
;;    - Pci32.inc     PCI functions
126
;;
127
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
128
 
129
 
130
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
131
;;                                                                      ;;
132
;;                  16 BIT ENTRY FROM BOOTSECTOR                        ;;
133
;;                                                                      ;;
134
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
135
 
136
use16
137
                  org   0x0
138
        jmp     start_of_code
139
 
3287 esevece 140
if lang eq sp
141
include "kernelsp.inc"  ; spanish kernel messages
142
else
2288 clevermous 143
version db    'Kolibri OS  version 0.7.7.0+     ',13,10,13,10,0
3287 esevece 144
end if
2288 clevermous 145
 
146
include "boot/bootstr.inc"     ; language-independent boot messages
147
include "boot/preboot.inc"
148
 
3274 esevece 149
if lang eq ge
150
include "boot/bootge.inc"     ; german system boot messages
151
else if lang eq sp
152
include "boot/bootsp.inc"     ; spanish system boot messages
2288 clevermous 153
else if lang eq ru
154
include "boot/bootru.inc"      ; russian system boot messages
155
include "boot/ru.inc"          ; Russian font
156
else if lang eq et
157
include "boot/bootet.inc"      ; estonian system boot messages
158
include "boot/et.inc"          ; Estonian font
159
else
3274 esevece 160
include "boot/booten.inc"      ; english system boot messages
2288 clevermous 161
end if
162
 
163
include "boot/bootcode.inc"    ; 16 bit system boot code
164
include "bus/pci/pci16.inc"
165
include "detect/biosdisk.inc"
166
 
167
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
168
;;                                                                      ;;
169
;;                  SWITCH TO 32 BIT PROTECTED MODE                     ;;
170
;;                                                                      ;;
171
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
172
 
173
 
174
; CR0 Flags - Protected mode and Paging
175
 
176
        mov     ecx, CR0_PE
177
 
178
; Enabling 32 bit protected mode
179
 
180
        sidt    [cs:old_ints_h]
181
 
182
        cli                             ; disable all irqs
183
        cld
184
        mov     al, 255                 ; mask all irqs
185
        out     0xa1, al
186
        out     0x21, al
187
   l.5:
188
        in      al, 0x64                ; Enable A20
189
        test    al, 2
190
        jnz     l.5
191
        mov     al, 0xD1
192
        out     0x64, al
193
   l.6:
194
        in      al, 0x64
195
        test    al, 2
196
        jnz     l.6
197
        mov     al, 0xDF
198
        out     0x60, al
199
   l.7:
200
        in      al, 0x64
201
        test    al, 2
202
        jnz     l.7
203
        mov     al, 0xFF
204
        out     0x64, al
205
 
206
        lgdt    [cs:tmp_gdt]            ; Load GDT
207
        mov     eax, cr0                ; protected mode
208
        or      eax, ecx
209
        and     eax, 10011111b *65536*256 + 0xffffff ; caching enabled
210
        mov     cr0, eax
211
        jmp     pword os_code:B32       ; jmp to enable 32 bit mode
212
 
213
align 8
214
tmp_gdt:
215
 
216
        dw     23
217
        dd     tmp_gdt+0x10000
218
        dw     0
219
 
220
        dw     0xffff
221
        dw     0x0000
222
        db     0x00
223
        dw     11011111b *256 +10011010b
224
        db     0x00
225
 
226
        dw     0xffff
227
        dw     0x0000
228
        db     0x00
229
        dw     11011111b *256 +10010010b
230
        db     0x00
231
 
232
include "data16.inc"
233
 
3627 Serge 234
if ~ lang eq sp
235
diff16 "end of bootcode",0,$+0x10000
236
end if
237
 
2288 clevermous 238
use32
239
org $+0x10000
240
 
241
align 4
242
B32:
243
        mov     ax, os_stack       ; Selector for os
244
        mov     ds, ax
245
        mov     es, ax
246
        mov     fs, ax
247
        mov     gs, ax
248
        mov     ss, ax
249
        mov     esp, 0x006CC00       ; Set stack
250
 
251
; CLEAR 0x280000 - HEAP_BASE
252
 
253