optimization 46 and 64 sysfunc.

git-svn-id: svn://kolibrios.org@1306 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Alexey Teplov ( 2009-12-03 18:48:41 +00:00
parent dceaa5fee0
commit b1d15587ca
5 changed files with 160 additions and 154 deletions

View File

@ -279,21 +279,27 @@ p_irq15:
iret iret
ready_for_next_irq: ready_for_next_irq:
mov [check_idle_semaphore],5 mov eax,5
mov [check_idle_semaphore],eax
; mov al, 0x20
add eax,(0x20-0x5)
mov al, 0x20 mov al, 0x20
out 0x20, al out 0x20, al
ret ret
;destroy eax
ready_for_next_irq_1: ready_for_next_irq_1:
mov [check_idle_semaphore],5 mov eax,5
mov al, 0x20 mov [check_idle_semaphore],eax
; mov al, 0x20
add eax,(0x20-0x5)
out 0xa0,al out 0xa0,al
out 0x20, al out 0x20, al
ret ret
irqD: irqD:
push eax push eax
mov al,0 xor eax,eax
out 0xf0,al out 0xf0,al
mov al,0x20 mov al,0x20
out 0xa0,al out 0xa0,al
@ -396,24 +402,32 @@ clear_application_table_status:
cmp eax,[application_table_status] cmp eax,[application_table_status]
jne apptsl1 jne apptsl1
mov [application_table_status],0 xor eax,eax
mov [application_table_status],eax
apptsl1: apptsl1:
pop eax pop eax
ret ret
; * eax = 64 - íîìåð ôóíêöèè
; * ebx = 1 - åäèíñòâåííàÿ ïîäôóíêöèÿ
; * ecx = íîâûé ðàçìåð ïàìÿòè
;Âîçâðàùàåìîå çíà÷åíèå:
; * eax = 0 - óñïåøíî
; * eax = 1 - íåäîñòàòî÷íî ïàìÿòè
sys_resize_app_memory: sys_resize_app_memory:
; eax = 1 - resize ; ebx = 1 - resize
; ebx = new amount of memory ; ecx = new amount of memory
cmp eax,1
jne .no_application_mem_resize
; cmp eax,1
dec ebx
jnz .no_application_mem_resize
;fix it!
mov ebx,ecx
stdcall new_mem_resize, ebx stdcall new_mem_resize, ebx
mov [esp+36], eax mov [esp+32], eax
ret
.no_application_mem_resize: .no_application_mem_resize:
ret ret
@ -689,22 +703,22 @@ term9:
cmp [hd1_status], esi cmp [hd1_status], esi
jnz @f jnz @f
call free_hd_channel call free_hd_channel
mov [hd1_status], 0 and [hd1_status], 0
@@: @@:
cmp [cd_status], esi cmp [cd_status], esi
jnz @f jnz @f
call free_cd_channel call free_cd_channel
mov [cd_status], 0 and [cd_status], 0
@@: @@:
cmp [flp_status], esi cmp [flp_status], esi
jnz @f jnz @f
mov [flp_status], 0 and [flp_status], 0
@@: @@:
pop esi pop esi
cmp [bgrlockpid], esi cmp [bgrlockpid], esi
jnz @f jnz @f
and [bgrlockpid], 0 and [bgrlockpid], 0
mov [bgrlock], 0 and [bgrlock], 0
@@: @@:
pusha ; remove all irq reservations pusha ; remove all irq reservations
@ -736,8 +750,8 @@ term9:
mov esi,[RESERVED_PORTS] mov esi,[RESERVED_PORTS]
cmp esi,0 test esi,esi
je rmpr9 jz rmpr9
rmpr3: rmpr3:
@ -808,7 +822,7 @@ term9:
mov [MOUSE_BACKGROUND],byte 0 ; no mouse background mov [MOUSE_BACKGROUND],byte 0 ; no mouse background
mov [DONT_DRAW_MOUSE],byte 0 ; draw mouse mov [DONT_DRAW_MOUSE],byte 0 ; draw mouse
mov [application_table_status],0 and [application_table_status],0
;mov esi,process_terminated ;mov esi,process_terminated
;call sys_msg_board_str ;call sys_msg_board_str
add esp, 4 add esp, 4

View File

@ -149,7 +149,7 @@ iglobal
dd 0 ; 43-SendDeviceData dd 0 ; 43-SendDeviceData
dd 0 dd 0
dd 0 dd 0
dd syscall_reserveportarea ; 46-ReservePortArea and FreePortArea dd 0 ; 46-ReservePortArea and FreePortArea
dd display_number ; 47-WriteNum dd display_number ; 47-WriteNum
dd display_settings ; 48-SetRedrawType and SetButtonType dd display_settings ; 48-SetRedrawType and SetButtonType
dd sys_apm ; 49-Advanced Power Management (APM) dd sys_apm ; 49-Advanced Power Management (APM)
@ -167,7 +167,7 @@ iglobal
dd sys_gs ; 61-Direct graphics access dd sys_gs ; 61-Direct graphics access
dd sys_pci ; 62-PCI functions dd sys_pci ; 62-PCI functions
dd sys_msg_board ; 63-System message board dd sys_msg_board ; 63-System message board
dd sys_resize_app_memory ; 64-Resize application memory usage dd 0 ; 64-Resize application memory usage
dd syscall_putimage_palette; 65-PutImagePalette dd syscall_putimage_palette; 65-PutImagePalette
dd sys_process_def ; 66-Process definitions - keyboard dd sys_process_def ; 66-Process definitions - keyboard
dd sys_window_move ; 67-Window move or resize dd sys_window_move ; 67-Window move or resize
@ -228,7 +228,7 @@ iglobal
dd sys_outport ; 43-SendDeviceData dd sys_outport ; 43-SendDeviceData
dd sys_programirq ; 44-ProgramIrqs dd sys_programirq ; 44-ProgramIrqs
dd reserve_free_irq ; 45-ReserveIrq and FreeIrq dd reserve_free_irq ; 45-ReserveIrq and FreeIrq
dd cross_order ; 46-ReservePortArea and FreePortArea dd syscall_reserveportarea ; 46-ReservePortArea and FreePortArea
dd cross_order ; 47-WriteNum dd cross_order ; 47-WriteNum
dd cross_order ; 48-SetRedrawType and SetButtonType dd cross_order ; 48-SetRedrawType and SetButtonType
dd cross_order ; 49-Advanced Power Management (APM) dd cross_order ; 49-Advanced Power Management (APM)
@ -246,7 +246,7 @@ iglobal
dd cross_order ; 61-Direct graphics access dd cross_order ; 61-Direct graphics access
dd cross_order ; 62-PCI functions dd cross_order ; 62-PCI functions
dd cross_order ; 63-System message board dd cross_order ; 63-System message board
dd cross_order ; 64-Resize application memory usage dd sys_resize_app_memory ; 64-Resize application memory usage
dd cross_order ; 65-PutImagePalette dd cross_order ; 65-PutImagePalette
dd cross_order ; 66-Process definitions - keyboard dd cross_order ; 66-Process definitions - keyboard
dd cross_order ; 67-Window move or resize dd cross_order ; 67-Window move or resize

View File

@ -5,6 +5,7 @@
;; ;; ;; ;;
;; Includes source code by Kulakov Vladimir Gennadievich. ;; ;; Includes source code by Kulakov Vladimir Gennadievich. ;;
;; Modified by Mario79 and Rus. ;; ;; Modified by Mario79 and Rus. ;;
;; 02.12.2009 <Lrz> ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;driver sceletone ;driver sceletone
@ -67,16 +68,19 @@ end if
stdcall AttachIntHandler, 4, irq4_handler, dword 0 stdcall AttachIntHandler, 4, irq4_handler, dword 0
if DEBUG if DEBUG
cmp eax, 0 test eax, eax
jne .label1 jne .label1
mov esi, msg_error_attach_int_handler mov esi, msg_error_attach_int_handler
call Boot_Log call Boot_Log
end if end if
.label1: .label1:
mov eax, 0 ; mov eax, 0
mov ebx, 0x3F8 ; mov ebx, 0x3F8
mov ecx, 0x3FF ; mov ecx, 0x3FF
xor ebx,ebx
mov ecx, 0x3F8
mov edx, 0x3FF
call ReservePortArea call ReservePortArea
if DEBUG if DEBUG
@ -100,9 +104,13 @@ end if
stdcall AttachIntHandler, 3, irq3_handler, dword 0 stdcall AttachIntHandler, 3, irq3_handler, dword 0
mov eax, 0 ; mov eax, 0
mov ebx, 0x2F8 ; mov ebx, 0x2F8
mov ecx, 0x3F8 ; mov ecx, 0x3F8
xor ebx,ebx
mov ecx, 0x2F8
mov edx, 0x3F8
call ReservePortArea call ReservePortArea
if DEBUG if DEBUG
cmp eax, 1 cmp eax, 1
@ -119,7 +127,7 @@ end if
stdcall RegService, my_service, service_proc stdcall RegService, my_service, service_proc
if DEBUG if DEBUG
cmp eax, 0 test eax, eax
jne @f jne @f
mov esi, msg_exit mov esi, msg_exit
@ -219,8 +227,8 @@ MouseSearch:
WaitData: WaitData:
; Îæèäàòü åùå 10 "òèêîâ" ; Îæèäàòü åùå 10 "òèêîâ"
dec ecx dec ecx
cmp ecx,0 ; cmp ecx,0
je NoMouse jz NoMouse
; Ïðîâåðèòü íàëè÷èå èäåíòèôèêàöèîííîãî áàéòà ; Ïðîâåðèòü íàëè÷èå èäåíòèôèêàöèîííîãî áàéòà
mov DX, bx mov DX, bx
add DX,5 add DX,5

View File

@ -66,9 +66,13 @@ if DEBUG
mov esi,msgDSPFound mov esi,msgDSPFound
call SysMsgBoardStr call SysMsgBoardStr
end if end if
xor eax,eax ; xor eax,eax
mov ebx,[sb_base_port] ; mov ebx,[sb_base_port]
lea ecx,[ebx+0xF] ; lea ecx,[ebx+0xF]
xor ebx,ebx
mov ecx,[sb_base_port]
lea edx,[ebx+0xF]
call ReservePortArea ;these ports must be my! call ReservePortArea ;these ports must be my!
if DEBUG if DEBUG
dec eax dec eax

View File

@ -4015,156 +4015,145 @@ get_irq_data:
set_io_access_rights: set_io_access_rights:
push edi eax
pushad
mov edi, tss._io_map_0 mov edi, tss._io_map_0
; mov ecx,eax ; mov ecx,eax
; and ecx,7 ; offset in byte ; and ecx,7 ; offset in byte
; shr eax,3 ; number of byte ; shr eax,3 ; number of byte
; add edi,eax ; add edi,eax
; mov ebx,1 ; mov ebx,1
; shl ebx,cl ; shl ebx,cl
test ebp,ebp test ebp,ebp
; cmp ebp,0 ; enable access - ebp = 0 ; cmp ebp,0 ; enable access - ebp = 0
jnz siar1 jnz siar1
; not ebx ; not ebx
; and [edi],byte bl ; and [edi],byte bl
btr [edi], eax btr [edi], eax
pop eax edi
popad
ret ret
siar1: siar1:
bts [edi], eax bts [edi], eax
; or [edi],byte bl ; disable access - ebp = 1 ; or [edi],byte bl ; disable access - ebp = 1
pop eax edi
popad
ret ret
;reserve/free group of ports
; * eax = 46 - number function
; * ebx = 0 - reserve, 1 - free
; * ecx = number start arrea of ports
; * edx = number end arrea of ports (include last number of port)
;Return value:
; * eax = 0 - succesful
; * eax = 1 - error
; * The system has reserve this ports:
; 0..0x2d, 0x30..0x4d, 0x50..0xdf, 0xe5..0xff (include last number of port).
;destroys eax,ebx, ebp
r_f_port_area: r_f_port_area:
test eax, eax test ebx, ebx
jnz free_port_area jnz free_port_area
; je r_port_area ; je r_port_area
; jmp free_port_area ; jmp free_port_area
; r_port_area: ; r_port_area:
pushad ; pushad
cmp ebx,ecx ; beginning > end ? cmp ecx,edx ; beginning > end ?
ja rpal1 ja rpal1
cmp ecx,65536 cmp edx,65536
jae rpal1 jae rpal1
mov esi,[RESERVED_PORTS] mov eax,[RESERVED_PORTS]
test esi,esi ; no reserved areas ? test eax,eax ; no reserved areas ?
je rpal2 je rpal2
cmp esi,255 ; max reserved cmp eax,255 ; max reserved
jae rpal1 jae rpal1
rpal3: rpal3:
mov edi,esi mov ebx,eax
shl edi,4 shl ebx,4
add edi,RESERVED_PORTS add ebx,RESERVED_PORTS
cmp ebx,[edi+8] cmp ecx,[ebx+8]
ja rpal4 ja rpal4
cmp ecx,[edi+4] cmp edx,[ebx+4]
jae rpal1 jae rpal1
; jb rpal4 ; jb rpal4
; jmp rpal1 ; jmp rpal1
rpal4: rpal4:
dec eax
dec esi
jnz rpal3 jnz rpal3
jmp rpal2 jmp rpal2
rpal1: rpal1:
popad ; popad
mov eax,1 ; mov eax,1
xor eax,eax
inc eax
ret ret
rpal2: rpal2:
popad ; popad
; enable port access at port IO map ; enable port access at port IO map
cli cli
pushad ; start enable io map pushad ; start enable io map
cmp ecx,65536 ;16384 cmp edx,65536 ;16384
jae no_unmask_io ; jge jae no_unmask_io ; jge
mov eax,ecx
mov eax,ebx ; push ebp
new_port_access:
pushad
xor ebp,ebp ; enable - eax = port xor ebp,ebp ; enable - eax = port
new_port_access:
; pushad
call set_io_access_rights call set_io_access_rights
; popad
popad
inc eax inc eax
cmp eax,ecx cmp eax,edx
jbe new_port_access jbe new_port_access
; pop ebp
no_unmask_io: no_unmask_io:
popad ; end enable io map popad ; end enable io map
sti sti
mov edi,[RESERVED_PORTS] mov eax,[RESERVED_PORTS]
add edi,1 add eax,1
mov [RESERVED_PORTS],edi mov [RESERVED_PORTS],eax
shl edi,4 shl eax,4
add edi,RESERVED_PORTS add eax,RESERVED_PORTS
mov esi,[TASK_BASE] mov ebx,[TASK_BASE]
mov esi,[esi+TASKDATA.pid] mov ebx,[ebx+TASKDATA.pid]
mov [edi],esi mov [eax],ebx
mov [edi+4],ebx mov [eax+4],ecx
mov [edi+8],ecx mov [eax+8],edx
xor eax, eax xor eax, eax
ret ret
free_port_area: free_port_area:
pushad ; pushad
mov eax,[RESERVED_PORTS] ; no reserved areas ?
mov esi,[RESERVED_PORTS] ; no reserved areas ? test eax,eax
test esi,esi jz frpal2
je frpal2 mov ebx,[TASK_BASE]
mov edx,[TASK_BASE] mov ebx,[ebx+TASKDATA.pid]
mov edx,[edx+TASKDATA.pid]
frpal3: frpal3:
mov edi,esi mov edi,eax
shl edi,4 shl edi,4
add edi,RESERVED_PORTS add edi,RESERVED_PORTS
cmp edx,[edi] cmp ebx,[edi]
jne frpal4 jne frpal4
cmp ebx,[edi+4] cmp ecx,[edi+4]
jne frpal4 jne frpal4
cmp ecx,[edi+8] cmp edx,[edi+8]
jne frpal4 jne frpal4
jmp frpal1 jmp frpal1
frpal4: frpal4:
dec esi dec eax
jnz frpal3 jnz frpal3
frpal2: frpal2:
popad ; popad
mov eax,1 inc eax
ret ret
frpal1: frpal1:
push ecx
mov ecx,256 mov ecx,256
sub ecx,esi sub ecx,eax
shl ecx,4 shl ecx,4
mov esi,edi mov esi,edi
add esi,16 add esi,16
@ -4172,36 +4161,27 @@ free_port_area:
rep movsb rep movsb
dec dword [RESERVED_PORTS] dec dword [RESERVED_PORTS]
;popad
popad
;disable port access at port IO map ;disable port access at port IO map
pushad ; start disable io map ; pushad ; start disable io map
pop eax ;start port
cmp ecx,65536 ;16384 cmp edx,65536 ;16384
jge no_mask_io jge no_mask_io
mov eax,ebx ; mov eax,ecx
xor ebp,ebp
inc ebp
new_port_access_disable: new_port_access_disable:
; pushad
pushad ; mov ebp,1 ; disable - eax = port
mov ebp,1 ; disable - eax = port
call set_io_access_rights call set_io_access_rights
; popad
popad
inc eax inc eax
cmp eax,ecx cmp eax,edx
jbe new_port_access_disable jbe new_port_access_disable
no_mask_io: no_mask_io:
; popad ; end disable io map
popad ; end disable io map
xor eax, eax xor eax, eax
ret ret
@ -5381,7 +5361,7 @@ align 4
syscall_reserveportarea: ; ReservePortArea and FreePortArea syscall_reserveportarea: ; ReservePortArea and FreePortArea
call r_f_port_area call r_f_port_area
mov [esp+36],eax mov [esp+32],eax
ret ret
align 4 align 4