mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-12-25 08:06:49 +03:00
speed up booting in some configurations
git-svn-id: svn://kolibrios.org@5031 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
2ecf899269
commit
6a10b418b1
@ -1,7 +1,7 @@
|
|||||||
kbd_read:
|
kbd_read:
|
||||||
push ecx edx
|
push ecx edx
|
||||||
|
|
||||||
mov ecx,0x1ffff ; last 0xffff, new value in view of fast CPU's
|
mov ecx,0xfffff ; last 0xffff, new value in view of fast CPU's
|
||||||
kr_loop:
|
kr_loop:
|
||||||
in al,0x64
|
in al,0x64
|
||||||
test al,1
|
test al,1
|
||||||
@ -10,11 +10,6 @@ kbd_read:
|
|||||||
mov ah,1
|
mov ah,1
|
||||||
jmp kr_exit
|
jmp kr_exit
|
||||||
kr_ready:
|
kr_ready:
|
||||||
push ecx
|
|
||||||
mov ecx,32
|
|
||||||
kr_delay:
|
|
||||||
loop kr_delay
|
|
||||||
pop ecx
|
|
||||||
in al,0x60
|
in al,0x60
|
||||||
xor ah,ah
|
xor ah,ah
|
||||||
kr_exit:
|
kr_exit:
|
||||||
@ -27,40 +22,19 @@ kbd_write:
|
|||||||
push ecx edx
|
push ecx edx
|
||||||
|
|
||||||
mov dl,al
|
mov dl,al
|
||||||
in al,0x60
|
mov ecx,0x1ffff
|
||||||
mov ecx,0x1ffff ; last 0xffff, new value in view of fast CPU's
|
@@:
|
||||||
kw_loop:
|
|
||||||
in al,0x64
|
in al,0x64
|
||||||
test al,2
|
test al,2
|
||||||
jz kw_ok
|
jz @f
|
||||||
loop kw_loop
|
loop @b
|
||||||
mov ah,1
|
mov ah,1
|
||||||
jmp kw_exit
|
jmp .nothing
|
||||||
kw_ok:
|
@@:
|
||||||
mov al,dl
|
mov al,dl
|
||||||
out 0x60,al
|
out 0x60,al
|
||||||
mov ecx,0x1ffff ; last 0xffff, new value in view of fast CPU's
|
mov ah,0
|
||||||
kw_loop3:
|
.nothing:
|
||||||
in al,0x64
|
|
||||||
test al,2
|
|
||||||
jz kw_ok3
|
|
||||||
loop kw_loop3
|
|
||||||
mov ah,1
|
|
||||||
jmp kw_exit
|
|
||||||
kw_ok3:
|
|
||||||
mov ah,8
|
|
||||||
kw_loop4:
|
|
||||||
mov ecx,0x1ffff ; last 0xffff, new value in view of fast CPU's
|
|
||||||
kw_loop5:
|
|
||||||
in al,0x64
|
|
||||||
test al,1
|
|
||||||
jnz kw_ok4
|
|
||||||
loop kw_loop5
|
|
||||||
dec ah
|
|
||||||
jnz kw_loop4
|
|
||||||
kw_ok4:
|
|
||||||
xor ah,ah
|
|
||||||
kw_exit:
|
|
||||||
pop edx ecx
|
pop edx ecx
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@ -73,20 +47,11 @@ kbd_cmd:
|
|||||||
test al,2
|
test al,2
|
||||||
jz c_send
|
jz c_send
|
||||||
loop c_wait
|
loop c_wait
|
||||||
jmp c_error
|
mov ah,1
|
||||||
|
jmp c_exit
|
||||||
c_send:
|
c_send:
|
||||||
mov al,bl
|
mov al,bl
|
||||||
out 0x64,al
|
out 0x64,al
|
||||||
mov ecx,0x1ffff ; last 0xffff, new value in view of fast CPU's
|
|
||||||
c_accept:
|
|
||||||
in al,0x64
|
|
||||||
test al,2
|
|
||||||
jz c_ok
|
|
||||||
loop c_accept
|
|
||||||
c_error:
|
|
||||||
mov ah,1
|
|
||||||
jmp c_exit
|
|
||||||
c_ok:
|
|
||||||
xor ah,ah
|
xor ah,ah
|
||||||
c_exit:
|
c_exit:
|
||||||
ret
|
ret
|
||||||
|
@ -36,8 +36,27 @@ section '.flat' code readable align 16
|
|||||||
proc START stdcall, state:dword
|
proc START stdcall, state:dword
|
||||||
|
|
||||||
cmp [state], DRV_ENTRY
|
cmp [state], DRV_ENTRY
|
||||||
jne .fin
|
jne .nothing
|
||||||
.init:
|
.init:
|
||||||
|
; disable keyboard and mouse interrupts
|
||||||
|
; keyboard IRQ handler can interfere badly otherwise
|
||||||
|
pushf
|
||||||
|
cli
|
||||||
|
mov bl, 0x20 ; read command byte
|
||||||
|
call kbd_cmd
|
||||||
|
test ah,ah
|
||||||
|
jnz .fin
|
||||||
|
call kbd_read
|
||||||
|
test ah,ah
|
||||||
|
jnz .fin
|
||||||
|
popf
|
||||||
|
and al, 0xFC ; disable interrupts
|
||||||
|
or al, 0x10 ; disable keyboard
|
||||||
|
push eax
|
||||||
|
mov bl, 0x60 ; write command byte
|
||||||
|
call kbd_cmd
|
||||||
|
pop eax
|
||||||
|
call kbd_write
|
||||||
|
|
||||||
call detect_mouse
|
call detect_mouse
|
||||||
test eax,eax
|
test eax,eax
|
||||||
@ -57,49 +76,50 @@ proc START stdcall, state:dword
|
|||||||
|
|
||||||
.stop_try:
|
.stop_try:
|
||||||
|
|
||||||
mov bl, 0x20 ; read command byte
|
|
||||||
call kbd_cmd
|
|
||||||
cmp ah,1
|
|
||||||
je .exit
|
|
||||||
|
|
||||||
call kbd_read
|
|
||||||
cmp ah,1
|
|
||||||
je .exit
|
|
||||||
|
|
||||||
or al, 10b
|
|
||||||
push eax
|
|
||||||
mov bl, 0x60 ; write command byte
|
|
||||||
call kbd_cmd
|
|
||||||
cmp ah,1
|
|
||||||
je .exit
|
|
||||||
|
|
||||||
pop eax
|
|
||||||
call kbd_write
|
|
||||||
cmp ah,1
|
|
||||||
je .exit
|
|
||||||
|
|
||||||
mov al, 0xF4 ; enable data reporting
|
mov al, 0xF4 ; enable data reporting
|
||||||
call mouse_cmd
|
call mouse_cmd
|
||||||
|
|
||||||
mov bl, 0xAE ; enable keyboard interface
|
; enable keyboard and mouse interrupts
|
||||||
|
mov bl, 0x20 ; read command byte
|
||||||
call kbd_cmd
|
call kbd_cmd
|
||||||
|
call kbd_read
|
||||||
|
or al, 3 ; enable interrupts
|
||||||
|
and al, not 0x10 ; enable keyboard
|
||||||
|
push eax
|
||||||
|
mov bl, 0x60 ; write command byte
|
||||||
|
call kbd_cmd
|
||||||
|
pop eax
|
||||||
|
call kbd_write
|
||||||
|
|
||||||
stdcall AttachIntHandler, 12, irq_handler, dword 0
|
stdcall AttachIntHandler, 12, irq_handler, 0
|
||||||
stdcall RegService, my_service, service_proc
|
stdcall RegService, my_service, service_proc
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.fin:
|
.fin:
|
||||||
|
popf
|
||||||
;stdcall DetachIntHandler, 12, irq_handler
|
;stdcall DetachIntHandler, 12, irq_handler
|
||||||
mov bl, 0xA7 ; disable mouse interface
|
mov bl, 0xA7 ; disable mouse interface
|
||||||
call kbd_cmd
|
call kbd_cmd
|
||||||
|
.nothing:
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.exit:
|
.exit:
|
||||||
mov bl, 0xA7 ; disable mouse interface
|
mov bl, 0xA7 ; disable mouse interface
|
||||||
call kbd_cmd
|
call kbd_cmd
|
||||||
mov bl, 0xAE ; enable keyboard interface
|
|
||||||
|
; enable keyboard interrupt, leave mouse interrupt disabled
|
||||||
|
mov bl, 0x20 ; read command byte
|
||||||
call kbd_cmd
|
call kbd_cmd
|
||||||
|
call kbd_read
|
||||||
|
or al, 1 ; enable keyboard interrupt
|
||||||
|
and al, not 0x10 ; enable keyboard
|
||||||
|
push eax
|
||||||
|
mov bl, 0x60 ; write command byte
|
||||||
|
call kbd_cmd
|
||||||
|
pop eax
|
||||||
|
call kbd_write
|
||||||
|
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
@ -137,11 +157,6 @@ endp
|
|||||||
|
|
||||||
detect_mouse:
|
detect_mouse:
|
||||||
|
|
||||||
mov bl, 0xAD ; disable keyboard interface
|
|
||||||
call kbd_cmd
|
|
||||||
cmp ah,1
|
|
||||||
je .fail
|
|
||||||
|
|
||||||
mov bl, 0xA8 ; enable mouse interface
|
mov bl, 0xA8 ; enable mouse interface
|
||||||
call kbd_cmd
|
call kbd_cmd
|
||||||
cmp ah,1
|
cmp ah,1
|
||||||
@ -161,6 +176,7 @@ detect_mouse:
|
|||||||
jc .fail
|
jc .fail
|
||||||
cmp al, 0x00
|
cmp al, 0x00
|
||||||
jne .fail ; unknown device
|
jne .fail ; unknown device
|
||||||
|
|
||||||
xor eax,eax
|
xor eax,eax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
@ -882,6 +882,7 @@ include "detect/vortex86.inc" ; Vortex86 SoC detection code
|
|||||||
mov esi, 250 ; wait 1/4 a second
|
mov esi, 250 ; wait 1/4 a second
|
||||||
call delay_ms
|
call delay_ms
|
||||||
rdtsc
|
rdtsc
|
||||||
|
sti
|
||||||
|
|
||||||
sub eax, ecx
|
sub eax, ecx
|
||||||
xor edx, edx
|
xor edx, edx
|
||||||
@ -949,26 +950,6 @@ include "detect/vortex86.inc" ; Vortex86 SoC detection code
|
|||||||
stdcall map_page, tss._io_map_1, \
|
stdcall map_page, tss._io_map_1, \
|
||||||
[SLOT_BASE+256+APPDATA.io_map+4], PG_MAP
|
[SLOT_BASE+256+APPDATA.io_map+4], PG_MAP
|
||||||
|
|
||||||
; LOAD FIRST APPLICATION
|
|
||||||
cmp byte [launcher_start], 1 ; Check if starting LAUNCHER is selected on blue screen (1 = yes)
|
|
||||||
jnz first_app_found
|
|
||||||
|
|
||||||
cli
|
|
||||||
mov ebp, firstapp
|
|
||||||
call fs_execute_from_sysdir
|
|
||||||
test eax, eax
|
|
||||||
jns first_app_found
|
|
||||||
|
|
||||||
mov esi, boot_failed
|
|
||||||
call boot_log
|
|
||||||
|
|
||||||
mov eax, 0xDEADBEEF ; otherwise halt
|
|
||||||
hlt
|
|
||||||
|
|
||||||
first_app_found:
|
|
||||||
|
|
||||||
cli
|
|
||||||
|
|
||||||
; SET KEYBOARD PARAMETERS
|
; SET KEYBOARD PARAMETERS
|
||||||
mov al, 0xf6 ; reset keyboard, scan enabled
|
mov al, 0xf6 ; reset keyboard, scan enabled
|
||||||
call kb_write_wait_ack
|
call kb_write_wait_ack
|
||||||
@ -1008,6 +989,24 @@ endg
|
|||||||
call boot_log
|
call boot_log
|
||||||
call setmouse
|
call setmouse
|
||||||
|
|
||||||
|
; LOAD FIRST APPLICATION
|
||||||
|
cmp byte [launcher_start], 1 ; Check if starting LAUNCHER is selected on blue screen (1 = yes)
|
||||||
|
jnz first_app_found
|
||||||
|
|
||||||
|
cli
|
||||||
|
mov ebp, firstapp
|
||||||
|
call fs_execute_from_sysdir
|
||||||
|
test eax, eax
|
||||||
|
jns first_app_found
|
||||||
|
|
||||||
|
mov esi, boot_failed
|
||||||
|
call boot_log
|
||||||
|
|
||||||
|
mov eax, 0xDEADBEEF ; otherwise halt
|
||||||
|
hlt
|
||||||
|
|
||||||
|
first_app_found:
|
||||||
|
|
||||||
; START MULTITASKING
|
; START MULTITASKING
|
||||||
|
|
||||||
; A 'All set - press ESC to start' messages if need
|
; A 'All set - press ESC to start' messages if need
|
||||||
|
Loading…
Reference in New Issue
Block a user