Subversion Repositories Kolibri OS

Rev

Rev 3535 | Rev 3537 | 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: 3536 $
75
 
76
 
77
USE_COM_IRQ     equ 1      ; make irq 3 and irq 4 available for PCI devices
78
 
79
; Enabling the next line will enable serial output console
80
;debug_com_base  equ 0x3f8  ; 0x3f8 is com1, 0x2f8 is com2, 0x3e8 is com3, 0x2e8 is com4, no irq's are used
3507 clevermous 81
; The following constant, if nonzero, duplicates debug output to the screen.
82
debug_direct_print equ 0
2288 clevermous 83
 
84
include "proc32.inc"
85
include "kglobals.inc"
86
include "lang.inc"
87
 
88
include "const.inc"
89
max_processes    equ   255
90
tss_step         equ   (128+8192) ; tss & i/o - 65535 ports, * 256=557056*4
91
 
92
 
93
os_stack       equ  (os_data_l-gdts)    ; GDTs
94
os_code        equ  (os_code_l-gdts)
95
graph_data     equ  (3+graph_data_l-gdts)
96
tss0           equ  (tss0_l-gdts)
97
app_code       equ  (3+app_code_l-gdts)
98
app_data       equ  (3+app_data_l-gdts)
99
app_tls        equ  (3+tls_data_l-gdts)
100
pci_code_sel   equ  (pci_code_32-gdts)
101
pci_data_sel   equ  (pci_data_32-gdts)
102
 
103
 
104
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
105
;;
106
;;   Included files:
107
;;
108
;;   Kernel16.inc
109
;;    - Booteng.inc   English text for bootup
110
;;    - Bootcode.inc  Hardware setup
111
;;    - Pci16.inc     PCI functions
112
;;
113
;;   Kernel32.inc
114
;;    - Sys32.inc     Process management
115
;;    - Shutdown.inc  Shutdown and restart
116
;;    - Fat32.inc     Read / write hd
117
;;    - Vesa12.inc    Vesa 1.2 driver
118
;;    - Vesa20.inc    Vesa 2.0 driver
119
;;    - Vga.inc       VGA driver
120
;;    - Stack.inc     Network interface
121
;;    - Mouse.inc     Mouse pointer
122
;;    - Scincode.inc  Window skinning
123
;;    - Pci32.inc     PCI functions
124
;;
125
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
126
 
127
 
128
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
129
;;                                                                      ;;
130
;;                  16 BIT ENTRY FROM BOOTSECTOR                        ;;
131
;;                                                                      ;;
132
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
133
 
134
use16
135
                  org   0x0
136
        jmp     start_of_code
137
 
3287 esevece 138
if lang eq sp
139
include "kernelsp.inc"  ; spanish kernel messages
140
else
2288 clevermous 141
version db    'Kolibri OS  version 0.7.7.0+     ',13,10,13,10,0
3287 esevece 142
end if
2288 clevermous 143
 
144
include "boot/bootstr.inc"     ; language-independent boot messages
145
include "boot/preboot.inc"
146
 
3274 esevece 147
if lang eq ge
148
include "boot/bootge.inc"     ; german system boot messages
149
else if lang eq sp
150
include "boot/bootsp.inc"     ; spanish system boot messages
2288 clevermous 151
else if lang eq ru
152
include "boot/bootru.inc"      ; russian system boot messages
153
include "boot/ru.inc"          ; Russian font
154
else if lang eq et
155
include "boot/bootet.inc"      ; estonian system boot messages
156
include "boot/et.inc"          ; Estonian font
157
else
3274 esevece 158
include "boot/booten.inc"      ; english system boot messages
2288 clevermous 159
end if
160
 
161
include "boot/bootcode.inc"    ; 16 bit system boot code
162
include "bus/pci/pci16.inc"
163
include "detect/biosdisk.inc"
164
 
165
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
166
;;                                                                      ;;
167
;;                  SWITCH TO 32 BIT PROTECTED MODE                     ;;
168
;;                                                                      ;;
169
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
170
 
171
 
172
; CR0 Flags - Protected mode and Paging
173
 
174
        mov     ecx, CR0_PE
175
 
176
; Enabling 32 bit protected mode
177
 
178
        sidt    [cs:old_ints_h]
179
 
180
        cli                             ; disable all irqs
181
        cld
182
        mov     al, 255                 ; mask all irqs
183
        out     0xa1, al
184
        out     0x21, al
185
   l.5:
186
        in      al, 0x64                ; Enable A20
187
        test    al, 2
188
        jnz     l.5
189
        mov     al, 0xD1
190
        out     0x64, al
191
   l.6:
192
        in      al, 0x64
193
        test    al, 2
194
        jnz     l.6
195
        mov     al, 0xDF
196
        out     0x60, al
197
   l.7:
198
        in      al, 0x64
199
        test    al, 2
200
        jnz     l.7
201
        mov     al, 0xFF
202
        out     0x64, al
203
 
204
        lgdt    [cs:tmp_gdt]            ; Load GDT
205
        mov     eax, cr0                ; protected mode
206
        or      eax, ecx
207
        and     eax, 10011111b *65536*256 + 0xffffff ; caching enabled
208
        mov     cr0, eax
209
        jmp     pword os_code:B32       ; jmp to enable 32 bit mode
210
 
211
align 8
212
tmp_gdt:
213
 
214
        dw     23
215
        dd     tmp_gdt+0x10000
216
        dw     0
217
 
218
        dw     0xffff
219
        dw     0x0000
220
        db     0x00
221
        dw     11011111b *256 +10011010b
222
        db     0x00
223
 
224
        dw     0xffff
225
        dw     0x0000
226
        db     0x00
227
        dw     11011111b *256 +10010010b
228
        db     0x00
229
 
230
include "data16.inc"
231
 
232
use32
233
org $+0x10000
234
 
235
align 4
236
B32:
237
        mov     ax, os_stack       ; Selector for os
238
        mov     ds, ax
239
        mov     es, ax
240
        mov     fs, ax
241
        mov     gs, ax
242
        mov     ss, ax
243
        mov     esp, 0x006CC00       ; Set stack
244
 
245
; CLEAR 0x280000 - HEAP_BASE
246
 
247
        xor     eax, eax
248
        mov     edi, CLEAN_ZONE
249
        mov     ecx, (HEAP_BASE-OS_BASE-CLEAN_ZONE) / 4
250
        cld
251
        rep stosd
252
 
253
; CLEAR KERNEL UNDEFINED GLOBALS
254
        mov     edi, endofcode-OS_BASE
255
        mov     ecx, 0x90000
256
        sub     ecx, edi
257
        shr     ecx, 2
258
        rep stosd