drivers related modification

git-svn-id: svn://kolibrios.org@377 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2007-02-26 12:40:37 +00:00
parent 6cf25c8bd8
commit 02bcaaab53
5 changed files with 96 additions and 31 deletions

View File

@ -241,36 +241,33 @@ proc srv_handler stdcall, ioctl:dword
ret ret
endp endp
; param
; ebx= io_control
;
; retval
; eax= error code
align 4 align 4
proc srv_handlerEx stdcall, ioctl:dword srv_handlerEx:
mov esi, [ioctl] test ebx, ebx
test esi, esi jz .fail
jz .err add ebx, new_app_base
add esi, new_app_base
mov edi, [esi+handle] mov eax, [ebx+handle]
cmp [edi+SRV.magic], ' SRV' cmp [eax+SRV.magic], ' SRV'
jne .fail jne .fail
cmp [edi+SRV.size], SRV_SIZE cmp [eax+SRV.size], SRV_SIZE
jne .fail jne .fail
add [esi+input], new_app_base add [ebx+input], new_app_base
add [esi+output], new_app_base add [ebx+output], new_app_base
stdcall [edi+SRV.srv_proc], esi stdcall [eax+SRV.srv_proc], ebx
ret ret
.fail: .fail:
xor eax, eax or eax, -1
not eax
mov [esi+output], eax
mov [esi+out_size], 4
ret ret
.err:
xor eax, eax
not eax
ret
endp
restore handle restore handle
restore io_code restore io_code

View File

@ -39,6 +39,7 @@ iglobal
szRaiseEvent db 'RaiseEvent',0 szRaiseEvent db 'RaiseEvent',0
szWaitEvent db 'WaitEvent',0 szWaitEvent db 'WaitEvent',0
szDestroyEvent db 'DestroyEvent',0 szDestroyEvent db 'DestroyEvent',0
szClearEvent db 'ClearEvent',0
szLoadCursor db 'LoadCursor',0 szLoadCursor db 'LoadCursor',0
szSetHwCursor db 'SetHwCursor',0 szSetHwCursor db 'SetHwCursor',0
@ -90,6 +91,7 @@ kernel_export:
dd szRaiseEvent , raise_event dd szRaiseEvent , raise_event
dd szWaitEvent , wait_event dd szWaitEvent , wait_event
dd szDestroyEvent , destroy_event dd szDestroyEvent , destroy_event
dd szClearEvent , clear_event
dd szLoadCursor , load_cursor dd szLoadCursor , load_cursor
dd szSetHwCursor , set_hw_cursor dd szSetHwCursor , set_hw_cursor

View File

@ -628,8 +628,8 @@ term9:
mov [fpu_owner],1 mov [fpu_owner],1
mov eax, [256+PROC_BASE+APPDATA.fpu_state] mov eax, [256+PROC_BASE+APPDATA.fpu_state]
clts
bt [cpu_caps], CAPS_SSE bt [cpu_caps], CAPS_SSE
clts
jnc .no_SSE jnc .no_SSE
fxrstor [eax] fxrstor [eax]
jmp @F jmp @F

View File

@ -101,6 +101,9 @@ end if
if used DestroyEvent if used DestroyEvent
extrn DestroyEvent extrn DestroyEvent
end if end if
if used ClearEvent
extrn ClearEvent
end if
if used LoadCursor if used LoadCursor
extrn LoadCursor extrn LoadCursor

View File

@ -219,12 +219,12 @@ proc get_event_ex stdcall, p_ev:dword, timeout:dword
.wait: .wait:
mov edx,[CURRENT_TASK] mov edx,[CURRENT_TASK]
shl edx,8 shl edx,8
cmp [PROC_BASE+edx+APPDATA.ev_count], 0 ; cmp [PROC_BASE+edx+APPDATA.ev_count], 0
je .switch ; je .switch
add edx, PROC_BASE+APP_EV_OFFSET add edx, PROC_BASE+APP_EV_OFFSET
mov eax, [edx+EVENT.fd] mov eax, [edx+APPOBJ.fd]
cmp eax, edx cmp eax, edx
je .switch je .switch
@ -235,8 +235,7 @@ proc get_event_ex stdcall, p_ev:dword, timeout:dword
rep movsd rep movsd
and dword [edi-24], 0xFF00FFFF ;clear priority field and dword [edi-24], 0xFF00FFFF ;clear priority field
; ;
test [eax+EVENT.state], MANUAL_RESET test [eax+EVENT.state], MANUAL_RESET
jnz .done jnz .done
@ -246,9 +245,13 @@ proc get_event_ex stdcall, p_ev:dword, timeout:dword
mov ecx, [eax+APPOBJ.bk] ;and clear events flag mov ecx, [eax+APPOBJ.bk] ;and clear events flag
mov [ebx+APPOBJ.bk], ecx ;if no active events mov [ebx+APPOBJ.bk], ecx ;if no active events
mov [ecx+APPOBJ.fd], ebx mov [ecx+APPOBJ.fd], ebx
and [eax+EVENT.state], not (EVENT_SIGNALED+EVENT_WATCHED)
dec [edx+APPDATA.ev_count-APP_EV_OFFSET] dec [edx+APPDATA.ev_count-APP_EV_OFFSET]
jnz @F jnz @F
and [edx+APPDATA.event_mask-APP_EV_OFFSET], not EVENT_EXTENDED and [edx+APPDATA.event_mask-APP_EV_OFFSET], not EVENT_EXTENDED
@@:
popfd popfd
test [eax+EVENT.state], MANUAL_DESTROY test [eax+EVENT.state], MANUAL_DESTROY
@ -258,11 +261,11 @@ proc get_event_ex stdcall, p_ev:dword, timeout:dword
pushfd pushfd
cli cli
mov edx, [ecx+APPOBJ.fd] ;insert event into mov ebx, [edx+APPOBJ.fd] ;insert event into
mov [eax+APPOBJ.fd], edx ;objects list mov [eax+APPOBJ.fd], ebx ;objects list
mov [eax+APPOBJ.bk], ecx mov [eax+APPOBJ.bk], edx
mov [ecx+APPOBJ.fd], eax mov [edx+APPOBJ.fd], eax
mov [edx+APPOBJ.bk], eax mov [ebx+APPOBJ.bk], eax
popfd popfd
.done: .done:
ret ret
@ -347,6 +350,7 @@ restore .event
; eax= event ; eax= event
; ebx= id ; ebx= id
; ecx= flags ; ecx= flags
; edx= event data
raise_event: raise_event:
.event equ esp .event equ esp
@ -362,7 +366,18 @@ raise_event:
test eax, eax test eax, eax
jz .fail jz .fail
mov esi, edx
test esi, esi
mov edx, [.event] mov edx, [.event]
jz @F
push ecx
lea edi, [edx+EVENT.code]
mov ecx, 6
cld
rep movsd
pop ecx
@@:
test [edx+EVENT.state], EVENT_SIGNALED test [edx+EVENT.state], EVENT_SIGNALED
jnz .done jnz .done
@ -397,6 +412,54 @@ raise_event:
ret ret
restore .event restore .event
; param
; eax= event
; ebx= id
align 4
clear_event:
.event equ esp
push eax
cmp [eax+APPOBJ.magic], 'EVNT'
jne .fail
cmp [eax+EVENT.id], ebx
jne .fail
mov eax, [eax+APPOBJ.pid]
call pid_to_slot
test eax, eax
jz .fail
shl eax, 8
add eax, PROC_BASE+APP_EV_OFFSET
mov edx, [.event]
pushfd
cli ;remove event from events
mov ebx, [edx+APPOBJ.fd] ;list (reset event)
mov ecx, [edx+APPOBJ.bk] ;and clear events flag
mov [ebx+APPOBJ.bk], ecx ;if no active events
mov [ecx+APPOBJ.fd], ebx
and [edx+EVENT.state], not (EVENT_SIGNALED+EVENT_WATCHED)
dec [eax+APPDATA.ev_count-APP_EV_OFFSET]
jnz @F
and [eax+APPDATA.event_mask-APP_EV_OFFSET], not EVENT_EXTENDED
@@:
add eax, (APP_OBJ_OFFSET-APP_EV_OFFSET)
mov ecx, [eax+APPOBJ.fd] ;insert event into
mov [edx+APPOBJ.fd], ecx ;objects list
mov [edx+APPOBJ.bk], eax
mov [eax+APPOBJ.fd], edx
mov [ecx+APPOBJ.bk], edx
popfd
.fail:
.done:
add esp, 4
ret
restore .event
sys_getevent: sys_getevent:
call get_event_for_app call get_event_for_app