Subversion Repositories Kolibri OS

Rev

Rev 387 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 387 Rev 388
Line 13... Line 13...
13
include "proc32.inc"
13
include "proc32.inc"
14
include "kglobals.inc"
14
include "kglobals.inc"
15
include "lang.inc"
15
include "lang.inc"
Line 16... Line 16...
16
 
16
 
17
include "const.inc"
-
 
18
 
-
 
19
;WinMapAddress      equ     0x460000
-
 
20
;display_data       = 0x460000
-
 
21
 
17
include "const.inc"
22
max_processes      equ   255
-
 
23
 
-
 
24
;window_data        equ   0x0000
-
 
25
;tss_data           equ   0xD20000
18
max_processes    equ   255
26
tss_step           equ   (128+8192) ; tss & i/o - 65535 ports, * 256=557056*4
-
 
27
;draw_data          equ   0xC00000
-
 
Line -... Line 19...
-
 
19
tss_step         equ   (128+8192) ; tss & i/o - 65535 ports, * 256=557056*4
-
 
20
 
-
 
21
 
-
 
22
os_data        equ  os_data_l-gdts    ; GDTs
28
;sysint_stack_data  equ   0xC03000
23
os_code        equ  os_code_l-gdts
-
 
24
graph_data     equ  3+graph_data_l-gdts
-
 
25
tss0           equ  tss0_l-gdts
-
 
26
app_code       equ  3+app_code_l-gdts
Line 29... Line 27...
29
 
27
app_data       equ  3+app_data_l-gdts
30
;twdw               equ   (0x3000-window_data)
28
 
31
 
29
 
32
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
30
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 61... Line 59...
61
 
59
 
62
use16
60
use16
63
                  org   0x0
61
                  org   0x0
Line 64... Line -...
64
                  jmp   start_of_code
-
 
65
 
-
 
66
; mike.dld {
-
 
67
        org $+0x10000
-
 
68
db 0
-
 
69
dd servetable-0x10000
-
 
70
draw_line       dd __sys_draw_line
-
 
71
disable_mouse   dd __sys_disable_mouse
-
 
72
draw_pointer    dd __sys_draw_pointer
-
 
73
;//mike.dld, 2006-08-02 [
-
 
74
;drawbar         dd __sys_drawbar
-
 
75
drawbar         dd __sys_drawbar.forced
-
 
76
;//mike.dld, 2006-08-02 ]
-
 
77
putpixel        dd __sys_putpixel
-
 
78
; } mike.dld
62
                  jmp   start_of_code
79
 
-
 
Line 80... Line -...
80
version           db    'Kolibri OS  version 0.6.5.0      ',13,10,13,10,0
-
 
81
                  ;dd    endofcode-0x10000
-
 
82
 
63
 
83
                  ;db   'Boot02'
-
 
84
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
 
85
include "boot/preboot.inc"
-
 
86
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
 
87
 
-
 
Line -... Line 64...
-
 
64
version db    'Kolibri OS  version 0.6.5.0      ',13,10,13,10,0
88
preboot_lfb       db    0
65
 
-
 
66
include "boot/preboot.inc"
89
preboot_bootlog   db    0
67
 
90
 
68
if lang eq en
-
 
69
include "boot/booteng.inc"     ; english system boot messages
91
 
70
else if lang eq ru
-
 
71
include "boot/bootru.inc"      ; russian system boot messages
-
 
72
include "boot/ru.inc"          ; Russian font
92
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
73
else if lang eq et
-
 
74
include "boot/bootet.inc"      ; estonian system boot messages
Line -... Line 75...
-
 
75
include "boot/et.inc"          ; Estonian font
93
;;                                                                      ;;
76
else
Line 94... Line 77...
94
;;                      16 BIT INCLUDED FILES                           ;;
77
include "boot/bootge.inc"      ; german system boot messages
95
;;                                                                      ;;
78
end if
96
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
79
 
97
 
80
include "boot/bootcode.inc"    ; 16 bit system boot code
98
include "kernel16.inc"
81
include "bus/pci/pci16.inc"
Line 99... Line -...
99
 
-
 
100
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
 
101
;;                                                                      ;;
-
 
102
;;                  SWITCH TO 32 BIT PROTECTED MODE                     ;;
-
 
103
;;                                                                      ;;
-
 
104
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
 
105
 
-
 
106
os_data        =  os_data_l-gdts    ; GDTs
-
 
107
os_code        =  os_code_l-gdts
-
 
108
int_code       equ  int_code_l-gdts
-
 
109
int_data       equ  int_data_l-gdts
-
 
Line 110... Line 82...
110
tss0sys        equ  tss0sys_l-gdts
82
 
Line 111... Line 83...
111
graph_data     equ  3+graph_data_l-gdts
83
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 112... Line 84...
112
tss0           equ  tss0_l-gdts
84
;;                                                                      ;;
Line 113... Line 85...
113
app_code       equ  3+app_code_l-gdts
85
;;                  SWITCH TO 32 BIT PROTECTED MODE                     ;;
Line 114... Line 86...
114
app_data       equ  3+app_data_l-gdts
86
;;                                                                      ;;
115
 
87
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
116
 
88
 
117
 
89
 
Line 141... Line 113...
141
   l.7: in      al, 0x64
113
   l.7: in      al, 0x64
142
        test    al, 2
114
        test    al, 2
143
        jnz     l.7
115
        jnz     l.7
144
        mov     al, 0xFF
116
        mov     al, 0xFF
145
        out     0x64, al
117
        out     0x64, al
-
 
118
 
146
        lgdt    [cs:gdts-0x10000]       ; Load GDT
119
        lgdt    [cs:tmp_gdt]            ; Load GDT
147
        mov     eax, cr0                ; Turn on paging // protected mode
120
        mov     eax, cr0                ; protected mode
148
        or      eax, ecx
121
        or      eax, ecx
149
        and     eax, 10011111b *65536*256 + 0xffffff ; caching enabled
122
        and     eax, 10011111b *65536*256 + 0xffffff ; caching enabled
150
        mov     cr0, eax
123
        mov     cr0, eax
-
 
124
        jmp     pword os_code:B32       ; jmp to enable 32 bit mode
-
 
125
 
-
 
126
align 8
-
 
127
tmp_gdt:
-
 
128
 
151
        jmp     $+2
129
        dw     23
-
 
130
        dd     tmp_gdt+0x10000
-
 
131
        dw     0
-
 
132
 
-
 
133
        dw     0xffff
-
 
134
        dw     0x0000
-
 
135
        db     0x00
-
 
136
        dw     11011111b *256 +10011010b
-
 
137
        db     0x00
-
 
138
 
-
 
139
        dw     0xffff
-
 
140
        dw     0x0000
-
 
141
        db     0x00
-
 
142
        dw     11011111b *256 +10010010b
-
 
143
        db     0x00
-
 
144
 
-
 
145
include "data16.inc"
-
 
146
 
-
 
147
use32
152
org $+0x10000
148
org $+0x10000
-
 
149
 
-
 
150
align 4
-
 
151
B32:
153
        mov     ax,os_data              ; Selector for os
152
           mov   ax,os_data        ; Selector for os
154
        mov     ds,ax
153
           mov   ds,ax
155
        mov     es,ax
154
           mov   es,ax
156
        mov     fs,ax
155
           mov   fs,ax
157
        mov     gs,ax
156
           mov   gs,ax
158
        mov     ss,ax
157
           mov   ss,ax
159
        mov     esp,0x3ec00             ; Set stack
158
           mov   esp,0x3ec00       ; Set stack
160
        jmp     pword os_code:B32       ; jmp to enable 32 bit mode
-
 
161
 
-
 
162
if gdte >= $
-
 
163
error 'GDT overlaps with used code!'
-
 
164
end if
-
 
165
 
-
 
166
use32
-
 
167
 
-
 
168
include 'unpacker.inc'
-
 
169
 
-
 
170
__DEBUG__ fix 1
-
 
171
__DEBUG_LEVEL__ fix 1
-
 
172
include 'fdo.inc'
-
 
173
 
-
 
174
iglobal
-
 
175
  boot_memdetect    db   'Determining amount of memory',0
-
 
176
  boot_fonts        db   'Fonts loaded',0
-
 
177
  boot_tss          db   'Setting TSSs',0
-
 
178
  boot_cpuid        db   'Reading CPUIDs',0
-
 
179
  boot_devices      db   'Detecting devices',0
-
 
180
  boot_timer        db   'Setting timer',0
-
 
181
  boot_irqs         db   'Reprogramming IRQs',0
-
 
182
  boot_setmouse     db   'Setting mouse',0
-
 
183
  boot_windefs      db   'Setting window defaults',0
-
 
184
  boot_bgr          db   'Calculating background',0
-
 
185
  boot_resirqports  db   'Reserving IRQs & ports',0
-
 
186
  boot_setrports    db   'Setting addresses for IRQs',0
-
 
187
  boot_setostask    db   'Setting OS task',0
-
 
188
  boot_allirqs      db   'Unmasking all IRQs',0
-
 
189
  boot_tsc          db   'Reading TSC',0
-
 
190
  boot_pal_ega      db   'Setting EGA/CGA 320x200 palette',0
-
 
191
  boot_pal_vga      db   'Setting VGA 640x480 palette',0
-
 
192
  boot_mtrr         db   'Setting MTRR',0
-
 
193
  boot_tasking      db   'All set - press ESC to start',0
-
 
194
endg
-
 
Line 195... Line -...
195
 
-
 
196
iglobal
-
 
197
  boot_y dd 10
-
 
198
endg
-
 
199
 
-
 
200
boot_log:
-
 
201
         pushad
-
 
202
 
-
 
203
         mov   eax,10*65536
-
 
204
         mov   ax,word [boot_y]
-
 
205
         add   [boot_y],dword 10
-
 
206
         mov   ebx,0x80ffffff   ; ASCIIZ string with white color
-
 
207
         mov   ecx,esi
-
 
208
         mov   edi,1
-
 
209
         call  dtext
-
 
210
 
-
 
211
         mov   [novesachecksum],1000
-
 
212
         call  checkVga_N13
-
 
213
 
-
 
214
         cmp   [preboot_blogesc],byte 1
-
 
215
         je    .bll2
-
 
216
 
-
 
217
         cmp   esi,boot_tasking
-
 
218
         jne   .bll2
-
 
219
         ; begin ealex 04.08.05
-
 
220
;         in    al,0x61
-
 
221
;         and   al,01111111b
-
 
222
;         out   0x61,al
-
 
223
         ; end ealex 04.08.05
-
 
224
.bll1:   in    al,0x60    ; wait for ESC key press
-
 
225
         cmp   al,129
-
 
226
         jne   .bll1
-
 
227
 
-
 
228
.bll2:   popad
-
 
229
 
-
 
230
         ret
-
 
231
 
-
 
232
iglobal
-
 
233
  firstapp   db  '/rd/1/LAUNCHER',0
-
 
234
  char       db  'FONTS/CHAR.MT',0
-
 
235
  char2      db  'FONTS/CHAR2.MT',0
-
 
236
  bootpath   db  '/KOLIBRI    '
-
 
237
  bootpath2  db  0
-
 
238
  vmode      db  'drivers/VMODE.MDR',0
-
 
239
  vrr_m      db  '/rd/1/VRR_M',0
-
 
240
endg
-
 
241
 
-
 
242
 
-
 
243
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
 
244
;;                                                                      ;;
-
 
245
;;                          32 BIT ENTRY                                ;;
-
 
246
;;                                                                      ;;
-
 
247
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
 
248
 
-
 
249
align 4
-
 
250
 
-
 
251
B32:
159
 
Line 252... Line 160...
252
; CLEAR 0x280000-0xF00000
160
; CLEAR 0x280000 - HEAP_BASE
253
 
161
 
254
        xor   eax,eax
162
           xor   eax,eax
255
        mov   edi,0x280000
163
           mov   edi,0x280000
256
        mov   ecx,(0x100000*0xF-0x280000) / 4
164
           mov   ecx,(HEAP_BASE-0x280000) / 4
257
        cld
-
 
258
        rep   stosd
-
 
Line 259... Line 165...
259
; CLEAR 0x80000-0x90000
165
           cld
260
;       xor   eax,eax
166
           rep   stosd
261
 
-
 
262
        mov   edi,0x80000
167
 
Line 263... Line 168...
263
        mov   ecx,(0x90000-0x80000)/4
168
           mov   edi,0x40000
264
;       cld
169
           mov   ecx,(0x90000-0x40000)/4
265
        rep   stosd
170
           rep   stosd
266
 
171
 
Line 267... Line 172...
267
; CLEAR KERNEL UNDEFINED GLOBALS
172
; CLEAR KERNEL UNDEFINED GLOBALS
Line 268... Line 173...
268
        mov   edi, endofcode
173
           mov   edi, endofcode-OS_BASE
269
        mov   ecx, (uglobals_size/4)+4
174
           mov   ecx, (uglobals_size/4)+4
270
        rep   stosd
175
           rep   stosd
271
 
-
 
272
; SAVE & CLEAR 0-0xffff
176
 
273
 
177
; SAVE & CLEAR 0-0xffff
274
        mov   esi,0x0000
-
 
275
        mov   edi,0x2F0000
178
 
276
        mov   ecx,0x10000 / 4
-
 
277
        cld
179
           xor esi, esi
Line -... Line 180...
-
 
180
           mov   edi,0x2F0000
-
 
181
           mov   ecx,0x10000 / 4
-
 
182
           rep   movsd
-
 
183
           xor edi, edi
-
 
184
           mov   ecx,0x10000 / 4
-
 
185
           rep   stosd
-
 
186
 
-
 
187
           call test_cpu
-
 
188
           bts [cpu_caps-OS_BASE], CAPS_TSC     ;force use rdtsc
-
 
189
 
-
 
190
; MEMORY MODEL
-
 
191
           call mem_test
-
 
192
           call init_mem
-
 
193
           call init_page_map
-
 
194
 
-
 
195
; ENABLE PAGING
-
 
196
 
-
 
197
           mov eax, sys_pgdir-OS_BASE
-
 
198
           mov cr3, eax
-
 
199
 
-
 
200
           mov eax,cr0
-
 
201
           or eax,CR0_PG
-
 
202
           mov cr0,eax
-
 
203
           lgdt [gdts]
-
 
204
           jmp pword os_code:high_code
-
 
205
 
-
 
206
__DEBUG__ fix 1
-
 
207
__DEBUG_LEVEL__ fix 1
-
 
208
include 'fdo.inc'
-
 
209
include 'init.inc'
-
 
210
include "boot/shutdown.inc" ; shutdown or restart
-
 
211
 
-
 
212
 
-
 
213
org OS_BASE+$
-
 
214
align 4
-
 
215
high_code:
-
 
216
           mov   ax,os_data
-
 
217
           mov   ds,ax
-
 
218
           mov   es,ax
-
 
219
           mov   fs,ax
-
 
220
           mov   gs,ax
-
 
221
           mov   ss,ax
-
 
222
           add esp, OS_BASE
-
 
223
 
-
 
224
           mov dword [sys_pgdir], 0
278
        rep   movsd
225
           mov dword [sys_pgdir+4], 0
279
        xor   eax,eax
226
           mov dword [sys_pgdir+8], 0
280
        mov   edi,0
227
           mov dword [sys_pgdir+12], 0
281
        mov   ecx,0x10000 / 4
228
 
282
        cld
229
           mov eax, sys_pgdir-OS_BASE
283
        rep   stosd
230
           mov cr3, eax
284
 
231
 
Line 285... Line 232...
285
; SAVE REAL MODE VARIABLES
232
; SAVE REAL MODE VARIABLES
286
        mov     ax, [0x2f0000 + 0x9031]
233
        mov     ax, [BOOT_VAR + 0x9031]
287
        mov     [IDEContrRegsBaseAddr], ax
234
        mov     [IDEContrRegsBaseAddr], ax
288
; --------------- APM ---------------------
235
; --------------- APM ---------------------
289
    mov    eax, [0x2f0000 + 0x9040]    ; entry point
236
;    mov    eax, [BOOT_VAR + 0x9040]    ; entry point
290
    mov    dword[apm_entry], eax
237
;    mov    dword[apm_entry], eax
291
    mov    word [apm_entry + 4], apm_code_32 - gdts
238
;    mov    word [apm_entry + 4], apm_code_32 - gdts
292
 
239
 
293
    mov    eax, [0x2f0000 + 0x9044]    ; version & flags
240
    mov    eax, [BOOT_VAR + 0x9044]    ; version & flags
294
    mov    [apm_vf], eax
241
    mov    [apm_vf], eax
295
; -----------------------------------------
242
; -----------------------------------------
296
;        movzx eax,byte [0x2f0000+0x9010]  ; mouse port
243
;        movzx eax,byte [BOOT_VAR+0x9010]  ; mouse port
297
;        mov   [0xF604],byte 1  ;al
244
;        mov   [0xF604],byte 1  ;al
298
        mov     al, [0x2F0000+0x901F]   ; DMA writing
245
        mov     al, [BOOT_VAR+0x901F]   ; DMA writing
299
        mov     [allow_dma_write], al
246
        mov     [allow_dma_write], al
300
        mov   al,[0x2f0000+0x9000]        ; bpp
247
        mov   al,[BOOT_VAR+0x9000]        ; bpp
301
        mov   [ScreenBPP],al
248
        mov   [ScreenBPP],al
302
        movzx eax,word [0x2f0000+0x900A]  ; X max
249
        movzx eax,word [BOOT_VAR+0x900A]  ; X max
303
        dec   eax
250
        dec   eax
304
        mov   [ScreenWidth],eax
251
        mov   [ScreenWidth],eax
305
        mov   [screen_workarea.right],eax
252
        mov   [screen_workarea.right],eax
306
        movzx eax,word [0x2f0000+0x900C]  ; Y max
253
        movzx eax,word [BOOT_VAR+0x900C]  ; Y max
307
        dec   eax
254
        dec   eax
308
        mov   [ScreenHeight],eax
255
        mov   [ScreenHeight],eax
309
        mov   [screen_workarea.bottom],eax
256
        mov   [screen_workarea.bottom],eax
310
        movzx eax,word [0x2f0000+0x9008]  ; screen mode
257
        movzx eax,word [BOOT_VAR+0x9008]  ; screen mode
311
        mov   [SCR_MODE],eax
258
        mov   [SCR_MODE],eax
312
        mov   eax,[0x2f0000+0x9014]       ; Vesa 1.2 bnk sw add
259
        mov   eax,[BOOT_VAR+0x9014]       ; Vesa 1.2 bnk sw add
313
        mov   [BANK_SWITCH],eax
260
        mov   [BANK_SWITCH],eax
Line 314... Line 261...
314
        mov   [BytesPerScanLine],word 640*4         ; Bytes PerScanLine
261
        mov   [BytesPerScanLine],word 640*4         ; Bytes PerScanLine
Line 315... Line -...
315
        cmp   [SCR_MODE],word 0x13          ; 320x200
-
 
316
        je    @f
-
 
317
        cmp   [SCR_MODE],word 0x12          ; VGA 640x480
-
 
318
        je    @f
-
 
319
        mov   ax,[0x2f0000+0x9001]        ; for other modes
-
 
320
        mov   [BytesPerScanLine],ax
-
 
321
      @@:
-
 
322
 
262
        cmp   [SCR_MODE],word 0x13          ; 320x200
323
; GRAPHICS ADDRESSES
263
        je    @f
324
 
-
 
325
        ;mov     eax,0x100000*8                    ; LFB address
264
        cmp   [SCR_MODE],word 0x12          ; VGA 640x480
Line 326... Line 265...
326
        ;cmp     [0xfe0c],word 0x13
265
        je    @f
327
        ;je      no_d_lfb
266
        mov   ax,[BOOT_VAR+0x9001]        ; for other modes
328
        ;cmp     [0xfe0c],word 0x12
267
        mov   [BytesPerScanLine],ax
329
        ;je      no_d_lfb
268
      @@:
330
        ;cmp     [0x2f0000+0x901e],byte 1
269
 
331
        ;jne     no_d_lfb
270
; GRAPHICS ADDRESSES
332
        mov     byte [0x2f0000+0x901e],0x0
271
 
333
        mov     eax,[0x2f0000+0x9018]
272
        mov     byte [BOOT_VAR+0x901e],0x0
334
      ;no_d_lfb:
273
        mov     eax,[BOOT_VAR+0x9018]
335
        mov     [LFBAddress],eax
274
        mov     [LFBAddress],eax
336
 
275
 
337
        cmp     [SCR_MODE],word 0100000000000000b
276
        cmp     [SCR_MODE],word 0100000000000000b
338
        jge     setvesa20
277
        jge     setvesa20
339
        cmp     [SCR_MODE],word 0x13
278
        cmp     [SCR_MODE],word 0x13
340
        je      v20ga32
279
        je      v20ga32
341
        mov     [PUTPIXEL],dword Vesa12_putpixel24  ; Vesa 1.2
280
        mov     [PUTPIXEL],dword Vesa12_putpixel24  ; Vesa 1.2
342
        mov     [0xe024],dword Vesa12_getpixel24
281
        mov     [GETPIXEL],dword Vesa12_getpixel24
343
        cmp     [ScreenBPP],byte 24
282
        cmp     [ScreenBPP],byte 24
344
        jz      ga24
283
        jz      ga24
345
        mov     [PUTPIXEL],dword Vesa12_putpixel32
284
        mov     [PUTPIXEL],dword Vesa12_putpixel32
346
        mov     [0xe024],dword Vesa12_getpixel32
285
        mov     [GETPIXEL],dword Vesa12_getpixel32
347
      ga24:
286
      ga24:
348
        jmp     v20ga24
287
        jmp     v20ga24
349
      setvesa20:
288
      setvesa20:
350
        mov     [PUTPIXEL],dword Vesa20_putpixel24  ; Vesa 2.0
289
        mov     [PUTPIXEL],dword Vesa20_putpixel24  ; Vesa 2.0
351
        mov     [0xe024],dword Vesa20_getpixel24
290
        mov     [GETPIXEL],dword Vesa20_getpixel24
Line 352... Line -...
352
        cmp     [ScreenBPP],byte 24
-
 
353
        jz      v20ga24
-
 
354
      v20ga32:
-
 
355
        mov     [PUTPIXEL],dword Vesa20_putpixel32
-
 
356
        mov     [0xe024],dword Vesa20_getpixel32
-
 
357
      v20ga24:
-
 
358
        cmp     [SCR_MODE],word 0x12                ; 16 C VGA 640x480
-
 
359
        jne     no_mode_0x12
-
 
360
        mov     [PUTPIXEL],dword VGA_putpixel
-
 
361
        mov     [0xe024],dword Vesa20_getpixel32
-
 
362
      no_mode_0x12:
-
 
363
 
291
        cmp     [ScreenBPP],byte 24
364
           call test_cpu
292
        jz      v20ga24
365
;           btr [cpu_caps], CAPS_SSE    ;test: dont't use sse code
293
      v20ga32:
366
;           btr [cpu_caps], CAPS_SSE2   ;test: don't use sse2
294
        mov     [PUTPIXEL],dword Vesa20_putpixel32
367
 
295
        mov     [GETPIXEL],dword Vesa20_getpixel32
Line 413... Line 341...
413
           mov ecx, MSR_AMD_STAR
341
           mov ecx, MSR_AMD_STAR
414
           wrmsr
342
           wrmsr
415
.noSYSCALL:
343
.noSYSCALL:
416
; -----------------------------------------
344
; -----------------------------------------
Line 417... Line -...
417
 
-
 
418
 
-
 
419
 
-
 
420
; MEMORY MODEL
-
 
421
           call mem_test
-
 
422
           call init_mtrr
-
 
423
           call init_mem
-
 
424
           call init_page_map
-
 
425
 
-
 
426
; ENABLE PAGING
-
 
427
           mov eax, sys_pgdir
-
 
428
           mov cr3, eax
-
 
429
 
-
 
430
           mov eax,cr0
-
 
431
           or eax,CR0_PG
-
 
432
           mov cr0,eax
-
 
433
 
345
 
434
           call init_kernel_heap
346
           call init_kernel_heap
435
           stdcall kernel_alloc, 0x2000
347
           stdcall kernel_alloc, 0x2000
Line -... Line 348...
-
 
348
           mov [os_stack], eax
-
 
349
 
-
 
350
           mov [LFBSize], 0x800000
436
           mov [os_stack], eax
351
           call init_mtrr
437
 
352
 
Line 438... Line 353...
438
           call init_LFB
353
           call init_LFB
Line 509... Line 424...
509
        mov   [TASK_COUNT],dword 1
424
        mov   [TASK_COUNT],dword 1
510
        mov   [TASK_BASE],dword TASK_DATA
425
        mov   [TASK_BASE],dword TASK_DATA
Line 511... Line 426...
511
 
426
 
512
        mov   esi,char
427
        mov   esi,char
513
        xor   ebx,ebx
428
        xor   ebx,ebx
514
        mov   ecx,2560;26000
429
        mov   ecx,2560
515
        mov   edx,FONT_I
430
        mov   edx,FONT_I
Line 516... Line 431...
516
        call  fs_RamdiskRead
431
        call  fs_RamdiskRead
517
 
432
 
Line 550... Line 465...
550
; BUILD SCHEDULER
465
; BUILD SCHEDULER
Line 551... Line 466...
551
 
466
 
Line 552... Line 467...
552
        call   build_scheduler ; sys32.inc
467
        call   build_scheduler ; sys32.inc
553
 
468
 
554
; LOAD IDT
-
 
Line 555... Line 469...
555
        lidt   [cs:idtreg]
469
; LOAD IDT
556
        cli
470
        lidt   [idtreg]
557
 
471
 
Line 626... Line 540...
626
        cld
540
        cld
627
        rep movsd
541
        rep movsd
Line 628... Line 542...
628
 
542
 
629
        mov dword [SLOT_BASE+256+APPDATA.fpu_handler], 0
543
        mov dword [SLOT_BASE+256+APPDATA.fpu_handler], 0
630
        mov dword [SLOT_BASE+256+APPDATA.sse_handler], 0
-
 
631
 
-
 
632
        mov ebx, [def_cursor]
544
        mov dword [SLOT_BASE+256+APPDATA.sse_handler], 0
Line 633... Line 545...
633
        mov dword [SLOT_BASE+256+APPDATA.cursor], ebx
545
        mov dword [SLOT_BASE+256+APPDATA.cursor], ebx
634
 
546
 
635
        mov ebx, SLOT_BASE+256+APP_OBJ_OFFSET
547
        mov ebx, SLOT_BASE+256+APP_OBJ_OFFSET
Line 636... Line 548...
636
        mov  dword [SLOT_BASE+256+APPDATA.fd_obj], ebx
548
        mov  dword [SLOT_BASE+256+APPDATA.fd_obj], ebx
-
 
549
        mov  dword [SLOT_BASE+256+APPDATA.bk_obj], ebx
-
 
550
 
637
        mov  dword [SLOT_BASE+256+APPDATA.bk_obj], ebx
551
        ; task list
638
 
552
        mov   [CURRENT_TASK],dword 1
639
        ; task list
553
        mov   [TASK_COUNT],dword 1
Line 640... Line 554...
640
        mov  [TASK_DATA+TASKDATA.wnd_number], 1 ; on screen number
554
        mov  [TASK_DATA+TASKDATA.wnd_number], 1 ; on screen number
Line 665... Line 579...
665
 
579
 
666
        mov  ax,tss0
580
        mov  ax,tss0
Line 667... Line 581...
667
        ltr  ax
581
        ltr  ax
668
 
-
 
-
 
582
 
-
 
583
        call init_cursors
-
 
584
        mov eax, [def_cursor]
Line 669... Line 585...
669
        call init_cursors
585
        mov [SLOT_BASE+APPDATA.cursor],eax
Line 670... Line 586...
670
 
586
        mov [SLOT_BASE+APPDATA.cursor+256],eax
671
 
587
 
Line 718... Line 634...
718
        movsd
634
        movsd
719
        movsd
635
        movsd
720
        call    load_skin
636
        call    load_skin
Line 721... Line 637...
721
 
637
 
722
; LOAD FIRST APPLICATION
-
 
723
        mov   [CURRENT_TASK],dword 1
-
 
724
        mov   [TASK_COUNT],dword 1
638
; LOAD FIRST APPLICATION
725
        cli
639
        cli
726
        cmp   byte [0x2f0000+0x9030],1
640
        cmp   byte [BOOT_VAR+0x9030],1
Line 727... Line 641...
727
        jne   no_load_vrr_m
641
        jne   no_load_vrr_m
728
 
642
 
729
        mov ebp, vrr_m
643
        mov ebp, vrr_m
Line 746... Line 660...
746
        cli
660
        cli
Line 747... Line 661...
747
 
661
 
748
        ;mov   [TASK_COUNT],dword 2
662
        ;mov   [TASK_COUNT],dword 2
Line 749... Line -...
749
        mov   [CURRENT_TASK],dword 1       ; set OS task fisrt
-
 
750
 
663
        mov   [CURRENT_TASK],dword 1       ; set OS task fisrt
751
 
664
 
752
; SET KEYBOARD PARAMETERS
665
; SET KEYBOARD PARAMETERS
Line 753... Line 666...
753
        mov   al, 0xf6         ; reset keyboard, scan enabled
666
        mov   al, 0xf6         ; reset keyboard, scan enabled
Line 813... Line 726...
813
        sti
726
        sti
814
        jmp   $                      ; wait here for timer to take control
727
        jmp   $                      ; wait here for timer to take control
Line 815... Line 728...
815
 
728
 
Line -... Line 729...
-
 
729
        ; Fly :)
-
 
730
 
-
 
731
 
-
 
732
include 'unpacker.inc'
-
 
733
 
-
 
734
align 4
-
 
735
boot_log:
-
 
736
         pushad
-
 
737
 
-
 
738
         mov   eax,10*65536
-
 
739
         mov   ax,word [boot_y]
-
 
740
         add   [boot_y],dword 10
-
 
741
         mov   ebx,0x80ffffff   ; ASCIIZ string with white color
-
 
742
         mov   ecx,esi
-
 
743
         mov   edi,1
-
 
744
         call  dtext
-
 
745
 
-
 
746
         mov   [novesachecksum],1000
-
 
747
         call  checkVga_N13
-
 
748
 
-
 
749
         cmp   [preboot_blogesc+OS_BASE+0x10000],byte 1
-
 
750
         je    .bll2
-
 
751
 
-
 
752
         cmp   esi,boot_tasking
-
 
753
         jne   .bll2
-
 
754
         ; begin ealex 04.08.05
-
 
755
;         in    al,0x61
-
 
756
;         and   al,01111111b
-
 
757
;         out   0x61,al
-
 
758
         ; end ealex 04.08.05
-
 
759
.bll1:   in    al,0x60    ; wait for ESC key press
-
 
760
         cmp   al,129
-
 
761
         jne   .bll1
-
 
762
 
-
 
763
.bll2:   popad
-
 
764
 
-
 
765
         ret
816
        ; Fly :)
766
 
817
 
767
 
818
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
768
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
819
;                                                                    ;
769
;                                                                    ;
820
;                    MAIN OS LOOP START                              ;
770
;                    MAIN OS LOOP START                              ;
Line 916... Line 866...
916
 
866
 
Line 917... Line 867...
917
reserve_irqs_ports:
867
reserve_irqs_ports:
Line 918... Line 868...
918
 
868
 
919
        pushad
869
        pushad
920
 
870
 
921
        mov  [irq_owner+4*0],byte 1    ; timer
871
        mov  [irq_owner+4*0], 1    ; timer
922
        mov  [irq_owner+4*1],byte 1    ; keyboard
872
        mov  [irq_owner+4*1], 1    ; keyboard
923
        mov  [irq_owner+4*5],byte 1    ; sound blaster
873
        mov  [irq_owner+4*5], 1    ; sound blaster
924
        mov  [irq_owner+4*6],byte 1    ; floppy diskette
874
        mov  [irq_owner+4*6], 1    ; floppy diskette
-
 
875
        mov  [irq_owner+4*13], 1   ; math co-pros
925
        mov  [irq_owner+4*13],byte 1   ; math co-pros
876
        mov  [irq_owner+4*14], 1   ; ide I
926
        mov  [irq_owner+4*14],byte 1   ; ide I
877
        mov  [irq_owner+4*15], 1   ; ide II
927
        mov  [irq_owner+4*15],byte 1   ; ide II
878
 
928
;        movzx eax,byte [0xf604]        ; mouse irq
879
;        movzx eax,byte [0xf604]        ; mouse irq
929
;        dec   eax
880
;        dec   eax
Line 1015... Line 966...
1015
        mov   [KEY_COUNT],byte 0                 ; keyboard buffer
966
        mov   [KEY_COUNT],byte 0                 ; keyboard buffer
1016
        mov   [BTN_COUNT],byte 0                 ; button buffer
967
        mov   [BTN_COUNT],byte 0                 ; button buffer
1017
;        mov   [MOUSE_X],dword 100*65536+100    ; mouse x/y
968
;        mov   [MOUSE_X],dword 100*65536+100    ; mouse x/y
Line 1018... Line 969...
1018
 
969
 
1019
        push  eax
970
        push  eax
1020
        mov   ax,[0x2f0000+0x900c]
971
        mov   ax,[BOOT_VAR+0x900c]
1021
        shr   ax,1
972
        shr   ax,1
1022
        shl   eax,16
973
        shl   eax,16
1023
        mov   ax,[0x2f0000+0x900A]
974
        mov   ax,[BOOT_VAR+0x900A]
1024
        shr   ax,1
975
        shr   ax,1
1025
        mov   [MOUSE_X],eax
976
        mov   [MOUSE_X],eax
Line 1026... Line 977...
1026
        pop   eax
977
        pop   eax
1027
 
978
 
1028
        mov   byte [SB16_Status],0            ; Minazzi Paolo
979
        mov   byte [SB16_Status],0            ; Minazzi Paolo
Line 1029... Line 980...
1029
        mov   [display_data-12],dword 1       ; tiled background
980
        mov   [display_data-12],dword 1       ; tiled background
1030
        mov   [BTN_ADDR],dword BUTTON_INFO    ; address of button list
981
        mov   [BTN_ADDR],dword BUTTON_INFO    ; address of button list
1031
 
982
 
Line 1032... Line 983...
1032
     ;!! IP 04.02.2005:
983
     ;!! IP 04.02.2005:
Line 1033... Line 984...
1033
        mov   [next_usage_update], 100
984
        mov   [next_usage_update], 100
1034
        mov   byte [0xFFFF], 0 ; change task if possible
985
        mov   byte [DONT_SWITCH], 0 ; change task if possible
Line 1927... Line 1878...
1927
        jmp     dword [sys_system_table + eax*4]
1878
        jmp     dword [sys_system_table + eax*4]
1928
@@:
1879
@@:
1929
        ret
1880
        ret
Line 1930... Line 1881...
1930
 
1881
 
1931
sysfn_shutdown:         ; 18.1 = BOOT
1882
sysfn_shutdown:         ; 18.1 = BOOT
1932
     mov  [0x2f0000+0x9030],byte 0
1883
     mov  [BOOT_VAR+0x9030],byte 0
Line 1933... Line 1884...
1933
  for_shutdown_parameter:
1884
  for_shutdown_parameter:
1934
 
1885
 
1935
     mov  eax,[TASK_COUNT]
1886
     mov  eax,[TASK_COUNT]
Line 2051... Line 2002...
2051
sysfn_shutdown_param:   ; 18.9 = system shutdown with param
2002
sysfn_shutdown_param:   ; 18.9 = system shutdown with param
2052
     cmp  ebx,1
2003
     cmp  ebx,1
2053
     jl   exit_for_anyone
2004
     jl   exit_for_anyone
2054
     cmp  ebx,4
2005
     cmp  ebx,4
2055
     jg   exit_for_anyone
2006
     jg   exit_for_anyone
2056
     mov  [0x2f0000+0x9030],bl
2007
     mov  [BOOT_VAR+0x9030],bl
2057
     jmp  for_shutdown_parameter
2008
     jmp  for_shutdown_parameter
Line 2058... Line 2009...
2058
 
2009
 
2059
sysfn_minimize:         ; 18.10 = minimize window
2010
sysfn_minimize:         ; 18.10 = minimize window
2060
     mov   [window_minimize],1
2011
     mov   [window_minimize],1
Line 2796... Line 2747...
2796
        test    [edi+window_data+WDATA.fl_wstyle],WSTYLE_HASCAPTION
2747
        test    [edi+window_data+WDATA.fl_wstyle],WSTYLE_HASCAPTION
2797
        jz      @f
2748
        jz      @f
2798
        mov     ecx,[edi*8+SLOT_BASE+APPDATA.wnd_caption]
2749
        mov     ecx,[edi*8+SLOT_BASE+APPDATA.wnd_caption]
2799
        or      ecx,ecx
2750
        or      ecx,ecx
2800
        jz      @f
2751
        jz      @f
2801
        add     ecx,[edi+twdw+TASKDATA.mem_start]
2752
        add     ecx,[edi+CURRENT_TASK+TASKDATA.mem_start]
Line 2802... Line 2753...
2802
 
2753
 
2803
        movzx   eax,[edi+window_data+WDATA.fl_wstyle]
2754
        movzx   eax,[edi+window_data+WDATA.fl_wstyle]
2804
        and     al,0x0F
2755
        and     al,0x0F
2805
        cmp     al,3
2756
        cmp     al,3
Line 4753... Line 4704...
4753
     inc   ecx
4704
     inc   ecx
4754
     xor   edx,edx
4705
     xor   edx,edx
4755
     div   ecx
4706
     div   ecx
4756
     mov   ebx,edx
4707
     mov   ebx,edx
4757
     xchg  eax,ebx
4708
     xchg  eax,ebx
4758
     call  dword [0xe024]
4709
     call  dword [GETPIXEL]
4759
     mov   [esp+36],ecx
4710
     mov   [esp+36],ecx
4760
     ret
4711
     ret
Line 4761... Line 4712...
4761
 
4712
 
Line 4918... Line 4869...
4918
undefined_syscall:                      ; Undefined system call
4869
undefined_syscall:                      ; Undefined system call
Line 4919... Line 4870...
4919
 
4870
 
4920
     mov   [esp+36],dword -1
4871
     mov   [esp+36],dword -1
Line -... Line 4872...
-
 
4872
     ret
Line 4921... Line -...
4921
     ret
-
 
4922
 
-
 
4923
 
-
 
4924
;clear_busy_flag_at_caller:
-
 
4925
 
-
 
4926
;      push  edi
-
 
4927
 
-
 
4928
;      mov   edi,[CURRENT_TASK]    ; restore processes tss pointer in gdt, busyfl?
-
 
4929
;      imul  edi,8
-
 
4930
;      mov   [edi+gdts+ tss0 +5], word 01010000b *256 +11101001b
-
 
4931
 
-
 
4932
;      pop   edi
-
 
4933
 
-
 
4934
;      ret
-
 
4935
 
-
 
4936
 
-
 
4937
keymap:
-
 
4938
 
-
 
4939
     db   '6',27
-
 
4940
     db   '1234567890-=',8,9
-
 
4941
     db   'qwertyuiop[]',13
-
 
4942
     db   '~asdfghjkl;',39,96,0,'\zxcvbnm,./',0,'45 '
-
 
4943
     db   '@234567890123',180,178,184,'6',176,'7'
-
 
4944
     db   179,'8',181,177,183,185,182
-
 
4945
     db   'AB
-
 
4946
     db   'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-
 
4947
     db   'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-
 
4948
     db   'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-
 
4949
 
-
 
4950
 
-
 
4951
keymap_shift:
-
 
4952
 
-
 
4953
     db   '6',27
-
 
4954
     db   '!@#$%^&*()_+',8,9
-
 
4955
     db   'QWERTYUIOP{}',13
-
 
4956
     db   '~ASDFGHJKL:"~',0,'|ZXCVBNM<>?',0,'45 '
-
 
4957
     db   '@234567890123',180,178,184,'6',176,'7'
-
 
4958
     db   179,'8',181,177,183,185,182
-
 
4959
     db   'AB>D',255,'FGHIJKLMNOPQRSTUVWXYZ'
-
 
4960
     db   'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-
 
4961
     db   'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-
 
4962
     db   'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-
 
4963
 
-
 
4964
 
-
 
4965
keymap_alt:
-
 
4966
 
-
 
4967
     db   ' ',27
-
 
4968
     db   ' @ $  {[]}\ ',8,9
-
 
4969
     db   '            ',13
-
 
4970
     db   '             ',0,'           ',0,'4',0,' '
-
 
4971
     db   '             ',180,178,184,'6',176,'7'
-
 
4972
     db   179,'8',181,177,183,185,182
-
 
4973
     db   'ABCD',255,'FGHIJKLMNOPQRSTUVWXYZ'
-
 
4974
     db   'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-
 
4975
     db   'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-
 
4976
     db   'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-
 
4977
 
-
 
4978
 
-
 
4979
; device irq owners
-
 
4980
uglobal
-
 
4981
irq_owner:       ; process id
-
 
4982
 
-
 
4983
     dd   0x0
-
 
4984
     dd   0x0
-
 
4985
     dd   0x0
-
 
4986
     dd   0x0
-
 
4987
     dd   0x0
-
 
4988
     dd   0x0
-
 
4989
     dd   0x0
-
 
4990
     dd   0x0
-
 
4991
     dd   0x0
-
 
4992
     dd   0x0
-
 
4993
     dd   0x0
-
 
4994
     dd   0x0
-
 
4995
     dd   0x0
-
 
4996
     dd   0x0
-
 
4997
     dd   0x0
-
 
4998
     dd   0x0
-
 
4999
endg
-
 
5000
 
-
 
5001
 
-
 
5002
; on irq read ports
-
 
5003
uglobal
-
 
5004
  irq00read  dd  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
-
 
5005
  irq01read  dd  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
-
 
5006
  irq02read  dd  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
-
 
5007
  irq03read  dd  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
-
 
5008
  irq04read  dd  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
-
 
5009
  irq05read  dd  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
-
 
5010
  irq06read  dd  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
-
 
5011
  irq07read  dd  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
-
 
5012
  irq08read  dd  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
-
 
5013
  irq09read  dd  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
-
 
5014
  irq10read  dd  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
-
 
5015
  irq11read  dd  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
-
 
5016
  irq12read  dd  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
-
 
5017
  irq13read  dd  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
-
 
5018
  irq14read  dd  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
-
 
5019
  irq15read  dd  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
-
 
5020
endg
-
 
5021
 
-
 
5022
; status
-
 
5023
uglobal
-
 
5024
  hd1_status                  dd 0x0  ; 0 - free : other - pid
-
 
5025
  application_table_status    dd 0x0  ; 0 - free : other - pid
-
 
5026
endg
-
 
5027
 
-
 
5028
; device addresses
-
 
5029
uglobal
-
 
5030
  mididp     dd 0x0
-
 
5031
  midisp     dd 0x0
-
 
5032
 
-
 
5033
  cdbase     dd 0x0
-
 
5034
  cdid       dd 0x0
-
 
5035
 
-
 
5036
  hdbase              dd   0x0  ; for boot 0x1f0
-
 
5037
  hdid                dd   0x0
-
 
5038
  hdpos               dd   0x0  ; for boot 0x1
-
 
5039
  fat32part           dd   0x0  ; for boot 0x1
-
 
5040
 
-
 
5041
  ;part2_ld            dd   0x0
-
 
5042
 
-
 
5043
;* start code - Mario79
-
 
5044
mouse_pause         dd   0
-
 
5045
MouseTickCounter    dd   0
-
 
5046
ps2_mouse_detected  db   0
-
 
5047
com1_mouse_detected db   0
-
 
5048
com2_mouse_detected db   0
-
 
5049
;* end code - Mario79
-
 
5050
 
-
 
5051
wraw_bacground_select db 0
-
 
5052
  lba_read_enabled    dd   0x0  ; 0 = disabled , 1 = enabled
-
 
5053
  pci_access_enabled  dd   0x0  ; 0 = disabled , 1 = enabled
-
 
5054
 
-
 
5055
  sb16       dd 0x0
-
 
5056
 
-
 
5057
  buttontype         dd 0x0
-
 
5058
  windowtypechanged  dd 0x0
-
 
5059
 
-
 
5060
align 4
-
 
5061
  cpu_caps    dd 4 dup(0)
-
 
5062
  pg_data  PG_DATA
-
 
5063
  heap_test   dd ?
-
 
5064
endg
-
 
5065
 
-
 
5066
iglobal
-
 
5067
  keyboard   dd 0x1
-
 
5068
  sound_dma  dd 0x1
-
 
5069
  syslang    dd 0x1
-
 
5070
endg
-
 
5071
 
-
 
5072
if __DEBUG__ eq 1
-
 
5073
  include_debug_strings
-
 
5074
end if
-
 
5075
 
-
 
5076
IncludeIGlobals
4873
 
5077
endofcode:
4874
include "data32.inc"