system starts faster (minus 250 milliseconds)

git-svn-id: svn://kolibrios.org@2425 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Artem Jerdev (art_zh) 2012-03-01 01:22:24 +00:00
parent 085a190723
commit c1e1e0ac8a
2 changed files with 40 additions and 48 deletions

View File

@ -51,8 +51,8 @@ preinit_mem:
; ====================================================================== ; ======================================================================
align 4 align 4
proc init_mem
init_mem:
mov ecx, 0xC001001A ; Top of Memory MSR mov ecx, 0xC001001A ; Top of Memory MSR
xor edi, edi xor edi, edi
rdmsr rdmsr
@ -128,11 +128,8 @@ proc init_mem
lea esi, [edi+(OS_BASE shr 20)] lea esi, [edi+(OS_BASE shr 20)]
movsd movsd
movsd movsd
ret
endp
align 4 init_page_map:
proc init_page_map
; mark all memory as available ; mark all memory as available
mov edi, sys_pgmap-OS_BASE mov edi, sys_pgmap-OS_BASE
mov ecx, [pg_data.pagemap_size-OS_BASE] mov ecx, [pg_data.pagemap_size-OS_BASE]
@ -170,7 +167,7 @@ proc init_page_map
mov [pg_data.pg_mutex-OS_BASE], 0 mov [pg_data.pg_mutex-OS_BASE], 0
ret ret
endp
align 4 align 4

View File

@ -233,7 +233,6 @@ end if
; MEMORY MODEL ; MEMORY MODEL
call init_mem ; (init.inc) call init_mem ; (init.inc)
call init_page_map ; (init.inc)
; ENABLE PAGING ; ENABLE PAGING
@ -681,32 +680,45 @@ include 'vmodeld.inc'
mov [SLOT_BASE+APPDATA.cursor+256],eax mov [SLOT_BASE+APPDATA.cursor+256],eax
; READ TSC / SECOND ; READ TSC / SECOND == Fusion only!
; mov esi,boot_tsc
; call boot_log
cli cli
rdtsc ;call _rdtsc mov edx, PCIe_CONFIG_SPACE + 0xE0
mov ecx,eax mov eax, 0x013080F0 ; BIOS timer reg.
mov esi,250 ; wait 1/4 a second mov [edx], eax
call delay_ms add dl, 4
rdtsc ;call _rdtsc mov edi, edx
mov eax, [edi] ; old microseconds
inc eax ; next precise microsecond
mov esi, eax
@@:
mov eax, [edi]
cmp eax, esi
jne @b
rdtsc
mov ebp, eax ; clockmark
add esi, 20 ; wait 20us
@@:
mov eax, [edi]
cmp eax, esi
jne @b
rdtsc
sub eax, ebp
mov ebx, 50000
mul ebx ; clks per second
sti sti
sub eax,ecx
shl eax,2
mov [CPU_FREQ],eax ; save tsc / sec mov [CPU_FREQ],eax ; save tsc / sec
; mov ebx, 1000000 mov ebx, 1000000
; div ebx div ebx
; faster division possible: mov [stall_mcs], eax
mov edx, 2251799814
mul edx
shr edx, 19
mov [stall_mcs], edx
; PRINT CPU FREQUENCY ; PRINT CPU FREQUENCY
mov esi, boot_cpufreq mov esi, boot_cpufreq
call boot_log call boot_log
mov ebx, edx mov ebx, eax
movzx ecx, word [boot_y] movzx ecx, word [boot_y]
add ecx, (10+17*6) shl 16 - 10 ; 'CPU frequency is ' add ecx, (10+17*6) shl 16 - 10 ; 'CPU frequency is '
mov edx, 0xFFFFFF mov edx, 0xFFFFFF
@ -721,13 +733,8 @@ include 'vmodeld.inc'
; SET MOUSE ; SET MOUSE
;call detect_devices
stdcall load_driver, szPS2MDriver stdcall load_driver, szPS2MDriver
; mov esi,boot_setmouse
; call boot_log
; call setmouse
; mov [MOUSE_PICTURE],dword mousepointer
cli cli
; STACK AND FDC ; STACK AND FDC
@ -804,12 +811,6 @@ first_app_found:
and al,00000010b and al,00000010b
loopnz @b loopnz @b
; mov al, 0xED ; svetodiody - only for testing!
; call kb_write
; call kb_read
; mov al, 111b
; call kb_write
; call kb_read
mov al, 0xF3 ; set repeat rate & delay mov al, 0xF3 ; set repeat rate & delay
call kb_write call kb_write
@ -825,15 +826,6 @@ first_app_found:
; START MULTITASKING ; START MULTITASKING
;if preboot_blogesc
; mov esi, boot_tasking
; call boot_log
;.bll1: in al, 0x60 ; wait for ESC key press
; cmp al, 129
; jne .bll1
;end if
stdcall attach_int_handler, 1, irq1, 0 stdcall attach_int_handler, 1, irq1, 0
cmp [IDEContrRegsBaseAddr], 0 cmp [IDEContrRegsBaseAddr], 0
@ -845,9 +837,12 @@ first_app_found:
jmp osloop ; Fly :) jmp osloop ; Fly :)
diff16 "init code end: ",0,$ diff16 "init code end ",0,$
unpacker_inc:
include 'unpacker.inc' include 'unpacker.inc'
diff16 "unpacker code ",unpacker_inc,$
include 'fdo.inc' include 'fdo.inc'
align 4 align 4