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.mnt
fasm -m 65536 kernel.asm kernel.bin -dUEFI=1 fasm -m 65536 kernel.asm kernel.bin -dUEFI=1
if not %errorlevel%==0 goto :Error_FasmFailed if not %errorlevel%==0 goto :Error_FasmFailed
erase lang.inc
goto :eof goto :eof

View File

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

View File

@ -1397,8 +1397,8 @@ align 4
ja .fail ja .fail
mov ebx, [current_slot_idx] mov ebx, [current_slot_idx]
shl ebx, BSF sizeof.TASKDATA shl ebx, BSF sizeof.APPDATA
mov ebx, [TASK_TABLE + ebx + TASKDATA.pid] mov ebx, [SLOT_BASE + ebx + APPDATA.tid]
mov eax, sizeof.SMAP mov eax, sizeof.SMAP
call create_kernel_object 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 ja .buffer_overflow ;esi<0 - not enough memory in buffer
mov dword [edi+4], ebx mov dword [edi+4], ebx
mov eax, [TASK_BASE] mov eax, [current_slot]
mov eax, [eax+TASKDATA.pid] ;eax - our PID mov eax, [eax + APPDATA.tid] ;eax - our PID
add edi, edx add edi, edx
mov [edi], eax mov [edi], eax
mov ecx, [msg_size] 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 mov cl, 3 ; debug_message code=debug_exception
.notify: .notify:
push ebx ; debug_message data push ebx ; debug_message data
mov ebx, [TASK_BASE] mov ebx, [current_slot]
push [ebx+TASKDATA.pid] ; PID push [ebx + APPDATA.tid] ; PID
push ecx ; debug_message code ((here: ecx==1/3)) push ecx ; debug_message code ((here: ecx==1/3))
mov cl, 12 ; debug_message size mov cl, 12 ; debug_message size
call debugger_notify ;; only ONE using, inline ??? SEE: core/debug.inc call debugger_notify ;; only ONE using, inline ??? SEE: core/debug.inc
@ -214,11 +214,11 @@ show_error_parameters:
call fs_execute_from_sysdir_param call fs_execute_from_sysdir_param
pop ebx pop ebx
.no_ud: .no_ud:
mov edx, [TASK_BASE];not scratched below mov edx, [current_slot];not scratched below
if lang eq sp 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 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 end if
cmp bl, 0x08 cmp bl, 0x08
jb .l0 jb .l0
@ -343,9 +343,8 @@ lock_application_table:
call mutex_lock call mutex_lock
mov eax, [current_slot_idx] mov eax, [current_slot_idx]
shl eax, BSF sizeof.TASKDATA shl eax, BSF sizeof.APPDATA
add eax, TASK_TABLE+TASKDATA.pid mov eax, [eax + SLOT_BASE + APPDATA.tid]
mov eax, [eax]
mov [application_table_owner], eax mov [application_table_owner], eax
@ -506,8 +505,8 @@ destroy_thread:
jb .loop jb .loop
; get process PID ; get process PID
mov eax, esi mov eax, esi
shl eax, BSF sizeof.TASKDATA shl eax, BSF sizeof.APPDATA
mov eax, [eax+TASK_TABLE+TASKDATA.pid] mov eax, [eax + SLOT_BASE + APPDATA.tid]
; compare current lock input with process PID ; compare current lock input with process PID
cmp eax, [PID_lock_input] cmp eax, [PID_lock_input]
jne @f jne @f
@ -578,12 +577,12 @@ destroy_thread:
; debuggee test ; debuggee test
pushad pushad
mov edi, esi mov edi, esi
shl edi, BSF sizeof.TASKDATA shl edi, BSF sizeof.APPDATA
mov eax, [SLOT_BASE+edi*8+APPDATA.debugger_slot] mov eax, [SLOT_BASE + edi + APPDATA.debugger_slot]
test eax, eax test eax, eax
jz .nodebug jz .nodebug
movi ecx, 8 movi ecx, 8
push dword [TASK_TABLE+edi+TASKDATA.pid]; PID push dword [SLOT_BASE + edi + APPDATA.tid]; PID
push 2 push 2
call debugger_notify call debugger_notify
pop ecx pop ecx
@ -653,8 +652,8 @@ destroy_thread:
.dont_activate: .dont_activate:
push esi ; remove hd1 & cd & flp reservation push esi ; remove hd1 & cd & flp reservation
shl esi, BSF sizeof.TASKDATA shl esi, BSF sizeof.APPDATA
mov esi, [esi+TASK_TABLE+TASKDATA.pid] mov esi, [esi + SLOT_BASE + APPDATA.tid]
cmp [cd_status], esi cmp [cd_status], esi
jnz @f jnz @f
call free_cd_channel call free_cd_channel
@ -669,9 +668,8 @@ destroy_thread:
pusha ; remove all port reservations pusha ; remove all port reservations
mov edx, esi mov edx, esi
shl edx, BSF sizeof.TASKDATA shl edx, BSF sizeof.APPDATA
add edx, TASK_TABLE mov edx, [edx + SLOT_BASE + APPDATA.tid]
mov edx, [edx+TASKDATA.pid]
rmpr0: rmpr0:
@ -717,7 +715,7 @@ destroy_thread:
mov [edi+TASK_TABLE + TASKDATA.state], TSTATE_FREE mov [edi+TASK_TABLE + TASKDATA.state], TSTATE_FREE
; debugger test - terminate all debuggees ; debugger test - terminate all debuggees
mov eax, 2 mov eax, 2
mov ecx, SLOT_BASE+2*0x100+APPDATA.debugger_slot mov ecx, SLOT_BASE+2*sizeof.APPDATA + APPDATA.debugger_slot
.xd0: .xd0:
cmp eax, [thread_count] cmp eax, [thread_count]
ja .xd1 ja .xd1
@ -731,7 +729,7 @@ destroy_thread:
popad popad
@@: @@:
inc eax inc eax
add ecx, 0x100 add ecx, sizeof.APPDATA
jmp .xd0 jmp .xd0
.xd1: .xd1:
;release slot ;release slot

View File

@ -476,8 +476,6 @@ align 4
get_pid: get_pid:
mov eax, [current_slot] mov eax, [current_slot]
mov eax, [eax+APPDATA.tid] mov eax, [eax+APPDATA.tid]
mov eax, [TASK_BASE] ; delete
mov eax, [eax+TASKDATA.pid] ;
ret ret
pid_to_slot: pid_to_slot:
@ -502,12 +500,10 @@ pid_to_slot:
;ebx = maximum permitted offset ;ebx = maximum permitted offset
cmp [TASK_TABLE+ecx+TASKDATA.state], TSTATE_FREE cmp [TASK_TABLE+ecx+TASKDATA.state], TSTATE_FREE
jz .endloop ;skip empty slots 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 ;cmp [ecx+SLOT_BASE+APPDATA.state], TSTATE_FREE
;jz .endloop ;skip empty slots ;jz .endloop ;skip empty slots
;cmp [ecx+SLOT_BASE+APPDATA.pid], eax;check PID cmp [ecx*8 + SLOT_BASE + APPDATA.tid], eax;check PID
;jz .pid_found jz .pid_found
.endloop: .endloop:
add ecx, sizeof.TASKDATA add ecx, sizeof.TASKDATA
;add ecx, sizeof.APPDATA ;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 ; 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_wstate], WSTATE_NORMAL
mov [ebx+window_data+WDATA.fl_redraw], 1 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 ;set draw data to full screen
xor eax, eax xor eax, eax

View File

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

View File

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

View File

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

View File

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

View File

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