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