Rev 9608 | Rev 9614 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 9608 | Rev 9613 | ||
---|---|---|---|
Line 3... | Line 3... | ||
3 | ;; Copyright (C) KolibriOS team 2004-2021. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2021. All rights reserved. ;; |
4 | ;; Distributed under terms of the GNU General Public License. ;; |
4 | ;; Distributed under terms of the GNU General Public License. ;; |
5 | ;; ;; |
5 | ;; ;; |
6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
Line 7... | Line 7... | ||
7 | 7 | ||
Line 8... | Line 8... | ||
8 | $Revision: 9608 $ |
8 | $Revision: 9613 $ |
Line 9... | Line 9... | ||
9 | 9 | ||
Line 472... | Line 472... | ||
472 | .exit: |
472 | .exit: |
473 | ret |
473 | ret |
Line 474... | Line 474... | ||
474 | 474 | ||
475 | align 4 |
475 | align 4 |
476 | get_pid: |
476 | get_pid: |
477 | mov eax, [TASK_BASE] |
477 | mov eax, [current_slot] |
- | 478 | mov eax, [eax+APPDATA.tid] |
|
- | 479 | mov eax, [TASK_BASE] ; delete |
|
478 | mov eax, [eax+TASKDATA.pid] |
480 | mov eax, [eax+TASKDATA.pid] ; |
Line 479... | Line 481... | ||
479 | ret |
481 | ret |
480 | 482 | ||
481 | pid_to_slot: |
483 | pid_to_slot: |
Line 486... | Line 488... | ||
486 | ;Search process by PID. |
488 | ;Search process by PID. |
487 | push ebx |
489 | push ebx |
488 | push ecx |
490 | push ecx |
489 | mov ebx, [thread_count] |
491 | mov ebx, [thread_count] |
490 | shl ebx, BSF sizeof.TASKDATA ; multiply by size |
492 | shl ebx, BSF sizeof.TASKDATA ; multiply by size |
- | 493 | ;shl ebx, BSF sizeof.APPDATA ; multiply by size |
|
491 | ; add 2*32 cause: |
494 | ; add 2*32 cause: |
492 | ; [TASK_TABLE; TASK_TABLE + 32) isnt a task actually |
495 | ; [TASK_TABLE; TASK_TABLE + 32) isnt a task actually |
493 | ; skip first process in the task table |
496 | ; skip first process in the task table |
- | 497 | mov ecx, 2*32 ;sizeof.TASKDATA |
|
494 | mov ecx, 2*32 |
498 | ;mov ecx, sizeof.APPDATA |
Line 495... | Line 499... | ||
495 | 499 | ||
496 | .loop: |
500 | .loop: |
497 | ;ecx = offset of current process info entry |
501 | ;ecx = offset of current process info entry |
498 | ;ebx = maximum permitted offset |
502 | ;ebx = maximum permitted offset |
499 | cmp [TASK_TABLE+ecx+TASKDATA.state], TSTATE_FREE |
503 | cmp [TASK_TABLE+ecx+TASKDATA.state], TSTATE_FREE |
500 | jz .endloop ;skip empty slots |
504 | jz .endloop ;skip empty slots |
501 | cmp [TASK_TABLE+ecx+TASKDATA.pid], eax;check PID |
505 | cmp [TASK_TABLE+ecx+TASKDATA.pid], eax;check PID |
- | 506 | jz .pid_found |
|
- | 507 | ;cmp [ecx+SLOT_BASE+APPDATA.state], TSTATE_FREE |
|
- | 508 | ;jz .endloop ;skip empty slots |
|
- | 509 | ;cmp [ecx+SLOT_BASE+APPDATA.pid], eax;check PID |
|
502 | jz .pid_found |
510 | ;jz .pid_found |
503 | .endloop: |
511 | .endloop: |
- | 512 | add ecx, sizeof.TASKDATA |
|
504 | add ecx, sizeof.TASKDATA |
513 | ;add ecx, sizeof.APPDATA |
505 | cmp ecx, ebx |
514 | cmp ecx, ebx |
Line 506... | Line 515... | ||
506 | jle .loop |
515 | jle .loop |
507 | 516 | ||
508 | pop ecx |
517 | pop ecx |
509 | pop ebx |
518 | pop ebx |
Line 510... | Line 519... | ||
510 | xor eax, eax |
519 | xor eax, eax |
511 | ret |
520 | ret |
- | 521 | ||
512 | 522 | .pid_found: |
|
513 | .pid_found: |
523 | shr ecx, BSF sizeof.TASKDATA ; divide by size |
514 | shr ecx, BSF sizeof.TASKDATA ; divide by size |
524 | ;shr ecx, BSF sizeof.APPDATA |
515 | mov eax, ecx ;convert offset to index of slot |
525 | mov eax, ecx ;convert offset to index of slot |
Line 894... | Line 904... | ||
894 | stdcall free_kernel_space, [ebp+APP_HDR.img_base] |
904 | stdcall free_kernel_space, [ebp+APP_HDR.img_base] |
895 | stdcall kernel_free, ebp |
905 | stdcall kernel_free, ebp |
896 | mov ebx, [current_slot] |
906 | mov ebx, [current_slot] |
897 | cmp [ebx+APPDATA.debugger_slot], 0 |
907 | cmp [ebx+APPDATA.debugger_slot], 0 |
898 | je .exit |
908 | je .exit |
- | 909 | ;mov eax, [current_slot] |
|
- | 910 | mov [ebx+APPDATA.state], TSTATE_RUN_SUSPENDED |
|
899 | mov eax, [TASK_BASE] |
911 | mov eax, [TASK_BASE] |
900 | mov [eax+TASKDATA.state], TSTATE_RUN_SUSPENDED |
912 | mov [eax+TASKDATA.state], TSTATE_RUN_SUSPENDED |
901 | call change_task |
913 | call change_task |
902 | .exit: |
914 | .exit: |
903 | popad |
915 | popad |
Line 972... | Line 984... | ||
972 | rep movsd |
984 | rep movsd |
Line 973... | Line 985... | ||
973 | 985 | ||
974 | ;shr ebx, 3 |
986 | ;shr ebx, 3 |
975 | ;mov dword [TASK_TABLE+ebx+TASKDATA.mem_start], 0 |
987 | ;mov dword [TASK_TABLE+ebx+TASKDATA.mem_start], 0 |
- | 988 | mov dword [ebx+SLOT_BASE+APPDATA.mem_start], 0 |
|
- | 989 | mov [ebx+SLOT_BASE+APPDATA.event_mask], dword 1+2+4;set default event flags (see 40 function) |
|
- | 990 | inc dword [process_number] |
|
- | 991 | mov eax, [process_number] |
|
Line 976... | Line 992... | ||
976 | mov dword [ebx+SLOT_BASE+APPDATA.mem_start], 0 |
992 | mov [ebx+SLOT_BASE+APPDATA.tid], eax ;set TID |
977 | 993 | ||
978 | mov eax, [slot] |
994 | mov eax, [slot] |
979 | mov [ebx+SLOT_BASE+APPDATA.wnd_number], al |
995 | mov [ebx+SLOT_BASE+APPDATA.wnd_number], al |
Line 987... | Line 1003... | ||
987 | add ebx, TASK_TABLE ;ebx - pointer to information about process |
1003 | add ebx, TASK_TABLE ;ebx - pointer to information about process |
988 | ;mov [ebx+TASKDATA.wnd_number], al;set window number on screen = process slot |
1004 | ;mov [ebx+TASKDATA.wnd_number], al;set window number on screen = process slot |
Line 989... | Line 1005... | ||
989 | 1005 | ||
Line 990... | Line -... | ||
990 | mov [ebx+TASKDATA.event_mask], dword 1+2+4;set default event flags (see 40 function) |
- | |
991 | 1006 | mov [ebx+TASKDATA.event_mask], dword 1+2+4;set default event flags (see 40 function) |
|
992 | inc dword [process_number] |
1007 | |
Line 993... | Line 1008... | ||
993 | mov eax, [process_number] |
1008 | mov eax, [process_number] ; delete |
994 | mov [ebx+TASKDATA.pid], eax ;set PID |
1009 | mov [ebx+TASKDATA.pid], eax ;set PID ; |
995 | 1010 | ||
996 | ;set draw data to full screen |
1011 | ;set draw data to full screen |
Line 1045... | Line 1060... | ||
1045 | jz .no_debug |
1060 | jz .no_debug |
1046 | mov eax, [current_slot_idx] |
1061 | mov eax, [current_slot_idx] |
1047 | mov [SLOT_BASE+ebx*8+APPDATA.debugger_slot], eax |
1062 | mov [SLOT_BASE+ebx*8+APPDATA.debugger_slot], eax |
1048 | .no_debug: |
1063 | .no_debug: |
1049 | mov [TASK_TABLE+ebx+TASKDATA.state], dl |
1064 | mov [TASK_TABLE+ebx+TASKDATA.state], dl |
- | 1065 | ;shl ebx, 3 |
|
- | 1066 | ;mov [ebx+SLOT_BASE+APPDATA.state], dl |
|
1050 | lea edx, [SLOT_BASE+ebx*8] |
1067 | lea edx, [SLOT_BASE+ebx*8] |
1051 | call scheduler_add_thread |
1068 | call scheduler_add_thread |
1052 | ret |
1069 | ret |
1053 | endp |
1070 | endp |