Sync net branch with trunk

git-svn-id: svn://kolibrios.org@2385 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
hidnplayr
2012-02-23 19:01:26 +00:00
parent e7bade16fe
commit 33ab203c14
16 changed files with 1109 additions and 1282 deletions

View File

@@ -22,24 +22,24 @@ align 4
endg
EV_SPACE = 512
FreeEvents = event_start-EVENT.fd ; "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" event, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>:
; FreeEvents.fd=event_start <EFBFBD> FreeEvents.bk=event_end
align 4
init_events: ;; used from kernel.asm
stdcall kernel_alloc, EV_SPACE*EVENT.size
or eax, eax
jz .fail
; eax - current event, ebx - previos event below
; FreeEvents.fd=event_start <EFBFBD> FreeEvents.bk=event_end
align 4
init_events: ;; used from kernel.asm
stdcall kernel_alloc, EV_SPACE*sizeof.EVENT
or eax, eax
jz .fail
; eax - current event, ebx - previos event below
mov ecx, EV_SPACE ; current - in allocated space
mov ebx, FreeEvents ; previos - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
push ebx ; <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
@@:
mov [ebx+EVENT.fd], eax
mov [eax+EVENT.bk], ebx
mov ebx, eax ; previos <- current
add eax, EVENT.size ; new current
loop @b
pop eax ; <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
mov [ebx+EVENT.fd], eax
mov [ebx+EVENT.fd], eax
mov [eax+EVENT.bk], ebx
mov ebx, eax ; previos <- current
add eax, sizeof.EVENT ; new current
loop @b
pop eax ; <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
mov [ebx+EVENT.fd], eax
mov [eax+EVENT.bk], ebx
.fail:
ret
@@ -97,13 +97,13 @@ set_event: ;; INTERNAL use !!! don't use
mov [eax+EVENT.pid], edx
inc [event_uid]
Mov [eax+EVENT.id],edx,[event_uid]
or esi, esi
jz RemoveEventTo
lea edi, [eax+EVENT.code]
mov ecx, EVENT.codesize/4
cld
rep movsd
or esi, esi
jz RemoveEventTo
lea edi, [eax+EVENT.code]
mov ecx, (sizeof.EVENT -EVENT.code)/4
cld
rep movsd
RemoveEventTo: ;; INTERNAL use !!! don't use for Call
;param:
; eax - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> event, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
@@ -152,13 +152,13 @@ raise_event: ;; EXPORT use
; esi - event data (=0 => skip)
;scratched: ebx,ecx,esi,edi
call NotDummyTest ; not returned for fail !!!
or esi, esi
jz @f
lea edi, [ebx+EVENT.code]
mov ecx, EVENT.codesize/4
cld
rep movsd
@@:
or esi, esi
jz @f
lea edi, [ebx+EVENT.code]
mov ecx, (sizeof.EVENT -EVENT.code)/4
cld
rep movsd
@@:
test byte[ebx+EVENT.state+3], EVENT_SIGNALED shr 24
jnz RemoveEventTo.break ; POPF+RET
bt edx, 28 ;EVENT_WATCHED
@@ -296,16 +296,16 @@ get_event_ex: ;; f68:14
;retval:
; eax - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> EVENT (<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
;scratched: ebx,ecx,edx,esi,edi
mov edx, get_event_queue ; wait_test
call Wait_events ; timeout ignored
lea esi, [eax+EVENT.code]
mov ecx, EVENT.codesize/4
cld
rep movsd
mov [edi-EVENT.codesize+2], cl;clear priority field
wait_finish:
test byte[eax+EVENT.state+3], MANUAL_RESET shr 24
jnz get_event_queue.ret ; RET
mov edx, get_event_queue ; wait_test
call Wait_events ; timeout ignored
lea esi, [eax+EVENT.code]
mov ecx, (sizeof.EVENT-EVENT.code)/4
cld
rep movsd
mov byte[edi-(sizeof.EVENT-EVENT.code)+2], cl;clear priority field
wait_finish:
test byte[eax+EVENT.state+3], MANUAL_RESET shr 24
jnz get_event_queue.ret ; RET
and byte[eax+EVENT.state+3], not((EVENT_SIGNALED+EVENT_WATCHED)shr 24)
test byte[eax+EVENT.state+3], MANUAL_DESTROY shr 24
jz destroy_event.internal