add APPDATA.state for delete TASKDATA

git-svn-id: svn://kolibrios.org@9613 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Doczom 2022-01-11 10:50:30 +00:00
parent 2470cf023c
commit df70a59fd5
3 changed files with 38 additions and 8 deletions

View File

@ -474,8 +474,10 @@ align 4
align 4
get_pid:
mov eax, [TASK_BASE]
mov eax, [eax+TASKDATA.pid]
mov eax, [current_slot]
mov eax, [eax+APPDATA.tid]
mov eax, [TASK_BASE] ; delete
mov eax, [eax+TASKDATA.pid] ;
ret
pid_to_slot:
@ -487,11 +489,13 @@ pid_to_slot:
push ebx
push ecx
mov ebx, [thread_count]
shl ebx, BSF sizeof.TASKDATA ; multiply by size
shl ebx, BSF sizeof.TASKDATA ; multiply by size
;shl ebx, BSF sizeof.APPDATA ; multiply by size
; add 2*32 cause:
; [TASK_TABLE; TASK_TABLE + 32) isnt a task actually
; skip first process in the task table
mov ecx, 2*32
mov ecx, 2*32 ;sizeof.TASKDATA
;mov ecx, sizeof.APPDATA
.loop:
;ecx = offset of current process info entry
@ -500,8 +504,13 @@ pid_to_slot:
jz .endloop ;skip empty slots
cmp [TASK_TABLE+ecx+TASKDATA.pid], eax;check PID
jz .pid_found
;cmp [ecx+SLOT_BASE+APPDATA.state], TSTATE_FREE
;jz .endloop ;skip empty slots
;cmp [ecx+SLOT_BASE+APPDATA.pid], eax;check PID
;jz .pid_found
.endloop:
add ecx, sizeof.TASKDATA
;add ecx, sizeof.APPDATA
cmp ecx, ebx
jle .loop
@ -512,6 +521,7 @@ pid_to_slot:
.pid_found:
shr ecx, BSF sizeof.TASKDATA ; divide by size
;shr ecx, BSF sizeof.APPDATA
mov eax, ecx ;convert offset to index of slot
pop ecx
pop ebx
@ -896,6 +906,8 @@ common_app_entry:
mov ebx, [current_slot]
cmp [ebx+APPDATA.debugger_slot], 0
je .exit
;mov eax, [current_slot]
mov [ebx+APPDATA.state], TSTATE_RUN_SUSPENDED
mov eax, [TASK_BASE]
mov [eax+TASKDATA.state], TSTATE_RUN_SUSPENDED
call change_task
@ -974,6 +986,10 @@ proc set_app_params stdcall,slot:dword, params:dword, flags:dword
;shr ebx, 3
;mov dword [TASK_TABLE+ebx+TASKDATA.mem_start], 0
mov dword [ebx+SLOT_BASE+APPDATA.mem_start], 0
mov [ebx+SLOT_BASE+APPDATA.event_mask], dword 1+2+4;set default event flags (see 40 function)
inc dword [process_number]
mov eax, [process_number]
mov [ebx+SLOT_BASE+APPDATA.tid], eax ;set TID
mov eax, [slot]
mov [ebx+SLOT_BASE+APPDATA.wnd_number], al
@ -989,9 +1005,8 @@ proc set_app_params stdcall,slot:dword, params:dword, flags:dword
mov [ebx+TASKDATA.event_mask], dword 1+2+4;set default event flags (see 40 function)
inc dword [process_number]
mov eax, [process_number]
mov [ebx+TASKDATA.pid], eax ;set PID
mov eax, [process_number] ; delete
mov [ebx+TASKDATA.pid], eax ;set PID ;
;set draw data to full screen
xor eax, eax
@ -1047,6 +1062,8 @@ proc set_app_params stdcall,slot:dword, params:dword, flags:dword
mov [SLOT_BASE+ebx*8+APPDATA.debugger_slot], eax
.no_debug:
mov [TASK_TABLE+ebx+TASKDATA.state], dl
;shl ebx, 3
;mov [ebx+SLOT_BASE+APPDATA.state], dl
lea edx, [SLOT_BASE+ebx*8]
call scheduler_add_thread
ret

View File

@ -68,6 +68,8 @@ create_event: ;; EXPORT use
;scratched: ebx,ecx,esi,edi
mov ebx, [current_slot]
add ebx, APP_OBJ_OFFSET
;mov edx, [cyrrent_slot]
;mov edx, [edx+APPDATA.tid]
mov edx, [TASK_BASE]
mov edx, [edx+TASKDATA.pid]
pushfd
@ -280,6 +282,7 @@ Wait_events_ex:
mov [esi+APPDATA.wait_timeout], ebx
mov eax, [timer_ticks]
mov [esi+APPDATA.wait_begin], eax
mov [esi+APPDATA.state], TSTATE_WAITING
mov eax, [TASK_BASE]
mov [eax+TASKDATA.state], TSTATE_WAITING
call change_task
@ -510,6 +513,8 @@ get_event_for_app: ;; used from f10,f11,f23
;retval:
; eax - event number (=0 => no events)
movzx edi, bh ; bh is assumed as [current_slot_idx]
;shl edi, 8
;mov ecx, [edi+SLOT_BASE+APPDATA.event_mask]
shl edi, 5
add edi, TASK_TABLE ; edi is assumed as [TASK_BASE]
mov ecx, [edi+TASKDATA.event_mask]
@ -552,6 +557,8 @@ align 4
align 4
.mouse_check: ; Mouse 5+1=6
push eax
;mov eax, [current_slot]
;mov eax, [eax + APPDATA.event_mask]
mov eax, [TASK_BASE]
mov eax, [eax + TASKDATA.event_mask]
test eax, 0x80000000 ; bit 31: active/inactive filter f.40

View File

@ -2201,10 +2201,13 @@ sysfn_zmodif:
mov eax, edx
shl edx, 5
;shl edx, 8
;cmp [edx + SLOT_BASE + APPDATA.state], TSTATE_FREE
cmp [edx + TASK_TABLE + TASKDATA.state], TSTATE_FREE
je .fail
;shr edx, 3
cmp ecx, 1
jnz .set_zmod
@ -2665,6 +2668,7 @@ sys_cpuusage:
stosd
; +30: PID/TID
mov eax, [ecx*8 + SLOT_BASE + APPDATA.tid]
mov eax, [ecx+TASK_TABLE+TASKDATA.pid]
stosd
@ -2677,6 +2681,7 @@ sys_cpuusage:
movsd
; Process state (+50)
movzx eax, byte [ecx*8 + SLOT_BASE + APPDATA.state]
movzx eax, byte [ecx+TASK_TABLE+TASKDATA.state]
stosd
@ -2692,7 +2697,8 @@ sys_cpuusage:
stosb
; Event mask (+71)
mov EAX, dword [ECX+TASK_TABLE+TASKDATA.event_mask]
mov EAX, dword [ecx*8 + SLOT_BASE + APPDATA.event_mask]
mov EAX, dword [ECX+TASK_TABLE+TASKDATA.event_mask] ; delete
stosd
; Keyboard mode (+75)