Rev 381 | Rev 431 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
425 | victor | 1 | $Revision: 425 $ |
227 | serge | 2 | |
3 | align 4 |
||
4 | init_events: |
||
354 | serge | 5 | stdcall kernel_alloc, 512*EVENT_SIZE |
227 | serge | 6 | mov [events], eax |
7 | xor eax, eax |
||
354 | serge | 8 | mov [event_uid], eax |
227 | serge | 9 | not eax |
10 | mov edi, event_map |
||
11 | mov [event_start], edi |
||
354 | serge | 12 | mov ecx, 64/4 |
227 | serge | 13 | cld |
14 | rep stosd |
||
15 | mov [event_end], edi |
||
16 | ret |
||
17 | |||
18 | align 4 |
||
19 | proc alloc_event |
||
20 | |||
21 | pushfd |
||
22 | cli |
||
23 | mov ebx, [event_start] |
||
24 | mov ecx, [event_end] |
||
25 | .l1: |
||
26 | bsf eax,[ebx] |
||
27 | jnz .found |
||
28 | add ebx,4 |
||
29 | cmp ebx, ecx |
||
30 | jb .l1 |
||
31 | popfd |
||
32 | xor eax,eax |
||
33 | ret |
||
34 | .found: |
||
35 | btr [ebx], eax |
||
36 | mov [event_start],ebx |
||
354 | serge | 37 | inc [event_uid] |
38 | |||
227 | serge | 39 | sub ebx, event_map |
254 | serge | 40 | lea eax,[eax+ebx*8] |
354 | serge | 41 | |
42 | lea ebx, [eax+eax*4] |
||
227 | serge | 43 | shl eax,5 |
354 | serge | 44 | lea eax,[eax+ebx*4] ;eax*=52 (EVENT_SIZE) |
227 | serge | 45 | add eax, [events] |
354 | serge | 46 | mov ebx, [event_uid] |
227 | serge | 47 | popfd |
48 | ret |
||
49 | endp |
||
50 | |||
51 | align 4 |
||
52 | free_event: |
||
354 | serge | 53 | sub eax, [events] |
54 | mov ecx, EVENT_SIZE |
||
55 | mov ebx, event_map |
||
56 | cdq |
||
57 | div ecx |
||
58 | |||
227 | serge | 59 | pushfd |
60 | cli |
||
61 | bts [ebx], eax |
||
62 | shr eax, 3 |
||
63 | and eax, not 3 |
||
64 | add eax, ebx |
||
65 | cmp [event_start], eax |
||
66 | ja @f |
||
67 | popfd |
||
68 | ret |
||
69 | @@: |
||
70 | mov [event_start], eax |
||
71 | popfd |
||
72 | ret |
||
73 | |||
354 | serge | 74 | EVENT_WATCHED equ 0x10000000 |
75 | EVENT_SIGNALED equ 0x20000000 |
||
76 | MANUAL_RESET equ 0x40000000 |
||
77 | MANUAL_DESTROY equ 0x80000000 |
||
78 | |||
79 | |||
80 | ; param |
||
81 | ; eax= event data |
||
82 | ; ebx= flags |
||
83 | ; |
||
84 | ; retval |
||
85 | ; eax= event |
||
86 | ; edx= id |
||
87 | |||
88 | create_event: |
||
89 | .flags equ esp+4 |
||
90 | .data equ esp |
||
91 | |||
92 | push ebx |
||
93 | push eax |
||
94 | |||
95 | call alloc_event |
||
96 | test eax, eax |
||
97 | jz .fail |
||
98 | |||
99 | mov [eax+APPOBJ.magic], 'EVNT' |
||
363 | serge | 100 | mov [eax+APPOBJ.destroy], destroy_event.internal |
354 | serge | 101 | mov [eax+EVENT.id], ebx |
102 | |||
103 | mov ebx, [CURRENT_TASK] |
||
104 | shl ebx, 5 |
||
379 | serge | 105 | mov ebx, [CURRENT_TASK+ebx+4] |
354 | serge | 106 | mov [eax+APPOBJ.pid], ebx |
107 | mov edx, [.flags] |
||
108 | mov [eax+EVENT.state], edx |
||
109 | |||
110 | mov esi, [.data] |
||
111 | test esi, esi |
||
112 | jz @F |
||
113 | lea edi, [eax+EVENT.code] |
||
114 | mov ecx, 6 |
||
115 | cld |
||
116 | rep movsd |
||
117 | @@: |
||
118 | mov ecx, [CURRENT_TASK] |
||
119 | shl ecx,8 |
||
380 | serge | 120 | add ecx, SLOT_BASE+APP_OBJ_OFFSET |
354 | serge | 121 | |
122 | pushfd |
||
123 | cli |
||
124 | mov edx, [ecx+APPOBJ.fd] |
||
125 | mov [eax+APPOBJ.fd], edx |
||
126 | mov [eax+APPOBJ.bk], ecx |
||
127 | mov [ecx+APPOBJ.fd], eax |
||
128 | mov [edx+APPOBJ.bk], eax |
||
129 | popfd |
||
130 | mov edx, [eax+EVENT.id] |
||
131 | .fail: |
||
132 | add esp, 8 |
||
133 | ret |
||
134 | |||
135 | restore .flags |
||
136 | restore .data |
||
137 | |||
138 | ; param |
||
139 | ; eax= event |
||
140 | ; ebx= id |
||
141 | |||
142 | destroy_event: |
||
143 | |||
144 | cmp [eax+APPOBJ.magic], 'EVNT' |
||
145 | jne .fail |
||
146 | cmp [eax+EVENT.id], ebx |
||
147 | jne .fail |
||
363 | serge | 148 | .internal: |
354 | serge | 149 | mov ebx, [eax+APPOBJ.fd] |
150 | mov ecx, [eax+APPOBJ.bk] |
||
151 | mov [ebx+APPOBJ.bk], ecx |
||
152 | mov [ecx+APPOBJ.fd], ebx |
||
363 | serge | 153 | .force: |
354 | serge | 154 | xor edx, edx ;clear common header |
155 | mov [eax], edx |
||
156 | mov [eax+4], edx |
||
157 | mov [eax+8], edx |
||
158 | mov [eax+12], edx |
||
159 | mov [eax+16], edx |
||
160 | |||
161 | call free_event ;release object memory |
||
162 | .fail: |
||
163 | ret |
||
164 | |||
227 | serge | 165 | align 4 |
166 | proc send_event stdcall pid:dword, event:dword |
||
167 | locals |
||
168 | slot dd ? |
||
169 | endl |
||
170 | |||
171 | mov eax, [pid] |
||
172 | call pid_to_slot |
||
173 | test eax, eax |
||
174 | jz .fail |
||
175 | |||
176 | shl eax, 8 |
||
380 | serge | 177 | cmp [SLOT_BASE+eax+APPDATA.ev_count], 32 |
227 | serge | 178 | ja .fail |
179 | |||
180 | mov [slot], eax |
||
354 | serge | 181 | |
227 | serge | 182 | call alloc_event |
183 | test eax, eax |
||
184 | jz .fail |
||
185 | |||
354 | serge | 186 | lea edi, [eax+EVENT.code] |
227 | serge | 187 | mov ecx, 6 |
188 | mov esi, [event] |
||
189 | cld |
||
190 | rep movsd |
||
191 | |||
354 | serge | 192 | mov ecx, [slot] |
380 | serge | 193 | add ecx, SLOT_BASE+APP_EV_OFFSET |
354 | serge | 194 | |
195 | mov [eax+APPOBJ.magic], 'EVNT' |
||
196 | mov [eax+APPOBJ.destroy], destroy_event |
||
197 | mov ebx, [pid] |
||
198 | mov [eax+APPOBJ.pid], ebx |
||
199 | mov [eax+EVENT.state], EVENT_SIGNALED |
||
200 | |||
201 | pushfd |
||
202 | cli ;insert event into |
||
203 | mov edx, [ecx+APPOBJ.fd] ;events list |
||
204 | mov [eax+APPOBJ.fd], edx ;and set events flag |
||
205 | mov [eax+APPOBJ.bk], ecx |
||
206 | mov [ecx+APPOBJ.fd], eax |
||
207 | mov [edx+APPOBJ.bk], eax |
||
208 | inc [ecx+APPDATA.ev_count-APP_EV_OFFSET] |
||
209 | or [ecx+APPDATA.event_mask-APP_EV_OFFSET], EVENT_EXTENDED |
||
210 | popfd |
||
227 | serge | 211 | .fail: |
212 | ret |
||
213 | endp |
||
214 | |||
354 | serge | 215 | ; timeout ignored |
216 | |||
227 | serge | 217 | align 4 |
218 | proc get_event_ex stdcall, p_ev:dword, timeout:dword |
||
219 | |||
220 | .wait: |
||
354 | serge | 221 | mov edx,[CURRENT_TASK] |
222 | shl edx,8 |
||
380 | serge | 223 | ; cmp [SLOT_BASE+edx+APPDATA.ev_count], 0 |
377 | serge | 224 | ; je .switch |
227 | serge | 225 | |
380 | serge | 226 | add edx, SLOT_BASE+APP_EV_OFFSET |
227 | serge | 227 | |
377 | serge | 228 | mov eax, [edx+APPOBJ.fd] |
354 | serge | 229 | cmp eax, edx |
230 | je .switch |
||
231 | |||
232 | lea esi, [eax+EVENT.code] |
||
233 | mov edi, [p_ev] ;copy event data |
||
227 | serge | 234 | mov ecx, 6 |
235 | cld |
||
236 | rep movsd |
||
354 | serge | 237 | |
238 | and dword [edi-24], 0xFF00FFFF ;clear priority field |
||
377 | serge | 239 | ; |
354 | serge | 240 | test [eax+EVENT.state], MANUAL_RESET |
241 | jnz .done |
||
242 | |||
243 | pushfd |
||
244 | cli ;remove event from events |
||
245 | mov ebx, [eax+APPOBJ.fd] ;list (reset event) |
||
246 | mov ecx, [eax+APPOBJ.bk] ;and clear events flag |
||
247 | mov [ebx+APPOBJ.bk], ecx ;if no active events |
||
248 | mov [ecx+APPOBJ.fd], ebx |
||
377 | serge | 249 | |
250 | and [eax+EVENT.state], not (EVENT_SIGNALED+EVENT_WATCHED) |
||
251 | |||
354 | serge | 252 | dec [edx+APPDATA.ev_count-APP_EV_OFFSET] |
253 | jnz @F |
||
254 | and [edx+APPDATA.event_mask-APP_EV_OFFSET], not EVENT_EXTENDED |
||
377 | serge | 255 | @@: |
354 | serge | 256 | popfd |
257 | |||
258 | test [eax+EVENT.state], MANUAL_DESTROY |
||
259 | jz .destroy |
||
260 | |||
261 | add edx, (APP_OBJ_OFFSET-APP_EV_OFFSET) |
||
262 | |||
263 | pushfd |
||
264 | cli |
||
377 | serge | 265 | mov ebx, [edx+APPOBJ.fd] ;insert event into |
266 | mov [eax+APPOBJ.fd], ebx ;objects list |
||
267 | mov [eax+APPOBJ.bk], edx |
||
268 | mov [edx+APPOBJ.fd], eax |
||
269 | mov [ebx+APPOBJ.bk], eax |
||
354 | serge | 270 | popfd |
271 | .done: |
||
227 | serge | 272 | ret |
354 | serge | 273 | |
274 | .destroy: |
||
363 | serge | 275 | call destroy_event.force |
354 | serge | 276 | ret |
227 | serge | 277 | .switch: |
379 | serge | 278 | mov eax, [TASK_BASE] |
227 | serge | 279 | mov [eax+TASKDATA.state], byte 5 |
280 | call change_task |
||
281 | jmp .wait |
||
282 | endp |
||
283 | |||
354 | serge | 284 | ; param |
285 | ; eax= event |
||
286 | ; ebx= id |
||
287 | |||
288 | align 4 |
||
289 | wait_event: |
||
290 | .event equ esp |
||
291 | push eax |
||
292 | .wait: |
||
293 | cmp [eax+APPOBJ.magic], 'EVNT' |
||
294 | jne .done |
||
295 | cmp [eax+EVENT.id], ebx |
||
296 | jne .done |
||
297 | |||
298 | test [eax+EVENT.state], EVENT_SIGNALED |
||
299 | jz .switch |
||
300 | |||
301 | test [eax+EVENT.state], MANUAL_RESET |
||
302 | jnz .done |
||
303 | |||
304 | mov edx,[CURRENT_TASK] |
||
305 | shl edx,8 |
||
380 | serge | 306 | add edx, SLOT_BASE |
354 | serge | 307 | |
308 | pushfd |
||
309 | cli ;remove event from events |
||
310 | mov ebx, [eax+APPOBJ.fd] ;list (reset event) |
||
311 | mov ecx, [eax+APPOBJ.bk] ;and clear events flag |
||
312 | mov [ebx+APPOBJ.bk], ecx ;if no active events |
||
313 | mov [ecx+APPOBJ.fd], ebx |
||
314 | dec [edx+APPDATA.ev_count] |
||
315 | jnz @F |
||
316 | and [edx+APPDATA.event_mask], not EVENT_EXTENDED |
||
317 | @@: |
||
318 | and [eax+EVENT.state], not (EVENT_SIGNALED+EVENT_WATCHED) |
||
319 | popfd |
||
320 | |||
321 | test [eax+EVENT.state], MANUAL_DESTROY |
||
322 | jz .destroy |
||
323 | |||
324 | add edx, APP_OBJ_OFFSET |
||
325 | |||
326 | pushfd |
||
327 | cli |
||
328 | mov ecx, [edx+APPOBJ.fd] ;insert event into |
||
329 | mov [eax+APPOBJ.fd], ecx ;objects list |
||
330 | mov [eax+APPOBJ.bk], edx |
||
331 | mov [edx+APPOBJ.fd], eax |
||
332 | mov [ecx+APPOBJ.bk], eax |
||
333 | popfd |
||
334 | .done: |
||
335 | add esp, 4 |
||
336 | ret |
||
337 | .destroy: |
||
363 | serge | 338 | call destroy_event.force |
354 | serge | 339 | add esp, 4 |
340 | ret |
||
341 | .switch: |
||
342 | or [eax+EVENT.state], EVENT_WATCHED |
||
379 | serge | 343 | mov eax, [TASK_BASE] |
354 | serge | 344 | mov [eax+TASKDATA.state], byte 5 |
345 | call change_task |
||
346 | mov eax, [.event] |
||
347 | jmp .wait |
||
348 | restore .event |
||
349 | |||
350 | ; param |
||
351 | ; eax= event |
||
352 | ; ebx= id |
||
353 | ; ecx= flags |
||
377 | serge | 354 | ; edx= event data |
354 | serge | 355 | |
356 | raise_event: |
||
357 | .event equ esp |
||
358 | push eax |
||
359 | |||
360 | cmp [eax+APPOBJ.magic], 'EVNT' |
||
361 | jne .fail |
||
362 | cmp [eax+EVENT.id], ebx |
||
363 | jne .fail |
||
364 | |||
365 | mov eax, [eax+APPOBJ.pid] |
||
366 | call pid_to_slot |
||
367 | test eax, eax |
||
368 | jz .fail |
||
369 | |||
377 | serge | 370 | mov esi, edx |
371 | test esi, esi |
||
354 | serge | 372 | mov edx, [.event] |
377 | serge | 373 | jz @F |
374 | |||
375 | push ecx |
||
376 | lea edi, [edx+EVENT.code] |
||
377 | mov ecx, 6 |
||
378 | cld |
||
379 | rep movsd |
||
380 | pop ecx |
||
381 | @@: |
||
354 | serge | 382 | test [edx+EVENT.state], EVENT_SIGNALED |
383 | jnz .done |
||
384 | |||
385 | test ecx, EVENT_WATCHED |
||
386 | jz @F |
||
387 | test [edx+EVENT.state], EVENT_WATCHED |
||
388 | jz .done |
||
389 | @@: |
||
390 | shl eax, 8 |
||
380 | serge | 391 | add eax, SLOT_BASE+APP_EV_OFFSET |
354 | serge | 392 | |
393 | pushfd |
||
394 | cli |
||
395 | mov ebx, [edx+APPOBJ.fd] |
||
396 | mov ecx, [edx+APPOBJ.bk] |
||
397 | mov [ebx+APPOBJ.bk], ecx |
||
398 | mov [ecx+APPOBJ.fd], ebx |
||
399 | |||
400 | mov ecx, [eax+APPOBJ.fd] |
||
401 | mov [edx+APPOBJ.fd], ecx |
||
402 | mov [edx+APPOBJ.bk], eax |
||
403 | mov [eax+APPOBJ.fd], edx |
||
404 | mov [ecx+APPOBJ.bk], edx |
||
405 | or [edx+EVENT.state], EVENT_SIGNALED |
||
406 | |||
407 | inc [eax+APPDATA.ev_count-APP_EV_OFFSET] |
||
408 | or [eax+APPDATA.event_mask-APP_EV_OFFSET], EVENT_EXTENDED |
||
409 | popfd |
||
410 | .fail: |
||
411 | .done: |
||
412 | add esp, 4 |
||
413 | ret |
||
414 | restore .event |
||
415 | |||
377 | serge | 416 | ; param |
417 | ; eax= event |
||
418 | ; ebx= id |
||
419 | align 4 |
||
420 | clear_event: |
||
421 | .event equ esp |
||
422 | push eax |
||
423 | |||
424 | cmp [eax+APPOBJ.magic], 'EVNT' |
||
425 | jne .fail |
||
426 | cmp [eax+EVENT.id], ebx |
||
427 | jne .fail |
||
428 | |||
429 | mov eax, [eax+APPOBJ.pid] |
||
430 | call pid_to_slot |
||
431 | test eax, eax |
||
432 | jz .fail |
||
433 | |||
434 | shl eax, 8 |
||
380 | serge | 435 | add eax, SLOT_BASE+APP_EV_OFFSET |
377 | serge | 436 | mov edx, [.event] |
437 | pushfd |
||
438 | cli ;remove event from events |
||
439 | mov ebx, [edx+APPOBJ.fd] ;list (reset event) |
||
440 | mov ecx, [edx+APPOBJ.bk] ;and clear events flag |
||
441 | mov [ebx+APPOBJ.bk], ecx ;if no active events |
||
442 | mov [ecx+APPOBJ.fd], ebx |
||
443 | |||
444 | and [edx+EVENT.state], not (EVENT_SIGNALED+EVENT_WATCHED) |
||
445 | |||
446 | dec [eax+APPDATA.ev_count-APP_EV_OFFSET] |
||
447 | jnz @F |
||
448 | and [eax+APPDATA.event_mask-APP_EV_OFFSET], not EVENT_EXTENDED |
||
449 | @@: |
||
450 | add eax, (APP_OBJ_OFFSET-APP_EV_OFFSET) |
||
451 | |||
452 | mov ecx, [eax+APPOBJ.fd] ;insert event into |
||
453 | mov [edx+APPOBJ.fd], ecx ;objects list |
||
454 | mov [edx+APPOBJ.bk], eax |
||
455 | mov [eax+APPOBJ.fd], edx |
||
456 | mov [ecx+APPOBJ.bk], edx |
||
457 | popfd |
||
458 | .fail: |
||
459 | .done: |
||
460 | add esp, 4 |
||
461 | ret |
||
462 | restore .event |
||
463 | |||
1 | ha | 464 | sys_getevent: |
465 | |||
466 | call get_event_for_app |
||
467 | mov [esp+36],eax |
||
468 | ret |
||
469 | |||
470 | |||
471 | align 4 |
||
472 | sys_wait_event_timeout: |
||
473 | |||
21 | poddubny | 474 | mov ebx,[timer_ticks] |
1 | ha | 475 | add ebx,eax |
21 | poddubny | 476 | cmp ebx,[timer_ticks] |
1 | ha | 477 | jna .swfet2 |
227 | serge | 478 | .swfet1: |
1 | ha | 479 | call get_event_for_app |
480 | test eax,eax |
||
481 | jne .eventoccur_time |
||
482 | call change_task |
||
21 | poddubny | 483 | cmp ebx,[timer_ticks] |
1 | ha | 484 | jg .swfet1 |
227 | serge | 485 | .swfet2: |
1 | ha | 486 | xor eax,eax |
227 | serge | 487 | .eventoccur_time: |
1 | ha | 488 | mov [esp+36],eax |
489 | ret |
||
490 | |||
491 | |||
492 | align 4 |
||
493 | |||
494 | sys_waitforevent: |
||
495 | |||
496 | call get_event_for_app |
||
497 | test eax,eax |
||
498 | jne eventoccur |
||
499 | newwait: |
||
500 | |||
379 | serge | 501 | mov eax, [TASK_BASE] |
115 | poddubny | 502 | mov [eax+TASKDATA.state], byte 5 |
1 | ha | 503 | call change_task |
504 | |||
21 | poddubny | 505 | mov eax, [event_sched] |
506 | |||
1 | ha | 507 | eventoccur: |
508 | mov [esp+36],eax |
||
509 | ret |
||
510 | |||
511 | get_event_for_app: |
||
512 | |||
513 | pushad |
||
514 | |||
379 | serge | 515 | mov edi,[TASK_BASE] ; WINDOW REDRAW |
115 | poddubny | 516 | test [edi+TASKDATA.event_mask],dword 1 |
1 | ha | 517 | jz no_eventoccur1 |
379 | serge | 518 | ;mov edi,[TASK_BASE] |
115 | poddubny | 519 | cmp [edi-twdw+WDATA.fl_redraw],byte 0 |
1 | ha | 520 | je no_eventoccur1 |
521 | popad |
||
522 | mov eax,1 |
||
523 | ret |
||
524 | no_eventoccur1: |
||
525 | |||
379 | serge | 526 | ;mov edi,[TASK_BASE] ; KEY IN BUFFER |
115 | poddubny | 527 | test [edi+TASKDATA.event_mask],dword 2 |
1 | ha | 528 | jz no_eventoccur2 |
379 | serge | 529 | mov ecx, [CURRENT_TASK] |
380 | serge | 530 | movzx edx,word [WIN_STACK+ecx*2] |
379 | serge | 531 | mov eax, [TASK_COUNT] |
1 | ha | 532 | cmp eax,edx |
92 | diamond | 533 | jne no_eventoccur2x |
381 | serge | 534 | cmp [KEY_COUNT],byte 0 |
92 | diamond | 535 | je no_eventoccur2x |
536 | eventoccur2: |
||
1 | ha | 537 | popad |
538 | mov eax,2 |
||
539 | ret |
||
92 | diamond | 540 | no_eventoccur2x: |
541 | mov eax, hotkey_buffer |
||
542 | @@: |
||
543 | cmp [eax], ecx |
||
544 | jz eventoccur2 |
||
545 | add eax, 8 |
||
546 | cmp eax, hotkey_buffer+120*8 |
||
547 | jb @b |
||
1 | ha | 548 | no_eventoccur2: |
549 | |||
379 | serge | 550 | ;mov edi,[TASK_BASE] ; BUTTON IN BUFFER |
115 | poddubny | 551 | test [edi+TASKDATA.event_mask],dword 4 |
1 | ha | 552 | jz no_eventoccur3 |
381 | serge | 553 | cmp [BTN_COUNT],byte 0 |
21 | poddubny | 554 | je no_eventoccur3 |
379 | serge | 555 | mov ecx, [CURRENT_TASK] |
380 | serge | 556 | movzx edx, word [WIN_STACK+ecx*2] |
379 | serge | 557 | mov eax, [TASK_COUNT] |
1 | ha | 558 | cmp eax,edx |
559 | jnz no_eventoccur3 |
||
560 | popad |
||
381 | serge | 561 | mov eax,[BTN_BUFF] |
1 | ha | 562 | cmp eax,65535 |
563 | je no_event_1 |
||
564 | mov eax,3 |
||
565 | ret |
||
566 | |||
567 | no_event_1: |
||
568 | mov [window_minimize],1 |
||
381 | serge | 569 | mov [BTN_COUNT],byte 0 |
1 | ha | 570 | xor eax, eax |
571 | ret |
||
572 | |||
573 | no_eventoccur3: |
||
227 | serge | 574 | |
575 | |||
379 | serge | 576 | ;mov edi,[TASK_BASE] ; mouse event |
115 | poddubny | 577 | test [edi+TASKDATA.event_mask],dword 00100000b |
21 | poddubny | 578 | jz no_mouse_event |
379 | serge | 579 | mov eax,[CURRENT_TASK] |
21 | poddubny | 580 | shl eax,8 |
380 | serge | 581 | test [eax+SLOT_BASE+APPDATA.event_mask],dword 00100000b |
21 | poddubny | 582 | jz no_mouse_event |
380 | serge | 583 | and [eax+SLOT_BASE+APPDATA.event_mask],dword 0xffffffff-00100000b |
21 | poddubny | 584 | popad |
585 | mov eax,6 |
||
586 | ret |
||
587 | no_mouse_event: |
||
1 | ha | 588 | |
227 | serge | 589 | |
379 | serge | 590 | ;mov edi,[TASK_BASE] ; DESKTOP BACKGROUND REDRAW |
115 | poddubny | 591 | test [edi+TASKDATA.event_mask],dword 16 |
1 | ha | 592 | jz no_eventoccur5 |
381 | serge | 593 | cmp [REDRAW_BACKGROUND],byte 2 |
1 | ha | 594 | jnz no_eventoccur5 |
595 | popad |
||
596 | mov eax,5 |
||
597 | ret |
||
598 | no_eventoccur5: |
||
599 | |||
379 | serge | 600 | ;mov edi,[TASK_BASE] ; IPC |
115 | poddubny | 601 | test [edi+TASKDATA.event_mask],dword 01000000b |
1 | ha | 602 | jz no_ipc |
379 | serge | 603 | mov eax,[CURRENT_TASK] |
21 | poddubny | 604 | shl eax,8 |
380 | serge | 605 | test [eax+SLOT_BASE+APPDATA.event_mask],dword 01000000b |
1 | ha | 606 | jz no_ipc |
380 | serge | 607 | and [eax+SLOT_BASE+APPDATA.event_mask],dword 0xffffffff-01000000b |
1 | ha | 608 | popad |
609 | mov eax,7 |
||
610 | ret |
||
611 | no_ipc: |
||
612 | |||
613 | |||
379 | serge | 614 | ;mov edi,[TASK_BASE] ; STACK |
115 | poddubny | 615 | test [edi+TASKDATA.event_mask],dword 10000000b |
1 | ha | 616 | jz no_stack_event |
379 | serge | 617 | mov eax,[CURRENT_TASK] |
21 | poddubny | 618 | shl eax,8 |
380 | serge | 619 | test [eax+SLOT_BASE+APPDATA.event_mask],dword 10000000b |
1 | ha | 620 | jz no_stack_event |
380 | serge | 621 | and [eax+SLOT_BASE+APPDATA.event_mask],dword 0xffffffff-10000000b |
1 | ha | 622 | popad |
21 | poddubny | 623 | mov eax,8 |
1 | ha | 624 | ret |
625 | no_stack_event: |
||
626 | |||
115 | poddubny | 627 | test byte [edi+TASKDATA.event_mask+1], 1 ; DEBUG |
354 | serge | 628 | jz .test_IRQ |
379 | serge | 629 | mov eax, [CURRENT_TASK] |
40 | halyavin | 630 | shl eax, 8 |
380 | serge | 631 | test byte [eax+SLOT_BASE+APPDATA.event_mask+1], byte 1 |
354 | serge | 632 | jz .test_IRQ |
380 | serge | 633 | and byte [eax+SLOT_BASE+APPDATA.event_mask+1], not 1 |
40 | halyavin | 634 | popad |
635 | mov eax, 9 |
||
636 | ret |
||
637 | |||
354 | serge | 638 | ;.test_ext: |
379 | serge | 639 | ; mov eax, [CURRENT_TASK] |
354 | serge | 640 | ; shl eax, 8 |
380 | serge | 641 | ; test dword [eax+SLOT_BASE+APPDATA.event_mask], EVENT_EXTENDED |
354 | serge | 642 | ; jz .test_IRQ |
643 | ; popad |
||
644 | ; mov eax, 10 |
||
645 | ; ret |
||
227 | serge | 646 | |
647 | .test_IRQ: |
||
115 | poddubny | 648 | cmp dword [edi+TASKDATA.event_mask], 0xFFFF |
21 | poddubny | 649 | jbe no_events |
1 | ha | 650 | |
381 | serge | 651 | mov esi,IRQ_SAVE ; IRQ'S AND DATA |
1 | ha | 652 | mov ebx,0x00010000 |
653 | xor ecx, ecx |
||
654 | irq_event_test: |
||
379 | serge | 655 | mov edi,[TASK_BASE] |
115 | poddubny | 656 | test [edi+TASKDATA.event_mask],ebx |
1 | ha | 657 | jz no_irq_event |
658 | mov edi,ecx |
||
659 | shl edi,2 |
||
660 | add edi,irq_owner |
||
661 | mov edx,[edi] |
||
379 | serge | 662 | mov eax,[TASK_BASE] |
115 | poddubny | 663 | mov eax,[eax+TASKDATA.pid] |
1 | ha | 664 | cmp edx,eax |
665 | jne no_irq_event |
||
666 | cmp [esi],dword 0 |
||
667 | jz no_irq_event |
||
668 | mov eax,ecx |
||
669 | add eax,16 |
||
670 | mov [esp+28],eax |
||
671 | popad |
||
672 | ret |
||
673 | no_irq_event: |
||
674 | add esi,0x1000 |
||
675 | shl ebx,1 |
||
676 | inc ecx |
||
677 | cmp ecx,16 |
||
678 | jb irq_event_test |
||
679 | |||
21 | poddubny | 680 | no_events: |
1 | ha | 681 | popad |
682 | xor eax, eax |
||
683 | ret |
||
684 |