Subversion Repositories Kolibri OS

Rev

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

Rev 847 Rev 848
Line 53... Line 53...
53
;;
53
;;
54
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
54
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 55... Line 55...
55
 
55
 
Line 56... Line 56...
56
include 'macros.inc'
56
include 'macros.inc'
Line 57... Line 57...
57
 
57
 
Line 58... Line 58...
58
$Revision: 847 $
58
$Revision: 848 $
Line 116... Line 116...
116
  dd  0x100000
116
  dd  0x100000
117
  dd  __edata - OS_BASE
117
  dd  __edata - OS_BASE
118
  dd  LAST_PAGE
118
  dd  LAST_PAGE
119
  dd  __start
119
  dd  __start
Line 120... Line -...
120
 
-
 
121
 
120
 
122
align 16
121
align 16
123
__start:
122
__start:
Line 124... Line 123...
124
           cld
123
           cld
Line 163... Line 162...
163
           add eax, 4*1024*1024
162
           add eax, 4*1024*1024
164
           loop @B
163
           loop @B
Line 165... Line 164...
165
 
164
 
166
           mov dword [_sys_pdbr-OS_BASE],   PG_LARGE+PG_SW
165
           mov dword [_sys_pdbr-OS_BASE],   PG_LARGE+PG_SW
167
           mov dword [_sys_pdbr-OS_BASE+4], PG_LARGE+PG_SW+4*1024*1024
166
           mov dword [_sys_pdbr-OS_BASE+4], PG_LARGE+PG_SW+4*1024*1024
Line 168... Line 167...
168
           mov dword [_sys_pdbr-OS_BASE+(page_tabs shr 20)], sys_pgdir+PG_SW-OS_BASE
167
           mov dword [_sys_pdbr-OS_BASE+(page_tabs shr 20)], _sys_pdbr+PG_SW-OS_BASE
169
 
168
 
170
           mov ebx, cr4
169
           mov ebx, cr4
171
           or ebx, CR4_PSE
170
           or ebx, CR4_PSE
Line 218... Line 217...
218
           db 'Halted',0
217
           db 'Halted',0
Line 219... Line 218...
219
 
218
 
220
sz_nopse   db 'Page size extensions not supported',0x0A
219
sz_nopse   db 'Page size extensions not supported',0x0A
Line -... Line 220...
-
 
220
           db 'Halted',0
-
 
221
 
-
 
222
org $-0x100000
-
 
223
 
-
 
224
align 4
-
 
225
 
-
 
226
_enter_bootscreen:
-
 
227
 
-
 
228
use16
-
 
229
           mov eax, cr0
-
 
230
           and eax, not 0x80000001
-
 
231
           mov cr0, eax
-
 
232
           jmp far 0x1000:start_of_code
-
 
233
 
-
 
234
version db    'Kolibri OS  version 0.7.1.0      ',13,10,13,10,0
-
 
235
 
-
 
236
include "boot/bootstr.inc"     ; language-independent boot messages
-
 
237
include "boot/preboot.inc"
-
 
238
 
-
 
239
if lang eq en
-
 
240
include "boot/booteng.inc"     ; english system boot messages
-
 
241
else if lang eq ru
-
 
242
include "boot/bootru.inc"      ; russian system boot messages
-
 
243
include "boot/ru.inc"	       ; Russian font
-
 
244
else if lang eq et
-
 
245
include "boot/bootet.inc"      ; estonian system boot messages
-
 
246
include "boot/et.inc"	       ; Estonian font
-
 
247
else
-
 
248
include "boot/bootge.inc"      ; german system boot messages
-
 
249
end if
-
 
250
 
-
 
251
include "data16.inc"
-
 
252
 
-
 
253
include "boot/bootcode.inc"    ; 16 bit system boot code
-
 
254
include "bus/pci/pci16.inc"
-
 
255
include "detect/biosdisk.inc"
-
 
256
 
-
 
257
;include "boot/shutdown.inc" ; shutdown or restart
-
 
258
 
-
 
259
           cli
-
 
260
 
-
 
261
           mov eax, cr0
-
 
262
           or eax, 0x80000001
-
 
263
           mov cr0, eax
-
 
264
 
-
 
265
           jmp pword os_code:__setvars
-
 
266
 
-
 
267
org $+0x100000
-
 
268
 
-
 
269
align 4
-
 
270
_leave_bootscreen:
Line 221... Line 271...
221
           db 'Halted',0
271
 
Line 222... Line 272...
222
 
272
use32
Line 237... Line 287...
237
; CLEAR KERNEL UNDEFINED GLOBALS
287
; CLEAR KERNEL UNDEFINED GLOBALS
238
       ;    mov   edi, endofcode-OS_BASE
288
       ;    mov   edi, endofcode-OS_BASE
239
       ;    mov   ecx, (uglobals_size/4)+4
289
       ;    mov   ecx, (uglobals_size/4)+4
240
       ;    rep   stosd
290
       ;    rep   stosd
Line 241... Line -...
241
 
-
 
242
; SAVE & CLEAR 0-0xffff
-
 
243
 
-
 
244
       ;    xor esi, esi
-
 
245
       ;    mov   edi,0x2F0000
-
 
246
       ;    mov   ecx,0x10000 / 4
-
 
247
       ;    rep   movsd
-
 
248
       ;    xor edi, edi
-
 
249
       ;    mov   ecx,0x10000 / 4
-
 
Line 250... Line 291...
250
       ;    rep   stosd
291
 
251
 
292
 
Line 252... Line 293...
252
        ;   call test_cpu
293
        ;   call test_cpu
Line 253... Line 294...
253
	   bts [cpu_caps-OS_BASE], CAPS_TSC	;force use rdtsc
294
	   bts [cpu_caps-OS_BASE], CAPS_TSC	;force use rdtsc
254
 
295
 
Line 255... Line 296...
255
        ;   call init_BIOS32
296
        ;   call init_BIOS32
256
 
297
 
257
           mov dword [sys_pgdir-OS_BASE], PG_LARGE+PG_SW
298
       ;    mov dword [sys_pgdir-OS_BASE], PG_LARGE+PG_SW
258
           mov dword [sys_pgdir-OS_BASE+4], PG_LARGE+PG_SW+4*1024*1024
299
       ;    mov dword [sys_pgdir-OS_BASE+4], PG_LARGE+PG_SW+4*1024*1024
259
 
300
 
260
           mov ecx, 32
301
       ;    mov ecx, 32
261
           lea edi, [sys_pgdir-OS_BASE+0xE00]
302
       ;    lea edi, [sys_pgdir-OS_BASE+0xE00]
Line 262... Line 303...
262
           mov eax, PG_LARGE+PG_SW
303
       ;    mov eax, PG_LARGE+PG_SW
263
@@:
304
;@@:
264
           stosd
305
;           stosd
265
           add eax, 4*1024*1024
306
;           add eax, 4*1024*1024
Line 266... Line 307...
266
           loop @B
307
;           loop @B
267
 
308
 
268
           mov ebx, cr4
309
;           mov ebx, cr4
Line 269... Line 310...
269
           or ebx, CR4_PSE
310
;           or ebx, CR4_PSE
270
           and ebx, not CR4_PAE
311
;           and ebx, not CR4_PAE
Line 271... Line 312...
271
           mov cr4, ebx
312
;           mov cr4, ebx
272
 
313
 
Line 273... Line 314...
273
 
314
 
274
	   mov eax, sys_pgdir-OS_BASE
315
;           mov eax, sys_pgdir-OS_BASE
275
           mov ebx, cr0
316
;           mov ebx, cr0
Line 276... Line -...
276
           or ebx,CR0_PG+CR0_WP
-
 
277
 
-
 
278
           mov cr3, eax
-
 
279
           mov cr0, ebx
-
 
280
 
-
 
Line 281... Line 317...
281
	   lgdt [gdts]
317
;           or ebx,CR0_PG+CR0_WP
282
	   jmp pword os_code:high_code
318
 
Line -... Line 319...
-
 
319
;           mov cr3, eax
283
 
320
;           mov cr0, ebx
Line 284... Line 321...
284
align 4
321
 
285
bios32_entry	dd ?
322
;           lgdt [gdts]
286
tmp_page_tabs	dd ?
323
;           jmp pword os_code:high_code
Line 463... Line 500...
463
	   rep stosd		     ; access to 4096*8=65536 ports
500
	   rep stosd		     ; access to 4096*8=65536 ports
Line 464... Line 501...
464
 
501
 
465
	   mov	ax,tss0
502
	   mov	ax,tss0
Line 466... Line -...
466
	   ltr	ax
-
 
467
 
-
 
468
           xchg bx, bx
503
	   ltr	ax
469
 
504
 
470
           mov ecx, 1280*1024
505
           mov ecx, 1280*1024
Line 471... Line 506...
471
           fastcall _balloc
506
           fastcall _balloc
Line 481... Line 516...
481
           call init_kernel_heap     ; FIXME initialize heap after pager
516
           call init_kernel_heap     ; FIXME initialize heap after pager
Line 482... Line 517...
482
 
517
 
483
           call _init_mm
518
           call _init_mm
Line -... Line 519...
-
 
519
           mov [pg_data.pg_mutex], 0
-
 
520
 
-
 
521
           mov esi, 0x100000
484
           mov [pg_data.pg_mutex], 0
522
           mov ecx, (_leave_bootscreen-0x100000)/4
-
 
523
           mov edi, 0x10000
-
 
524
           cld
-
 
525
           rep movsd
-
 
526
 
-
 
527
           jmp far 0x60:_enter_bootscreen;
-
 
528
 
-
 
529
align 4
-
 
530
__setvars:
-
 
531
           mov ax,os_stack
-
 
532
           mov dx,app_data
-
 
533
	   mov ss,ax
-
 
534
           mov esp, __os_stack
-
 
535
 
-
 
536
           mov ds, dx
-
 
537
           mov es, dx
-
 
538
           mov fs, dx
-
 
539
           mov gs, dx
Line -... Line 540...
-
 
540
 
-
 
541
; SAVE & CLEAR 0-0xffff
-
 
542
 
-
 
543
           xor esi, esi
-
 
544
           mov   edi,0x2F0000
-
 
545
           mov   ecx,0x10000 / 4
-
 
546
           rep   movsd
-
 
547
           xor edi, edi
Line 485... Line 548...
485
 
548
           xor eax, eax
486
           hlt
549
           mov   ecx,0x10000 / 4
487
 
550
           rep   stosd
488
 
551
 
Line 543... Line 606...
543
	mov   [BytesPerScanLine],word 640*4	    ; Bytes PerScanLine
606
	mov   [BytesPerScanLine],word 640*4	    ; Bytes PerScanLine
544
	cmp   [SCR_MODE],word 0x13	    ; 320x200
607
	cmp   [SCR_MODE],word 0x13	    ; 320x200
545
	je    @f
608
	je    @f
546
	cmp   [SCR_MODE],word 0x12	    ; VGA 640x480
609
	cmp   [SCR_MODE],word 0x12	    ; VGA 640x480
547
	je    @f
610
	je    @f
-
 
611
 
548
	mov   ax,[BOOT_VAR+0x9001]	  ; for other modes
612
	mov   ax,[BOOT_VAR+0x9001]	  ; for other modes
549
	mov   [BytesPerScanLine],ax
613
	mov   [BytesPerScanLine],ax
550
@@:
614
@@:
551
	mov	esi, BOOT_VAR+0x9080
615
	mov	esi, BOOT_VAR+0x9080
552
	movzx	ecx, byte [esi-1]
616
	movzx	ecx, byte [esi-1]
Line 699... Line 763...
699
	mov   [BgrDataHeight],eax
763
	mov   [BgrDataHeight],eax
700
	mov    [mem_BACKGROUND],4095
764
	mov    [mem_BACKGROUND],4095
701
	stdcall kernel_alloc, [mem_BACKGROUND]
765
	stdcall kernel_alloc, [mem_BACKGROUND]
702
	mov [img_background], eax
766
	mov [img_background], eax
Line 703... Line 767...
703
 
767
 
Line 704... Line 768...
704
	mov	[SLOT_BASE + 256 + APPDATA.dir_table], sys_pgdir - OS_BASE
768
        mov     [SLOT_BASE + 256 + APPDATA.dir_table], _sys_pdbr - OS_BASE
Line 705... Line 769...
705
 
769
 
Line 738... Line 802...
738
;include 'boot/rdload.inc'
802
;include 'boot/rdload.inc'
739
;!!!!!!!!!!!!!!!!!!!!!!!
803
;!!!!!!!!!!!!!!!!!!!!!!!
740
;    mov    [dma_hdd],1
804
;    mov    [dma_hdd],1
741
; CALCULATE FAT CHAIN FOR RAMDISK
805
; CALCULATE FAT CHAIN FOR RAMDISK
Line 742... Line -...
742
 
-
 
743
 
806
 
Line 744... Line 807...
744
	call  calculatefatchain
807
	call  calculatefatchain
745
 
808
 
Line 866... Line 929...
866
 
929
 
Line 867... Line 930...
867
  ; READ TSC / SECOND
930
  ; READ TSC / SECOND
868
 
931
 
869
	mov   esi,boot_tsc
932
	mov   esi,boot_tsc
870
	call  boot_log
933
	call  boot_log
871
	cli
934
 
872
	call  _rdtsc
935
	call  _rdtsc
873
	mov   ecx,eax
936
	mov   ecx,eax
874
	mov   esi,250		    ; wait 1/4 a second
937
	mov   esi,250		    ; wait 1/4 a second
875
	call  delay_ms
938
	call  delay_ms
876
	call  _rdtsc
939
	call  _rdtsc
877
	sti
940
 
878
	sub   eax,ecx
941
	sub   eax,ecx
879
	shl   eax,2
942
	shl   eax,2
880
	mov   [CPU_FREQ],eax	      ; save tsc / sec
943
	mov   [CPU_FREQ],eax	      ; save tsc / sec
Line 939... Line 1002...
939
;  je  no_st_network
1002
;  je  no_st_network
940
;        call set_network_conf
1003
;        call set_network_conf
941
;  no_st_network:
1004
;  no_st_network:
Line 942... Line 1005...
942
 
1005
 
943
; LOAD FIRST APPLICATION
-
 
Line 944... Line 1006...
944
	cli
1006
; LOAD FIRST APPLICATION
945
 
1007
 
Line 946... Line 1008...
946
	cmp   byte [BOOT_VAR+0x9030],1
1008
	cmp   byte [BOOT_VAR+0x9030],1
Line 1010... Line 1072...
1010
; UNMASK ALL IRQ'S
1072
; UNMASK ALL IRQ'S
Line 1011... Line 1073...
1011
 
1073
 
1012
	mov   esi,boot_allirqs
1074
	mov   esi,boot_allirqs
Line 1013... Line -...
1013
	call  boot_log
-
 
1014
 
1075
	call  boot_log
1015
	cli			     ;guarantee forbidance of interrupts.
1076
 
1016
	mov   al,0		     ; unmask all irq's
1077
        mov   al,0                   ; unmask all irq's
Line 1017... Line 1078...
1017
	out   0xA1,al
1078
	out   0xA1,al
Line 1032... Line 1093...
1032
;        mov    [dma_hdd],1
1093
;        mov    [dma_hdd],1
1033
	cmp	[IDEContrRegsBaseAddr], 0
1094
	cmp	[IDEContrRegsBaseAddr], 0
1034
	setnz	[dma_hdd]
1095
	setnz	[dma_hdd]
1035
	mov [timer_ticks_enable],1		; for cd driver
1096
	mov [timer_ticks_enable],1		; for cd driver
Line 1036... Line -...
1036
 
-
 
1037
;        stdcall init_uart_service, DRV_ENTRY
-
 
1038
 
1097
 
1039
	sti
1098
	sti
Line 1040... Line 1099...
1040
	call change_task
1099
	call change_task
Line 1056... Line 1115...
1056
	 mov   bx,word [boot_y]
1115
	 mov   bx,word [boot_y]
1057
	 add   [boot_y],dword 10
1116
	 add   [boot_y],dword 10
1058
	 mov   ecx,0x80ffffff	; ASCIIZ string with white color
1117
	 mov   ecx,0x80ffffff	; ASCIIZ string with white color
1059
	 mov   edx,esi
1118
	 mov   edx,esi
1060
	 mov   edi,1
1119
	 mov   edi,1
-
 
1120
 
1061
	 call  dtext
1121
         call  dtext
Line 1062... Line 1122...
1062
 
1122
 
1063
	 mov   [novesachecksum],1000
1123
	 mov   [novesachecksum],1000
Line 2111... Line 2171...
2111
    mov    eax,ecx
2171
    mov    eax,ecx
2112
    call   pid_to_slot
2172
    call   pid_to_slot
2113
    test   eax,eax
2173
    test   eax,eax
2114
    jz	   .not_found
2174
    jz	   .not_found
2115
    mov    ecx,eax
2175
    mov    ecx,eax
-
 
2176
    pushfd
2116
    cli
2177
    cli
2117
    call   sysfn_terminate
2178
    call   sysfn_terminate
2118
    mov    [application_table_status],0
2179
    mov    [application_table_status],0
2119
    sti
2180
    popfd
2120
    and    dword [esp+32],0
2181
    and    dword [esp+32],0
2121
    ret
2182
    ret
2122
.not_found:
2183
.not_found:
2123
    mov    [application_table_status],0
2184
    mov    [application_table_status],0
2124
    or	   dword [esp+32],-1
2185
    or	   dword [esp+32],-1
Line 4577... Line 4638...
4577
     mov   eax,0xffffffff
4638
     mov   eax,0xffffffff
4578
     ret
4639
     ret
Line 4579... Line 4640...
4579
 
4640
 
Line 4580... Line -...
4580
rerouteirqs:
-
 
4581
 
-
 
4582
	cli
4641
rerouteirqs:
4583
 
4642
 
4584
	mov	al,0x11 	;  icw4, edge triggered
4643
	mov	al,0x11 	;  icw4, edge triggered
4585
	out	0x20,al
4644
	out	0x20,al
4586
	call	pic_delay
4645
	call	pic_delay
Line 4622... Line 4681...
4622
	out	0xA1,al
4681
	out	0xA1,al
4623
	call	pic_delay
4682
	call	pic_delay
4624
	out	0x21,al
4683
	out	0x21,al
4625
	call	pic_delay
4684
	call	pic_delay
Line 4626... Line -...
4626
 
-
 
4627
	cli
-
 
4628
 
4685
 
Line 4629... Line 4686...
4629
	ret
4686
	ret