Subversion Repositories Kolibri OS

Rev

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

Rev 1678 Rev 1683
Line 56... Line 56...
56
;;
56
;;
57
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
57
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 58... Line 58...
58
 
58
 
Line 59... Line 59...
59
include 'macros.inc'
59
include 'macros.inc'
Line 60... Line 60...
60
 
60
 
Line 61... Line 61...
61
$Revision: 1678 $
61
$Revision: 1683 $
Line 128... Line 128...
128
 
128
 
129
include "boot/bootcode.inc"    ; 16 bit system boot code
129
include "boot/bootcode.inc"    ; 16 bit system boot code
130
include "bus/pci/pci16.inc"
130
include "bus/pci/pci16.inc"
Line -... Line 131...
-
 
131
include "detect/biosdisk.inc"
-
 
132
 
131
include "detect/biosdisk.inc"
133
diff16 "end of code16  ",0,$
132
 
134
 
133
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
135
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
134
;;                                                                      ;;
136
;;                                                                      ;;
135
;;                  SWITCH TO 32 BIT PROTECTED MODE                     ;;
137
;;                  SWITCH TO 32 BIT PROTECTED MODE                     ;;
Line 190... Line 192...
190
        dw     0x0000
192
	dw     0x0000
191
        db     0x00
193
	db     0x00
192
        dw     11011111b *256 +10010010b
194
	dw     11011111b *256 +10010010b
193
        db     0x00
195
	db     0x00
Line -... Line 196...
-
 
196
 
-
 
197
diff16 "end of tmp_gdt ",0,$
194
 
198
 
Line -... Line 199...
-
 
199
include "data16.inc"
-
 
200
 
195
include "data16.inc"
201
diff16 "end of data16  ",0,$
196
 
202
 
Line 197... Line 203...
197
use32
203
use32
198
org $+0x10000
204
org $+0x10000
-
 
205
 
199
 
206
align 4
200
align 4
207
B32:
201
B32:
208
diff16 "32-bit code start ",0,$
202
           mov   ax,os_stack       ; Selector for os
209
	   mov	 ax,os_stack	   ; Selector for os
203
           mov   ds,ax
210
	   mov	 ds,ax
204
           mov   es,ax
211
	   mov	 es,ax
205
           mov   fs,ax
212
	   mov	 fs,ax
206
           mov   gs,ax
-
 
207
           mov   ss,ax
-
 
Line 208... Line -...
208
           mov   esp,0x3ec00       ; Set stack
-
 
209
 
-
 
210
; CLEAR 0x280000 - HEAP_BASE
213
	   mov	 gs,ax
211
 
-
 
212
           xor   eax,eax
214
	   mov	 ss,ax
Line 213... Line 215...
213
           mov   edi,0x280000
215
	   mov	 esp,0x4ec00	   ; Set stack
214
           mov   ecx,(HEAP_BASE-OS_BASE-0x280000) / 4
216
 
215
           cld
-
 
Line 216... Line -...
216
           rep   stosd
-
 
217
 
217
;-------------------------------------------------------------------------------
218
           mov   edi,0x40000
-
 
219
           mov   ecx,(0x90000-0x40000)/4
-
 
Line 220... Line 218...
220
           rep   stosd
218
	   call preinit_mem	; (init.inc)
-
 
219
 
Line 221... Line -...
221
 
-
 
222
; CLEAR KERNEL UNDEFINED GLOBALS
-
 
223
           mov   edi, endofcode-OS_BASE
-
 
224
           mov   ecx, (uglobals_size/4)+4
-
 
225
           rep   stosd
-
 
226
 
-
 
227
; SAVE & CLEAR 0-0xffff
-
 
228
 
-
 
229
           xor   esi, esi
-
 
230
           mov   edi,0x2F0000
-
 
231
           mov   ecx,0x10000 / 4
-
 
232
           rep   movsd
-
 
233
           mov   edi,0x1000
220
	   call test_cpu	; (init.inc - to be moved to bus/CPU.inc)
234
           mov   ecx,0xf000 / 4
221
	   bts [cpu_caps-OS_BASE], CAPS_TSC	;force use rdtsc
235
           rep   stosd
222
 
Line 236... Line 223...
236
 
223
	   call init_BIOS32	; (init.inc - to be removed later)
Line 237... Line 224...
237
           call test_cpu
224
 
238
           bts [cpu_caps-OS_BASE], CAPS_TSC     ;force use rdtsc
225
; PCIe extended config space access
Line 376... Line 363...
376
        movzx   ecx, byte [esi-1]
363
	movzx	ecx, byte [esi-1]
377
        mov     [NumBiosDisks], ecx
364
	mov	[NumBiosDisks], ecx
378
        mov     edi, BiosDisksData
365
	mov	edi, BiosDisksData
379
        rep     movsd
366
	rep	movsd
Line -... Line 367...
-
 
367
 
380
 
368
 
Line 381... Line 369...
381
; GRAPHICS ADDRESSES
369
; GRAPHICS ADDRESSES
382
 
370
 
383
        and     byte [BOOT_VAR+0x901e],0x0
371
	and	byte [BOOT_VAR+0x901e],0x0
Line 384... Line -...
384
        mov     eax,[BOOT_VAR+0x9018]
-
 
385
        mov     [LFBAddress],eax
372
	mov	eax,[BOOT_VAR+0x9018]
386
 
373
	mov	[LFBAddress],eax
387
;==        
374
 
388
	cmp     [SCR_MODE],word 0100000000000000b
375
	cmp	[SCR_MODE],word 0100000000000000b
389
        jge     setvesa20
376
	jge	setvesa20
390
	mov	eax, 0xDEADBEEF
377
	mov	eax, 0xDEADBEEF
391
	hlt
-
 
392
;        ===  EGA, VGA & Vesa 1.2 modes not supported ===
-
 
393
      setvesa20:
-
 
394
;        mov     [PUTPIXEL],dword Vesa20_putpixel24  ; Vesa 2.0 24bpp modes
-
 
395
;        mov     [GETPIXEL],dword Vesa20_getpixel24
378
	hlt
396
;        cmp     [ScreenBPP],byte 24
379
;        ===  EGA, VGA & Vesa 1.2 modes not supported ===
397
;        jz      v20ga24
380
setvesa20:
Line 398... Line 381...
398
      v20ga32:
381
v20ga32:
399
        mov     [PUTPIXEL],dword Vesa20_putpixel32
-
 
400
        mov     [GETPIXEL],dword Vesa20_getpixel32
-
 
401
 
-
 
402
; -------- Fast System Call init ----------
-
 
403
; Intel SYSENTER/SYSEXIT (AMD CPU support it too)
-
 
404
;           bt [cpu_caps], CAPS_SEP
-
 
405
;           jnc .SEnP   ; SysEnter not Present
-
 
406
;           xor edx, edx
-
 
407
;           mov ecx, MSR_SYSENTER_CS
-
 
408
;           mov eax, os_code
-
 
409
;           wrmsr
-
 
410
;           mov ecx, MSR_SYSENTER_ESP
-
 
411
;;           mov eax, sysenter_stack ; Check it
-
 
412
;           xor     eax, eax
-
 
413
;           wrmsr
382
	mov	[PUTPIXEL],dword Vesa20_putpixel32
414
;           mov ecx, MSR_SYSENTER_EIP
383
	mov	[GETPIXEL],dword Vesa20_getpixel32
415
;           mov eax, sysenter_entry
-
 
416
;           wrmsr
-
 
417
.SEnP:
-
 
418
; AMD SYSCALL/SYSRET
-
 
419
;           cmp byte[cpu_vendor], 'A'
-
 
420
;          jne .noSYSCALL
-
 
421
;           mov eax, 0x80000001
384
 
422
;           cpuid
385
; -------- Fast System Call init ----------
423
;           test edx, 0x800  ; bit_11 - SYSCALL/SYSRET support
386
.SEnP:
424
;           jz .noSYSCALL
387
; AMD SYSCALL/SYSRET
Line 425... Line 388...
425
           mov ecx, MSR_AMD_EFER
388
	   mov ecx, MSR_AMD_EFER
426
           rdmsr
389
	   rdmsr
427
           or eax, 1   ; bit_0 - System Call Extension (SCE)
390
	   or eax, 1   ; bit_0 - System Call Extension (SCE)
428
           wrmsr
391
	   wrmsr
429
 
392
 
Line 430... Line 393...
430
        ; Bits of EDX :
393
	; Bits of EDX :
Line 431... Line 394...
431
        ; Bit 31–16 During the SYSRET instruction, this field is copied into the CS register
394
	; Bit 31..16 During the SYSRET instruction, this field is copied into the CS register
Line 485... Line 448...
485
 
448
 
486
           mov [LFBSize], 0x800000
449
	   mov [LFBSize], 0x800000
487
           call init_LFB
450
	   call init_LFB
488
           call init_fpu
451
	   call init_fpu
489
           call init_malloc
452
	   call init_malloc
490
 
453
;-
491
           stdcall alloc_kernel_space, 0x51000
454
	   stdcall alloc_kernel_space, 0x51000
Line 492... Line 455...
492
           mov [default_io_map], eax
455
	   mov [default_io_map], eax
493
 
456
 
Line 741... Line 704...
741
        sub   eax,ecx
704
	sub   eax,ecx
742
        shl   eax,2
705
	shl   eax,2
743
        mov   [CPU_FREQ],eax          ; save tsc / sec
706
	mov   [CPU_FREQ],eax	      ; save tsc / sec
744
;       mov ebx, 1000000
707
;       mov ebx, 1000000
745
;       div ebx
708
;       div ebx
746
; ¢®®¡é¥-â® ¯à®¨§¢®¤¨â¥«ì­®áâì ¢ ¤ ­­®¬ ª®­ªà¥â­®¬ ¬¥áâ¥
-
 
747
; ᮢ¥à襭­® ­¥ªà¨â¨ç­ , ­® çâ®¡ë § âª­ãâì «î¡¨â¥«¥©
-
 
748
; ®¯â¨¬¨§¨àãîé¨å ª®¬¯¨«ïâ®à®¢ Ÿ‚“...
709
; faster division possible:
749
        mov     edx, 2251799814
710
	mov	edx, 2251799814
750
        mul     edx
711
	mul	edx
751
        shr     edx, 19
712
	shr	edx, 19
752
        mov [stall_mcs], edx
713
	mov [stall_mcs], edx
753
; PRINT CPU FREQUENCY
714
; PRINT CPU FREQUENCY
Line 781... Line 742...
781
; STACK AND FDC
742
; STACK AND FDC
Line 782... Line 743...
782
 
743
 
783
        call  stack_init
744
	call  stack_init
Line 784... Line -...
784
        call  fdc_init
-
 
785
 
-
 
786
; PALETTE FOR 320x200 and 640x480 16 col
-
 
787
 
-
 
788
;        cmp   [SCR_MODE],word 0x12
-
 
789
;        jne   no_pal_vga
-
 
790
;        mov   esi,boot_pal_vga
-
 
791
;        call  boot_log
-
 
792
;        call  paletteVGA
-
 
793
;      no_pal_vga:
-
 
794
 
-
 
795
;        cmp   [SCR_MODE],word 0x13
-
 
796
;        jne   no_pal_ega
-
 
797
;        mov   esi,boot_pal_ega
-
 
798
;        call  boot_log
-
 
Line 799... Line 745...
799
;        call  palette320x200
745
	call  fdc_init
Line 800... Line 746...
800
;      no_pal_ega:
746
 
Line 822... Line 768...
822
  no_st_network:
768
  no_st_network:
Line 823... Line 769...
823
 
769
 
824
        call init_userDMA	; <<<<<<<<< ============== core/memory.inc =================
770
	call init_userDMA	; <<<<<<<<< ============== core/memory.inc =================
825
        mov     esi, boot_uDMA_ok
771
	mov	esi, boot_uDMA_ok
826
        call    boot_log
-
 
827
;	call pci_ext_config	; <<<<<<<<< bus/pci/pcie.inc
-
 
828
;-------------------------------------------------------------------------------
-
 
Line 829... Line 772...
829
        call rs7xx_pcie_init    ; <<<<<<<<< bus/ht.inc
772
	call	boot_log
830
 
773
 
Line 831... Line 774...
831
; LOAD FIRST APPLICATION
774
; LOAD FIRST APPLICATION
Line 4899... Line 4842...
4899
        stc
4842
	stc
4900
.ok:
4843
.ok:
4901
        ret
4844
	ret
4902
end if
4845
end if
Line -... Line 4846...
-
 
4846
 
-
 
4847
diff16 "End of 32-code ",0,$
4903
 
4848
 
Line 4904... Line 4849...
4904
include "data32.inc"
4849
include "data32.inc"
Line 4905... Line 4850...
4905
 
4850
 
-
 
4851
__REV__ = __REV
4906
__REV__ = __REV
4852