replacing TASK DATA.pid with APPDATA.tid

git-svn-id: svn://kolibrios.org@9692 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Doczom 2022-02-06 20:33:29 +00:00
parent 5f02a78eaf
commit 19347417f0
11 changed files with 61 additions and 86 deletions

View File

@ -21,7 +21,6 @@ goto :eof
fasm -m 65536 kernel.asm kernel.mnt
fasm -m 65536 kernel.asm kernel.bin -dUEFI=1
if not %errorlevel%==0 goto :Error_FasmFailed
erase lang.inc
goto :eof

View File

@ -1155,8 +1155,8 @@ proc load_library stdcall, file_name:dword, encoding:dword
test eax, eax
jz .fail_and_free_user
mov ebx, [current_slot_idx]
shl ebx, 5
mov edx, [TASK_TABLE+ebx+TASKDATA.pid]
shl ebx, BSF sizeof.APPDATA
mov edx, [SLOT_BASE + ebx + APPDATA.tid]
mov [eax+HDLL.pid], edx
push eax
call init_dlls_in_thread

View File

@ -1397,8 +1397,8 @@ align 4
ja .fail
mov ebx, [current_slot_idx]
shl ebx, BSF sizeof.TASKDATA
mov ebx, [TASK_TABLE + ebx + TASKDATA.pid]
shl ebx, BSF sizeof.APPDATA
mov ebx, [SLOT_BASE + ebx + APPDATA.tid]
mov eax, sizeof.SMAP
call create_kernel_object

View File

@ -1007,8 +1007,8 @@ proc sys_ipc_send stdcall, PID:dword, msg_addr:dword, msg_size:dword
ja .buffer_overflow ;esi<0 - not enough memory in buffer
mov dword [edi+4], ebx
mov eax, [TASK_BASE]
mov eax, [eax+TASKDATA.pid] ;eax - our PID
mov eax, [current_slot]
mov eax, [eax + APPDATA.tid] ;eax - our PID
add edi, edx
mov [edi], eax
mov ecx, [msg_size]

View File

@ -180,8 +180,8 @@ exc_c: ; exceptions (all but 7th - #NM)
mov cl, 3 ; debug_message code=debug_exception
.notify:
push ebx ; debug_message data
mov ebx, [TASK_BASE]
push [ebx+TASKDATA.pid] ; PID
mov ebx, [current_slot]
push [ebx + APPDATA.tid] ; PID
push ecx ; debug_message code ((here: ecx==1/3))
mov cl, 12 ; debug_message size
call debugger_notify ;; only ONE using, inline ??? SEE: core/debug.inc
@ -214,11 +214,11 @@ show_error_parameters:
call fs_execute_from_sysdir_param
pop ebx
.no_ud:
mov edx, [TASK_BASE];not scratched below
mov edx, [current_slot];not scratched below
if lang eq sp
DEBUGF 1, "K : Proceso - terminado forzado PID: %x [%s]\n", [edx+TASKDATA.pid], [current_slot]
DEBUGF 1, "K : Proceso - terminado forzado PID: %x [%s]\n", [edx + APPDATA.tid], [current_slot]
else
DEBUGF 1, "K : Process - forced terminate PID: %x [%s]\n", [edx+TASKDATA.pid], [current_slot]
DEBUGF 1, "K : Process - forced terminate PID: %x [%s]\n", [edx + APPDATA.tid], [current_slot]
end if
cmp bl, 0x08
jb .l0
@ -343,9 +343,8 @@ lock_application_table:
call mutex_lock
mov eax, [current_slot_idx]
shl eax, BSF sizeof.TASKDATA
add eax, TASK_TABLE+TASKDATA.pid
mov eax, [eax]
shl eax, BSF sizeof.APPDATA
mov eax, [eax + SLOT_BASE + APPDATA.tid]
mov [application_table_owner], eax
@ -506,8 +505,8 @@ destroy_thread:
jb .loop
; get process PID
mov eax, esi
shl eax, BSF sizeof.TASKDATA
mov eax, [eax+TASK_TABLE+TASKDATA.pid]
shl eax, BSF sizeof.APPDATA
mov eax, [eax + SLOT_BASE + APPDATA.tid]
; compare current lock input with process PID
cmp eax, [PID_lock_input]
jne @f
@ -578,12 +577,12 @@ destroy_thread:
; debuggee test
pushad
mov edi, esi
shl edi, BSF sizeof.TASKDATA
mov eax, [SLOT_BASE+edi*8+APPDATA.debugger_slot]
shl edi, BSF sizeof.APPDATA
mov eax, [SLOT_BASE + edi + APPDATA.debugger_slot]
test eax, eax
jz .nodebug
movi ecx, 8
push dword [TASK_TABLE+edi+TASKDATA.pid]; PID
push dword [SLOT_BASE + edi + APPDATA.tid]; PID
push 2
call debugger_notify
pop ecx
@ -653,8 +652,8 @@ destroy_thread:
.dont_activate:
push esi ; remove hd1 & cd & flp reservation
shl esi, BSF sizeof.TASKDATA
mov esi, [esi+TASK_TABLE+TASKDATA.pid]
shl esi, BSF sizeof.APPDATA
mov esi, [esi + SLOT_BASE + APPDATA.tid]
cmp [cd_status], esi
jnz @f
call free_cd_channel
@ -669,9 +668,8 @@ destroy_thread:
pusha ; remove all port reservations
mov edx, esi
shl edx, BSF sizeof.TASKDATA
add edx, TASK_TABLE
mov edx, [edx+TASKDATA.pid]
shl edx, BSF sizeof.APPDATA
mov edx, [edx + SLOT_BASE + APPDATA.tid]
rmpr0:
@ -717,7 +715,7 @@ destroy_thread:
mov [edi+TASK_TABLE + TASKDATA.state], TSTATE_FREE
; debugger test - terminate all debuggees
mov eax, 2
mov ecx, SLOT_BASE+2*0x100+APPDATA.debugger_slot
mov ecx, SLOT_BASE+2*sizeof.APPDATA + APPDATA.debugger_slot
.xd0:
cmp eax, [thread_count]
ja .xd1
@ -731,7 +729,7 @@ destroy_thread:
popad
@@:
inc eax
add ecx, 0x100
add ecx, sizeof.APPDATA
jmp .xd0
.xd1:
;release slot

View File

@ -476,8 +476,6 @@ align 4
get_pid:
mov eax, [current_slot]
mov eax, [eax+APPDATA.tid]
mov eax, [TASK_BASE] ; delete
mov eax, [eax+TASKDATA.pid] ;
ret
pid_to_slot:
@ -502,12 +500,10 @@ pid_to_slot:
;ebx = maximum permitted offset
cmp [TASK_TABLE+ecx+TASKDATA.state], TSTATE_FREE
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
cmp [ecx*8 + SLOT_BASE + APPDATA.tid], eax;check PID
jz .pid_found
.endloop:
add ecx, sizeof.TASKDATA
;add ecx, sizeof.APPDATA
@ -997,10 +993,6 @@ proc set_app_params stdcall,slot:dword, params:dword, flags:dword
; set window state to 'normal' (non-minimized/maximized/rolled-up) state
mov [ebx+window_data+WDATA.fl_wstate], WSTATE_NORMAL
mov [ebx+window_data+WDATA.fl_redraw], 1
add ebx, TASK_TABLE ;ebx - pointer to information about process
mov eax, [process_number] ; delete
mov [ebx+TASKDATA.pid], eax ;set PID ;
;set draw data to full screen
xor eax, eax

View File

@ -57,8 +57,8 @@ reserve_cd:
reserve_ok2:
push eax
mov eax, [current_slot_idx]
shl eax, 5
mov eax, [eax+TASK_TABLE+TASKDATA.pid]
shl eax, BSF sizeof.APPDATA
mov eax, [eax + SLOT_BASE + APPDATA.tid]
mov [cd_status], eax
pop eax
sti

View File

@ -68,10 +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]
mov edx, [current_slot]
mov edx, [edx+APPDATA.tid]
pushfd
cli
;--------------------------------------

View File

@ -1182,11 +1182,7 @@ proc setup_os_slot
list_add_tail ebx, ecx
mov [edx+APPDATA.wnd_number], dh
mov byte [edx+APPDATA.tid], dh ;?
mov eax, edx
shr eax, 3
add eax, TASK_TABLE - (SLOT_BASE shr 3)
mov byte [eax+TASKDATA.pid], dh
mov byte [edx+APPDATA.tid], dh
ret
endp
@ -1923,8 +1919,6 @@ sys_end:
pusha
mov edx, [current_slot]
mov edx, [edx+APPDATA.tid]
mov edx, [TASK_BASE] ; delete
mov edx, [edx+TASKDATA.pid] ;
call socket_process_end
popa
;--------------------------------------
@ -2050,7 +2044,7 @@ sysfn_terminate: ; 18.2 = TERMINATE
ja noprocessterminate
mov eax, [thread_count]
shl ecx, BSF sizeof.TASKDATA
mov edx, [ecx+TASK_TABLE+TASKDATA.pid]
mov edx, [ecx*8 + SLOT_BASE + APPDATA.tid]
add ecx, TASK_TABLE+TASKDATA.state
cmp byte [ecx], TSTATE_FREE
jz noprocessterminate
@ -2659,7 +2653,6 @@ sys_cpuusage:
; +30: PID/TID
mov eax, [ecx*8 + SLOT_BASE + APPDATA.tid]
mov eax, [ecx+TASK_TABLE+TASKDATA.pid]
stosd
; window position and size
@ -3616,10 +3609,8 @@ no_unmask_io:
mov [RESERVED_PORTS], eax
shl eax, 4
add eax, RESERVED_PORTS
;mov ebx, [current_slot]
;mov ebx, [ebx+APPDATA.tid]
mov ebx, [TASK_BASE]
mov ebx, [ebx+TASKDATA.pid]
mov ebx, [current_slot]
mov ebx, [ebx+APPDATA.tid]
mov [eax], ebx
mov [eax+4], ecx
mov [eax+8], edx
@ -3633,10 +3624,8 @@ free_port_area:
mov eax, [RESERVED_PORTS]; no reserved areas ?
test eax, eax
jz frpal2
;mov ebx, [current_slot]
;mov ebx, [ebx+APPDATA.tid]
mov ebx, [TASK_BASE]
mov ebx, [ebx+TASKDATA.pid]
mov ebx, [current_slot]
mov ebx, [ebx+APPDATA.tid]
frpal3:
mov edi, eax
shl edi, 4
@ -4420,10 +4409,8 @@ align 4
jnz @f
; get current PID
mov eax, [current_slot_idx]
shl eax, 5
mov eax, [eax+TASK_TABLE+TASKDATA.pid]
;shl eax, 8
;mov eax, [eax+SLOT_BASE+APPDATA.tid]
shl eax, BSF sizeof.APPDATA
mov eax, [eax+SLOT_BASE+APPDATA.tid]
; set current PID for lock input
mov [PID_lock_input], eax
@@:
@ -4437,10 +4424,8 @@ align 4
jz @f
; get current PID
mov ebx, [current_slot_idx]
shl ebx, 5
mov ebx, [ebx+TASK_TABLE+TASKDATA.pid]
;shl ebx, 8
;mov ebx, [ebx+SLOT_BASE+APPDATA.tid]
shl ebx, BSF sizeof.APPDATA
mov ebx, [ebx+SLOT_BASE+APPDATA.tid]
; compare current lock input with current PID
cmp ebx, eax
jne @f

View File

@ -679,8 +679,8 @@ socket_accept:
jz .invalid
; Change sockets thread owner ID to that of the current thread
mov ebx, [TASK_BASE]
mov ebx, [ebx + TASKDATA.pid]
mov ebx, [current_slot]
mov ebx, [ebx + APPDATA.tid]
mov [eax + SOCKET.TID], ebx
; Return socket number to caller
@ -925,8 +925,8 @@ socket_receive_local:
jne @f
; Change PID to that of current process
mov ebx, [TASK_BASE]
mov ebx, [ebx + TASKDATA.pid]
mov ebx, [current_slot]
mov ebx, [ebx + APPDATA.tid]
mov [eax + SOCKET.PID], ebx
mov [eax + SOCKET.TID], ebx ; currently TID = PID in kolibrios :(
@@:
@ -1114,8 +1114,8 @@ socket_send_local:
jne @f
; Change PID to that of current process
mov ebx, [TASK_BASE]
mov ebx, [ebx + TASKDATA.pid]
mov ebx, [current_slot]
mov ebx, [ebx + APPDATA.tid]
mov [eax + SOCKET.PID], ebx
mov [eax + SOCKET.TID], ebx ; currently TID = PID in kolibrios :(
@@:
@ -1862,9 +1862,10 @@ socket_block:
push edx
mov edx, [TASK_BASE]
mov [edx + TASKDATA.state], TSTATE_RUN_SUSPENDED
mov edx, [current_slot]
; Remember the thread ID so we can wake it up again
mov edx, [edx + TASKDATA.pid]
mov edx, [edx + APPDATA.tid]
DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_block: suspending thread: %u\n", edx
mov [eax + SOCKET.TID], edx
pop edx
@ -1902,12 +1903,15 @@ socket_notify:
jz .error2
xor ecx, ecx
inc ecx
mov esi, TASK_DATA
;mov esi, TASK_DATA
mov esi, SLOT_BASE + sizeof.APPDATA
.next:
cmp [esi + TASKDATA.pid], ebx
;cmp [esi + TASKDATA.pid], ebx
cmp [esi + APPDATA.tid], ebx
je .found
inc ecx
add esi, sizeof.TASKDATA
;add esi, sizeof.TASKDATA
add esi, sizeof.APPDATA
cmp ecx, [thread_count]
jbe .next
@ -1927,7 +1931,7 @@ socket_notify:
; Socket and thread exists and socket is of non blocking type.
; We'll try to flag an event to the thread.
shl ecx, 8
shl ecx, BSF sizeof.APPDATA
or [SLOT_BASE + ecx + APPDATA.occurred_events], EVENT_NETWORK
DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_notify: poking thread %u!\n", ebx
@ -1939,7 +1943,8 @@ socket_notify:
; Socket and thread exists and socket is of blocking type
; We'll try to unblock it.
and [eax + SOCKET.state], not SS_BLOCKED ; Clear the 'socket is blocked' flag
mov [esi + TASKDATA.state], TSTATE_RUNNING ; Run the thread
shl ecx, BSF sizeof.TASKDATA
mov [ecx + TASK_TABLE + TASKDATA.state], TSTATE_RUNNING ; Run the thread
DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_notify: Unblocked socket!\n"
pop esi ecx ebx
@ -2009,8 +2014,8 @@ socket_alloc:
DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_alloc: number=%u\n", edi
; Fill in PID
mov ebx, [TASK_BASE]
mov ebx, [ebx + TASKDATA.pid]
mov ebx, [current_slot]
mov ebx, [ebx + APPDATA.tid]
mov [eax + SOCKET.PID], ebx
mov [eax + SOCKET.TID], ebx ; currently TID = PID in kolibrios :(
@ -2323,8 +2328,8 @@ socket_check_owner:
DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_check_owner: %x\n", eax
push ebx
mov ebx, [TASK_BASE]
mov ebx, [ebx + TASKDATA.pid]
mov ebx, [current_slot]
mov ebx, [ebx + APPDATA.tid]
cmp [eax + SOCKET.PID], ebx
pop ebx

View File

@ -423,8 +423,6 @@ align 4
push edi
mov eax, [current_slot_idx]
;shl eax, 5
;mov eax, [TASK_TABLE+eax+TASKDATA.pid]
shl eax, 8
mov eax, [eax + SLOT_BASE + APPDATA.tid]
mov ebx, [src]