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

View File

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

View File

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