[KERNEL] #3 Preparing to merge legacy TASKDATA into APPDATA:

- get rid of CURRENT_TASK
- to APPDATA added new fields which will be used instead of TASKDATA's
- other small fixes

git-svn-id: svn://kolibrios.org@8869 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Rustem Gimadutdinov (rgimad) 2021-06-17 09:41:16 +00:00
parent 41386908d7
commit 2359531a17
20 changed files with 143 additions and 137 deletions

View File

@ -220,7 +220,7 @@ OS_BASE = 0x80000000
window_data = OS_BASE + 0x0001000
TASK_TABLE = OS_BASE + 0x0003000
CURRENT_TASK = OS_BASE + 0x0003000
;CURRENT_TASK = OS_BASE + 0x0003000
;TASK_COUNT = OS_BASE + 0x0003004
TASK_BASE = OS_BASE + 0x0003010
TASK_DATA = OS_BASE + 0x0003020
@ -276,7 +276,7 @@ LFB_BASE = 0xFE000000
new_app_base = 0;
twdw = CURRENT_TASK - window_data
twdw = TASK_TABLE - window_data
std_application_base_address = new_app_base
RING0_STACK_SIZE = 0x2000
@ -504,15 +504,17 @@ struct APPDATA
wait_test dd ? ;+96 +++
wait_param dd ? ;+100 +++
tls_base dd ? ;+104
dd ? ;+108
dd ? ;+112
event_mask dd ? ;+108 ; stores event types allowed for task
tid dd ? ;+112 ; thread id
draw_bgr_x dd ? ;+116
draw_bgr_y dd ? ;+120
dd ? ;+124
state db ? ;+124 ; thread state
db ? ;+125
dw ? ;+126
wnd_shape dd ? ;+128
wnd_shape_scale dd ? ;+132
dd ? ;+136
dd ? ;+140
mem_start dd ? ;+136 ;;
counter_sum dd ? ;+140 ;;
saved_box BOX ;+144
ipc_start dd ? ;+160
ipc_size dd ? ;+164
@ -529,7 +531,9 @@ struct APPDATA
wnd_clientbox BOX ;+216
priority dd ? ;+232
in_schedule LHEAD ;+236
rd 3 ;+244
counter_add dd ? ;+244 ;;
cpu_usage dd ? ;+248 ;;
dd ? ;+252
ends
assert sizeof.APPDATA = 256
@ -537,19 +541,20 @@ assert sizeof.APPDATA = 256
APP_OBJ_OFFSET = 48
APP_EV_OFFSET = 40
; Note: in future TASKDATA will be merged into APPDATA
struct TASKDATA
event_mask dd ? ; mask which stores event types allowed for task
pid dd ?
dw ?
state db ?
db ?
dw ?
wnd_number db ?
db ?
mem_start dd ?
counter_sum dd ?
counter_add dd ?
cpu_usage dd ?
event_mask dd ? ;+0 mask which stores event types allowed for task
pid dd ? ;+4
dw ? ;+8
state db ? ;+10
db ? ;+11
dw ? ;+12
wnd_number db ? ;+14
db ? ;+15
mem_start dd ? ;+16
counter_sum dd ? ;+20
counter_add dd ? ;+24
cpu_usage dd ? ;+28
ends
TSTATE_RUNNING = 0

View File

@ -48,7 +48,7 @@ get_debuggee_slot:
jz .ret_bad
shl eax, 5
push ebx
mov ebx, [CURRENT_TASK]
mov ebx, [current_slot_idx]
cmp [SLOT_BASE+eax*8+APPDATA.debugger_slot], ebx
pop ebx
jnz .ret_bad
@ -92,14 +92,14 @@ debug_suspend:
call get_debuggee_slot
jc .ret
; } End patch
mov cl, [CURRENT_TASK+eax+TASKDATA.state] ; process state
mov cl, [TASK_TABLE+eax+TASKDATA.state] ; process state
test cl, cl
jz .1
cmp cl, 5
jnz .ret
mov cl, 2
.2:
mov [CURRENT_TASK+eax+TASKDATA.state], cl
mov [TASK_TABLE+eax+TASKDATA.state], cl
.ret:
sti
ret
@ -108,14 +108,14 @@ debug_suspend:
jmp .2
do_resume:
mov cl, [CURRENT_TASK+eax+TASKDATA.state]
mov cl, [TASK_TABLE+eax+TASKDATA.state]
cmp cl, 1
jz .1
cmp cl, 2
jnz .ret
mov cl, 5
.2:
mov [CURRENT_TASK+eax+TASKDATA.state], cl
mov [TASK_TABLE+eax+TASKDATA.state], cl
.ret:
ret
.1:
@ -416,7 +416,7 @@ debugger_notify:
pop ecx
pop ecx
pop ecx
cmp dword [CURRENT_TASK], 1
cmp dword [current_slot_idx], 1
jnz .notos
cmp [timer_ticks], edi
jae .ret

View File

@ -354,7 +354,7 @@ endp
align 4
proc get_curr_task
mov eax, [CURRENT_TASK]
mov eax, [current_slot_idx]
shl eax, 8
ret
endp
@ -1211,9 +1211,9 @@ proc load_library stdcall, file_name:dword, encoding:dword
call malloc
test eax, eax
jz .fail_and_free_user
mov ebx, [CURRENT_TASK]
mov ebx, [current_slot_idx]
shl ebx, 5
mov edx, [CURRENT_TASK+ebx+TASKDATA.pid]
mov edx, [TASK_TABLE+ebx+TASKDATA.pid]
mov [eax+HDLL.pid], edx
push eax
call init_dlls_in_thread

View File

@ -168,7 +168,7 @@ fpu_save:
mov edi, eax
mov ecx, [fpu_owner]
mov esi, [CURRENT_TASK]
mov esi, [current_slot_idx]
cmp ecx, esi
jne .save
@ -216,7 +216,7 @@ avx_save:
mov edi, eax
mov ecx, [fpu_owner]
mov esi, [CURRENT_TASK]
mov esi, [current_slot_idx]
cmp ecx, esi
jne .save
@ -276,7 +276,7 @@ fpu_restore:
cli
mov ecx, [fpu_owner]
mov eax, [CURRENT_TASK]
mov eax, [current_slot_idx]
cmp ecx, eax
jne .copy
@ -318,7 +318,7 @@ avx_restore:
cli
mov ecx, [fpu_owner]
mov eax, [CURRENT_TASK]
mov eax, [current_slot_idx]
cmp ecx, eax
jne .copy
@ -372,7 +372,7 @@ except_7: ;#NM exception handler
mov es, ax
mov ebx, [fpu_owner]
cmp ebx, [CURRENT_TASK]
cmp ebx, [current_slot_idx]
je .exit
shl ebx, 8
@ -383,7 +383,7 @@ except_7: ;#NM exception handler
mov eax, [xsave_eax]
mov edx, [xsave_edx]
xsave [ecx]
mov ebx, [CURRENT_TASK]
mov ebx, [current_slot_idx]
mov [fpu_owner], ebx
shl ebx, 8
mov ecx, [ebx+SLOT_BASE+APPDATA.fpu_state]
@ -396,7 +396,7 @@ except_7: ;#NM exception handler
jnc .no_SSE
fxsave [eax]
mov ebx, [CURRENT_TASK]
mov ebx, [current_slot_idx]
mov [fpu_owner], ebx
shl ebx, 8
mov eax, [ebx+SLOT_BASE+APPDATA.fpu_state]
@ -406,7 +406,7 @@ except_7: ;#NM exception handler
.no_SSE:
fnsave [eax]
mov ebx, [CURRENT_TASK]
mov ebx, [current_slot_idx]
mov [fpu_owner], ebx
shl ebx, 8
mov eax, [ebx+SLOT_BASE+APPDATA.fpu_state]

View File

@ -1396,9 +1396,9 @@ align 4
mov edx, E_ACCESS
ja .fail
mov ebx, [CURRENT_TASK]
shl ebx, 5
mov ebx, [CURRENT_TASK + ebx + 4]
mov ebx, [current_slot_idx]
shl ebx, BSF sizeof.TASKDATA
mov ebx, [TASK_TABLE + ebx + TASKDATA.pid]
mov eax, sizeof.SMAP
call create_kernel_object

View File

@ -93,7 +93,7 @@ do_change_task:
;param:
; ebx = address of the APPDATA for incoming task (new)
;warning:
; [CURRENT_TASK] and [TASK_BASE] must be changed before (e.g. in find_next_task)
; [current_slot_idx] and [TASK_BASE] must be changed before (e.g. in find_next_task)
; [current_slot] is the outcoming (old), and set here to a new value (ebx)
;scratched: eax,ecx,esi
mov esi, ebx
@ -140,7 +140,7 @@ do_change_task:
mov eax, [xsave_eax]
mov edx, [xsave_edx]
xsave [ecx]
mov ecx, [CURRENT_TASK]
mov ecx, [current_slot_idx]
mov [fpu_owner], ecx
mov ecx, [current_slot]
mov ecx, [ecx+APPDATA.fpu_state]
@ -261,7 +261,7 @@ SCHEDULE_HIGHER_PRIORITY = 1
; edi = address of the TASKDATA for the selected task
; ZF = 1 if the task is the same
;warning:
; [CURRENT_TASK] = bh , [TASK_BASE] = edi -- as result
; [current_slot_idx] = bh , [TASK_BASE] = edi -- as result
; [current_slot] is not set to new value (ebx)!!!
;scratched: eax,ecx
proc find_next_task
@ -288,7 +288,7 @@ proc find_next_task
mov ebx, [ebx+APPDATA.in_schedule.next]
mov edi, ebx
shr edi, 3
add edi, CURRENT_TASK - (SLOT_BASE shr 3)
add edi, TASK_TABLE - (SLOT_BASE shr 3)
mov al, [edi+TASKDATA.state]
test al, al
jz .task_found ; state == 0
@ -328,7 +328,7 @@ proc find_next_task
.found:
; the line below assumes APPDATA is 256 bytes long and SLOT_BASE is
; aligned on 0x10000
mov [CURRENT_TASK], bh
mov byte [current_slot_idx], bh
mov [TASK_BASE], edi
rdtsc ;call _rdtsc
mov [edi+TASKDATA.counter_add], eax; for next using update_counters

View File

@ -342,9 +342,9 @@ lock_application_table:
mov ecx, application_table_mutex
call mutex_lock
mov eax, [CURRENT_TASK]
shl eax, 5
add eax, CURRENT_TASK+TASKDATA.pid
mov eax, [current_slot_idx]
shl eax, BSF sizeof.TASKDATA
add eax, TASK_TABLE+TASKDATA.pid
mov eax, [eax]
mov [application_table_owner], eax
@ -418,8 +418,8 @@ destroy_thread:
test edx, edx
jnz @F
pop esi
shl esi, 5
mov [CURRENT_TASK+esi+TASKDATA.state], 9
shl esi, BSF sizeof.TASKDATA
mov [TASK_TABLE+esi+TASKDATA.state], 9
ret
@@:
push edx ;save .process
@ -506,8 +506,8 @@ destroy_thread:
jb .loop
; get process PID
mov eax, esi
shl eax, 5
mov eax, [eax+CURRENT_TASK+TASKDATA.pid]
shl eax, BSF sizeof.TASKDATA
mov eax, [eax+TASK_TABLE+TASKDATA.pid]
; compare current lock input with process PID
cmp eax, [PID_lock_input]
jne @f
@ -578,12 +578,12 @@ destroy_thread:
; debuggee test
pushad
mov edi, esi
shl edi, 5
shl edi, BSF sizeof.TASKDATA
mov eax, [SLOT_BASE+edi*8+APPDATA.debugger_slot]
test eax, eax
jz .nodebug
movi ecx, 8
push dword [CURRENT_TASK+edi+TASKDATA.pid]; PID
push dword [TASK_TABLE+edi+TASKDATA.pid]; PID
push 2
call debugger_notify
pop ecx
@ -638,8 +638,8 @@ destroy_thread:
jbe .nothing_to_activate
lea esi, [WIN_POS+eax*2]
movzx edi, word [esi] ; edi = process
shl edi, 5
cmp [CURRENT_TASK + edi + TASKDATA.state], byte 9 ; skip dead slots
shl edi, BSF sizeof.TASKDATA
cmp [TASK_TABLE + edi + TASKDATA.state], byte 9 ; skip dead slots
je .check_next_window
add edi, window_data
; \begin{diamond}[19.09.2006]
@ -653,8 +653,8 @@ destroy_thread:
.dont_activate:
push esi ; remove hd1 & cd & flp reservation
shl esi, 5
mov esi, [esi+CURRENT_TASK+TASKDATA.pid]
shl esi, BSF sizeof.TASKDATA
mov esi, [esi+TASK_TABLE+TASKDATA.pid]
cmp [cd_status], esi
jnz @f
call free_cd_channel
@ -669,8 +669,8 @@ destroy_thread:
pusha ; remove all port reservations
mov edx, esi
shl edx, 5
add edx, CURRENT_TASK
shl edx, BSF sizeof.TASKDATA
add edx, TASK_TABLE
mov edx, [edx+TASKDATA.pid]
rmpr0:
@ -713,8 +713,8 @@ destroy_thread:
popa
mov edi, esi ; do not run this process slot
shl edi, 5
mov [edi+CURRENT_TASK + TASKDATA.state], byte 9
shl edi, BSF sizeof.TASKDATA
mov [edi+TASK_TABLE + TASKDATA.state], byte 9
; debugger test - terminate all debuggees
mov eax, 2
mov ecx, SLOT_BASE+2*0x100+APPDATA.debugger_slot

View File

@ -494,7 +494,7 @@ pid_to_slot:
;ecx = offset of current process info entry
;ebx = maximum permitted offset
; state 9 means "not used"
cmp byte [TASK_TABLE+ecx+TASKDATA.state], 9
cmp byte [TASK_TABLE+ecx+TASKDATA.state], TSTATE_FREE
jz .endloop ;skip empty slots
cmp [TASK_TABLE+ecx+TASKDATA.pid], eax;check PID
jz .pid_found
@ -970,7 +970,7 @@ proc set_app_params stdcall,slot:dword, params:dword, flags:dword
rep movsd
shr ebx, 3
mov dword [CURRENT_TASK+ebx+0x10], 0
mov dword [TASK_TABLE+ebx+TASKDATA.mem_start], 0
mov ebx, [slot]
mov eax, ebx
@ -980,7 +980,7 @@ 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, CURRENT_TASK ;ebx - pointer to information about process
add ebx, TASK_TABLE ;ebx - pointer to information about process
mov [ebx+TASKDATA.wnd_number], al;set window number on screen = process slot
mov [ebx+TASKDATA.event_mask], dword 1+2+4;set default event flags (see 40 function)
@ -1039,10 +1039,10 @@ proc set_app_params stdcall,slot:dword, params:dword, flags:dword
; set if debuggee
test byte [flags], 1
jz .no_debug
mov eax, [CURRENT_TASK]
mov eax, [current_slot_idx]
mov [SLOT_BASE+ebx*8+APPDATA.debugger_slot], eax
.no_debug:
mov [CURRENT_TASK+ebx+TASKDATA.state], dl
mov [TASK_TABLE+ebx+TASKDATA.state], dl
lea edx, [SLOT_BASE+ebx*8]
call scheduler_add_thread
ret

View File

@ -49,7 +49,7 @@ endg
; This internal function acquires the lock for the global list.
lock_timer_list:
mov edx, [CURRENT_TASK]
mov edx, [current_slot_idx]
@@:
xor eax, eax
lock cmpxchg [timer_list_owner], edx

View File

@ -827,7 +827,7 @@ v86_irq:
v86_irq2:
mov esi, [v86_irqhooks+edi*8] ; get VM handle
mov eax, [esi+V86_machine.process]
mov ecx, [CURRENT_TASK]
mov ecx, [current_slot_idx]
shl ecx, 8
cmp [SLOT_BASE+ecx+APPDATA.process], eax
jnz .notcurrent
@ -900,7 +900,7 @@ v86_irq2:
call update_counters
lea edi, [ebx + 0x100000000 - SLOT_BASE]
shr edi, 3
add edi, CURRENT_TASK
add edi, TASK_TABLE
call find_next_task.found
call do_change_task
popad

View File

@ -438,7 +438,8 @@ default_io_map dd ?
LFBSize dd ?
current_process dd ?
current_slot dd ? ; i.e. cureent thread
current_slot dd ? ; pointer to APPDATA of current thread
current_slot_idx dd ? ; index of current thread slot
thread_count dd ?
; device addresses

View File

@ -56,9 +56,9 @@ reserve_cd:
;-----------------------------------------------------------------------------
reserve_ok2:
push eax
mov eax, [CURRENT_TASK]
mov eax, [current_slot_idx]
shl eax, 5
mov eax, [eax+CURRENT_TASK+TASKDATA.pid]
mov eax, [eax+TASK_TABLE+TASKDATA.pid]
mov [cd_status], eax
pop eax
sti

View File

@ -75,7 +75,7 @@ syscall_button: ;////////////// system function 8 //////////////
add edi, eax
; NOTE: this code doesn't rely on SYS_BUTTON struct,
; please revise it, if you change something.
mov ax, [CURRENT_TASK]
mov ax, word [current_slot_idx]
stosw
mov ax, dx
stosw ; button id number: bits 0-15
@ -226,7 +226,7 @@ syscall_button: ;////////////// system function 8 //////////////
add esi, -sizeof.SYS_BUTTON
; does it belong to our process?
mov ax, [CURRENT_TASK]
mov ax, word [current_slot_idx]
cmp ax, [esi + SYS_BUTTON.pslot]
jne .next_button

View File

@ -389,7 +389,7 @@ get_event_queue:
;info:
; client testing function for get_event_ex
;warning:
; -don't use [TASK_BASE],[current_slot],[CURRENT_TASK] - it is not for your slot
; -don't use [TASK_BASE],[current_slot],[current_slot_idx] - it is not for your slot
; -may be assumed, that interrupt are disabled
; -it is not restriction for scratched registers
;param:
@ -410,7 +410,7 @@ get_event_alone:
;info:
; client testing function for wait_event
;warning:
; -don't use [TASK_BASE],[current_slot],[CURRENT_TASK] - it is not for your slot
; -don't use [TASK_BASE],[current_slot],[current_slot_idx] - it is not for your slot
; -may be assumed, that interrupt are disabled
; -it is not restriction for scratched registers
;param:
@ -502,16 +502,16 @@ get_event_for_app: ;; used from f10,f11,f23
;info:
; client testing function for applications (f10,f23)
;warning:
; -don't use [TASK_BASE],[current_slot],[CURRENT_TASK] - it is not for your slot
; -don't use [TASK_BASE],[current_slot],[current_slot_idx] - it is not for your slot
; -may be assumed, that interrupt are disabled
; -it is not restriction for scratched registers
;param:
; ebx - APPDATA address of testing slot
;retval:
; eax - event number (=0 => no events)
movzx edi, bh ; bh is assumed as [CURRENT_TASK]
movzx edi, bh ; bh is assumed as [current_slot_idx]
shl edi, 5
add edi, CURRENT_TASK ; edi is assumed as [TASK_BASE]
add edi, TASK_TABLE ; edi is assumed as [TASK_BASE]
mov ecx, [edi+TASKDATA.event_mask]
and ecx, 0x7FFFFFFF
;--------------------------------------

View File

@ -395,7 +395,7 @@ _noinside2:
shl eax, 4
add eax, edi
mov bx, [CURRENT_TASK]
mov bx, word [current_slot_idx]
mov [eax], bx
mov word [eax+2], 1 ; button id
xor ebx, ebx
@ -426,7 +426,7 @@ _noinside2:
shl eax, 4
add eax, edi
mov bx, [CURRENT_TASK]
mov bx, word [current_slot_idx]
mov [eax], bx
mov word [eax+2], -1 ; button id
xor ebx, ebx

View File

@ -59,7 +59,7 @@ syscall_draw_window: ;///// system function 0 /////////////////////////////////
; type IV & V - skinned window (resizable & not)
mov eax, [thread_count]
movzx eax, word[WIN_POS + eax * 2]
cmp eax, [CURRENT_TASK]
cmp eax, [current_slot_idx]
setz al
movzx eax, al
push eax
@ -312,7 +312,7 @@ syscall_move_window: ;///// system function 67 ////////////////////////////////
;------------------------------------------------------------------------------
;? <description>
;------------------------------------------------------------------------------
mov edi, [CURRENT_TASK]
mov edi, [current_slot_idx]
shl edi, 5
add edi, window_data
@ -367,7 +367,7 @@ align 4
;------------------------------------------------------------------------------
syscall_window_settings: ;///// system function 71 ////////////////////////////
;------------------------------------------------------------------------------
mov edi, [CURRENT_TASK]
mov edi, [current_slot_idx]
shl edi, 5
or [edi + window_data + WDATA.fl_wstyle], WSTYLE_HASCAPTION
cmp ebx, 2
@ -445,7 +445,7 @@ align 4
movzx edi, word[WIN_POS + esi * 2]
shl edi, 5 ;size of TASKDATA and WDATA = 32 bytes
cmp [CURRENT_TASK + edi + TASKDATA.state], TSTATE_FREE
cmp byte [TASK_TABLE + edi + TASKDATA.state], TSTATE_FREE
je .skip_window
add edi, window_data
@ -985,7 +985,7 @@ align 4
movzx edi, word[WIN_POS + eax * 2]
shl edi, 5
; it is a unused slot?
cmp dword [edi+CURRENT_TASK+TASKDATA.state], 9
cmp byte [edi+TASK_TABLE+TASKDATA.state], TSTATE_FREE
je @f
; it is a hidden thread?
lea esi, [edi*8+SLOT_BASE+APPDATA.app_name]
@ -1552,7 +1552,7 @@ window._.sys_set_window: ;/////////////////////////////////////////////////////
;------------------------------------------------------------------------------
;< edx = pointer to WDATA struct
;------------------------------------------------------------------------------
mov eax, [CURRENT_TASK]
mov eax, [current_slot_idx]
shl eax, 5
add eax, window_data
; save window colors
@ -1611,7 +1611,7 @@ align 4
pop edi ecx
mov esi, [CURRENT_TASK]
mov esi, [current_slot_idx]
movzx esi, word[WIN_STACK + esi * 2]
lea esi, [WIN_POS + esi * 2]
call waredraw
@ -2125,8 +2125,8 @@ align 4
ja .exit.no_redraw
movzx edx, word[esi]
shl edx, 5
cmp [CURRENT_TASK + edx + TASKDATA.state], TSTATE_FREE
shl edx, 5 ; size of TASKDATA and WDATA is 32 bytes
cmp byte [TASK_TABLE + edx + TASKDATA.state], TSTATE_FREE
je .next_window
mov eax, [edi + WDATA.box.top]
@ -2174,13 +2174,13 @@ window._.draw_window_caption: ;////////////////////////////////////////////////
xor eax, eax
mov edx, [thread_count]
movzx edx, word[WIN_POS + edx * 2]
cmp edx, [CURRENT_TASK]
cmp edx, [current_slot_idx]
jne @f
inc eax
;--------------------------------------
align 4
@@:
mov edx, [CURRENT_TASK]
mov edx, [current_slot_idx]
shl edx, 5
add edx, window_data
movzx ebx, [edx + WDATA.fl_wstyle]
@ -2216,7 +2216,7 @@ align 4
;--------------------------------------
align 4
.2:
mov edi, [CURRENT_TASK]
mov edi, [current_slot_idx]
shl edi, 5
test [edi + window_data + WDATA.fl_wstyle], WSTYLE_HASCAPTION
jz .exit
@ -2402,7 +2402,7 @@ align 4
movzx edi, word[WIN_POS + esi * 2]
shl edi, 5 ;size of TASKDATA and WDATA = 32 bytes
cmp [CURRENT_TASK + edi + TASKDATA.state], TSTATE_FREE
cmp byte [TASK_TABLE + edi + TASKDATA.state], TSTATE_FREE
je .skip_window
add edi, window_data

View File

@ -625,10 +625,10 @@ high_code:
xor ecx, ecx
call scheduler_add_thread
mov dword [CURRENT_TASK], 2
mov dword [current_slot_idx], 2
mov [thread_count], 2
mov dword [current_slot], SLOT_BASE + sizeof.APPDATA*2
mov dword [TASK_BASE], CURRENT_TASK + sizeof.TASKDATA*2
mov dword [TASK_BASE], TASK_TABLE + sizeof.TASKDATA*2
; Move other CPUs to deep sleep, if it is useful
uglobal
@ -1177,7 +1177,7 @@ proc setup_os_slot
mov eax, edx
shr eax, 3
add eax, CURRENT_TASK - (SLOT_BASE shr 3)
add eax, TASK_TABLE - (SLOT_BASE shr 3)
mov [eax+TASKDATA.wnd_number], dh
mov byte [eax+TASKDATA.pid], dh
@ -1600,7 +1600,7 @@ draw_num_text:
; add window start x & y
mov ecx, [TASK_BASE]
mov edi, [CURRENT_TASK]
mov edi, [current_slot_idx]
shl edi, 8
mov eax, [ecx-twdw+WDATA.box.left]
@ -1910,7 +1910,7 @@ dd .loadCursorUni
shl ebx, 16
mov bx, word [esi-twdw+WDATA.box.top]
sub eax, ebx
mov edi, [CURRENT_TASK]
mov edi, [current_slot_idx]
shl edi, 8
sub ax, word[edi+SLOT_BASE+APPDATA.wnd_clientbox.top]
rol eax, 16
@ -1968,7 +1968,7 @@ dd .loadCursorUni
.msz:
mov edi, [thread_count]
movzx edi, word [WIN_POS + edi*2]
cmp edi, [CURRENT_TASK]
cmp edi, [current_slot_idx]
jne @f
mov ax, [MOUSE_SCROLL_H]
shl eax, 16
@ -2217,17 +2217,17 @@ sysfn_terminate: ; 18.2 = TERMINATE
ja noprocessterminate
mov eax, [thread_count]
shl ecx, BSF sizeof.TASKDATA
mov edx, [ecx+CURRENT_TASK+TASKDATA.pid]
add ecx, CURRENT_TASK+TASKDATA.state
mov edx, [ecx+TASK_TABLE+TASKDATA.pid]
add ecx, TASK_TABLE+TASKDATA.state
cmp byte [ecx], TSTATE_FREE
jz noprocessterminate
push eax
lea eax, [(ecx-(CURRENT_TASK and 1FFFFFFFh)-TASKDATA.state)*8+SLOT_BASE]
lea eax, [(ecx-(TASK_TABLE and 1FFFFFFFh)-TASKDATA.state)*8+SLOT_BASE]
call is_kernel_thread
pop eax
jz noprocessterminate
push ecx edx
lea edx, [(ecx-(CURRENT_TASK and 1FFFFFFFh)-TASKDATA.state)*8+SLOT_BASE]
lea edx, [(ecx-(TASK_TABLE and 1FFFFFFFh)-TASKDATA.state)*8+SLOT_BASE]
call request_terminate
pop edx ecx
test eax, eax
@ -2353,7 +2353,7 @@ sysfn_zmodif:
cmp edx, -1
jne @f
mov edx, [CURRENT_TASK]
mov edx, [current_slot_idx]
@@:
cmp edx, [thread_count]
ja .fail
@ -2363,7 +2363,7 @@ sysfn_zmodif:
mov eax, edx
shl edx, 5
cmp [edx + CURRENT_TASK + TASKDATA.state], 9
cmp [edx + TASK_TABLE + TASKDATA.state], 9
je .fail
cmp ecx, 1
@ -2408,7 +2408,7 @@ sysfn_zmodif:
;------------------------------------------------------------------------------
sysfn_getidletime: ; 18.4 = GET IDLETIME
mov eax, [CURRENT_TASK+32+TASKDATA.cpu_usage]
mov eax, [TASK_TABLE+32+TASKDATA.cpu_usage]
mov [esp+32], eax
ret
;------------------------------------------------------------------------------
@ -2875,7 +2875,7 @@ align 4
;--------------------------------------
align 4
@@:
mov eax, [CURRENT_TASK]
mov eax, [current_slot_idx]
mov [bgrlockpid], eax
cmp [img_background], static_background_data
jz .nomem
@ -2923,7 +2923,7 @@ nosb6:
jnz nosb7
cmp [bgrlock], 0
jz .err
mov eax, [CURRENT_TASK]
mov eax, [current_slot_idx]
cmp [bgrlockpid], eax
jnz .err
mov eax, ecx
@ -3103,7 +3103,7 @@ align 4
sys_getkey:
mov [esp + 32], dword 1
; test main buffer
mov ebx, [CURRENT_TASK] ; TOP OF WINDOW STACK
mov ebx, [current_slot_idx] ; TOP OF WINDOW STACK
movzx ecx, word [WIN_STACK + ebx * 2]
mov edx, [thread_count]
cmp ecx, edx
@ -3158,7 +3158,7 @@ align 4
;------------------------------------------------------------------------------
align 4
sys_getbutton:
mov ebx, [CURRENT_TASK] ; TOP OF WINDOW STACK
mov ebx, [current_slot_idx] ; TOP OF WINDOW STACK
mov [esp + 32], dword 1
movzx ecx, word [WIN_STACK + ebx * 2]
mov edx, [thread_count] ; less than 256 processes
@ -3195,7 +3195,7 @@ sys_cpuusage:
cmp ecx, -1 ; who am I ?
jne .no_who_am_i
mov ecx, [CURRENT_TASK]
mov ecx, [current_slot_idx]
.no_who_am_i:
cmp ecx, max_processes
ja .nofillbuf
@ -3211,7 +3211,7 @@ sys_cpuusage:
shl ecx, 5
; +0: dword: memory usage
mov eax, [ecx+CURRENT_TASK+TASKDATA.cpu_usage]
mov eax, [ecx+TASK_TABLE+TASKDATA.cpu_usage]
mov [ebx], eax
; +10: 11 bytes: name of the process
push ecx
@ -3238,7 +3238,7 @@ sys_cpuusage:
stosd
; +30: PID/TID
mov eax, [ecx+CURRENT_TASK+TASKDATA.pid]
mov eax, [ecx+TASK_TABLE+TASKDATA.pid]
stosd
; window position and size
@ -3250,7 +3250,7 @@ sys_cpuusage:
movsd
; Process state (+50)
mov eax, dword [ecx+CURRENT_TASK+TASKDATA.state]
movzx eax, byte [ecx+TASK_TABLE+TASKDATA.state]
stosd
; Window client area box
@ -3265,7 +3265,7 @@ sys_cpuusage:
stosb
; Event mask (+71)
mov EAX, dword [ECX+CURRENT_TASK+TASKDATA.event_mask]
mov EAX, dword [ECX+TASK_TABLE+TASKDATA.event_mask]
stosd
; Keyboard mode (+75)
@ -3364,7 +3364,7 @@ sys_redrawstat:
cmp ebx, 1
jne no_widgets_away
; buttons away
mov ecx, [CURRENT_TASK]
mov ecx, [current_slot_idx]
sys_newba2:
mov edi, [BTN_ADDR]
cmp [edi], dword 0 ; empty button list ?
@ -3402,7 +3402,7 @@ sys_redrawstat:
jnz srl1
mov edx, [TASK_BASE] ; return whole screen draw area for this app
add edx, draw_data - CURRENT_TASK
add edx, draw_data - TASK_TABLE
mov [edx + RECT.left], 0
mov [edx + RECT.top], 0
mov eax, [_display.width]
@ -3565,7 +3565,7 @@ nocpustart:
mov [mouse_active], 0
xor edi, edi
mov ebx, CURRENT_TASK
mov ebx, TASK_TABLE
mov ecx, [thread_count]
movzx eax, word [WIN_POS + ecx*2] ; active window
@ -3707,7 +3707,7 @@ markz:
push ecx edx
cmp [edx+TASKDATA.state], TSTATE_FREE
jz .nokill
lea edx, [(edx-(CURRENT_TASK and 1FFFFFFFh))*8+SLOT_BASE]
lea edx, [(edx-(TASK_TABLE and 1FFFFFFFh))*8+SLOT_BASE]
cmp [edx+APPDATA.process], sys_proc
jz .nokill
call request_terminate
@ -4453,7 +4453,7 @@ sys_putimage_palette:
pop ecx
jz sys_putimage.exit
mov eax, [CURRENT_TASK]
mov eax, [current_slot_idx]
shl eax, 8
add dx, word [eax+SLOT_BASE+APPDATA.wnd_clientbox.top]
rol edx, 16
@ -5015,7 +5015,7 @@ sys_process_def:
cmp ebx, 7
jae .not_support ;if >=8 then or eax,-1
mov edi, [CURRENT_TASK]
mov edi, [current_slot_idx]
jmp dword [f66call+ebx*4]
.not_support:
@ -5112,9 +5112,9 @@ align 4
test eax, eax
jnz @f
; get current PID
mov eax, [CURRENT_TASK]
mov eax, [current_slot_idx]
shl eax, 5
mov eax, [eax+CURRENT_TASK+TASKDATA.pid]
mov eax, [eax+TASK_TABLE+TASKDATA.pid]
; set current PID for lock input
mov [PID_lock_input], eax
@@:
@ -5127,9 +5127,9 @@ align 4
test eax, eax
jz @f
; get current PID
mov ebx, [CURRENT_TASK]
mov ebx, [current_slot_idx]
shl ebx, 5
mov ebx, [ebx+CURRENT_TASK+TASKDATA.pid]
mov ebx, [ebx+TASK_TABLE+TASKDATA.pid]
; compare current lock input with current PID
cmp ebx, eax
jne @f

View File

@ -316,7 +316,7 @@ end virtual
lea edi, [edi+ebx*4]
mov ebx, [CURRENT_TASK]
mov ebx, [current_slot_idx]
; check for hardware cursor
cmp [_display.select_cursor], select_cursor
je .core_32.software_cursor
@ -410,7 +410,7 @@ align 4
lea ebx, [ebx+ebx*2]
lea edi, [LFB_BASE+edi+ebx]
mov ebx, [CURRENT_TASK]
mov ebx, [current_slot_idx]
align 4
.outer24:
@ -475,7 +475,7 @@ align 4
.core_16:
lea edi, [LFB_BASE+edi+ebx*2]
mov ebx, [CURRENT_TASK]
mov ebx, [current_slot_idx]
.outer16:
mov [esp+.extra_var1], edi

View File

@ -422,9 +422,9 @@ align 4
push esi
push edi
mov eax, [CURRENT_TASK]
mov eax, [current_slot_idx]
shl eax, 5
mov eax, [CURRENT_TASK+eax+4]
mov eax, [TASK_TABLE+eax+4]
mov ebx, [src]
mov ecx, [flags]
call create_cursor ;eax, ebx, ecx
@ -459,9 +459,9 @@ proc delete_cursor stdcall, hcursor:dword
cmp [esi+CURSOR.magic], 'CURS'
jne .fail
mov ebx, [CURRENT_TASK]
mov ebx, [current_slot_idx]
shl ebx, 5
mov ebx, [CURRENT_TASK+ebx+4]
mov ebx, [TASK_TABLE+ebx+4]
cmp ebx, [esi+CURSOR.pid]
jne .fail

View File

@ -272,7 +272,7 @@ end virtual
mov [putimg.real_sy_and_abs_cy], ecx
; get process number
mov ebx, [CURRENT_TASK]
mov ebx, [current_slot_idx]
cmp byte [_display.bits_per_pixel], 16
je put_image_end_16
@ -886,7 +886,7 @@ __sys_putpixel:
mov edx, [d_width_calc_area + ebx*4]
add edx, [_display.win_map]
movzx edx, byte [eax+edx]
cmp edx, [CURRENT_TASK]
cmp edx, [current_slot_idx]
jne .exit
.forced:
@ -1477,7 +1477,7 @@ end virtual
add edx, LFB_BASE
; get process number
mov ebx, [CURRENT_TASK] ; bl - process num
mov ebx, [current_slot_idx] ; bl - process num
mov esi, [drbar.real_sy]
mov eax, [drbar.color] ; BBGGRR00
rol eax, 8