forked from KolibriOS/kolibrios
[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:
parent
41386908d7
commit
2359531a17
@ -220,7 +220,7 @@ OS_BASE = 0x80000000
|
|||||||
window_data = OS_BASE + 0x0001000
|
window_data = OS_BASE + 0x0001000
|
||||||
|
|
||||||
TASK_TABLE = OS_BASE + 0x0003000
|
TASK_TABLE = OS_BASE + 0x0003000
|
||||||
CURRENT_TASK = OS_BASE + 0x0003000
|
;CURRENT_TASK = OS_BASE + 0x0003000
|
||||||
;TASK_COUNT = OS_BASE + 0x0003004
|
;TASK_COUNT = OS_BASE + 0x0003004
|
||||||
TASK_BASE = OS_BASE + 0x0003010
|
TASK_BASE = OS_BASE + 0x0003010
|
||||||
TASK_DATA = OS_BASE + 0x0003020
|
TASK_DATA = OS_BASE + 0x0003020
|
||||||
@ -276,7 +276,7 @@ LFB_BASE = 0xFE000000
|
|||||||
|
|
||||||
new_app_base = 0;
|
new_app_base = 0;
|
||||||
|
|
||||||
twdw = CURRENT_TASK - window_data
|
twdw = TASK_TABLE - window_data
|
||||||
|
|
||||||
std_application_base_address = new_app_base
|
std_application_base_address = new_app_base
|
||||||
RING0_STACK_SIZE = 0x2000
|
RING0_STACK_SIZE = 0x2000
|
||||||
@ -504,15 +504,17 @@ struct APPDATA
|
|||||||
wait_test dd ? ;+96 +++
|
wait_test dd ? ;+96 +++
|
||||||
wait_param dd ? ;+100 +++
|
wait_param dd ? ;+100 +++
|
||||||
tls_base dd ? ;+104
|
tls_base dd ? ;+104
|
||||||
dd ? ;+108
|
event_mask dd ? ;+108 ; stores event types allowed for task
|
||||||
dd ? ;+112
|
tid dd ? ;+112 ; thread id
|
||||||
draw_bgr_x dd ? ;+116
|
draw_bgr_x dd ? ;+116
|
||||||
draw_bgr_y dd ? ;+120
|
draw_bgr_y dd ? ;+120
|
||||||
dd ? ;+124
|
state db ? ;+124 ; thread state
|
||||||
|
db ? ;+125
|
||||||
|
dw ? ;+126
|
||||||
wnd_shape dd ? ;+128
|
wnd_shape dd ? ;+128
|
||||||
wnd_shape_scale dd ? ;+132
|
wnd_shape_scale dd ? ;+132
|
||||||
dd ? ;+136
|
mem_start dd ? ;+136 ;;
|
||||||
dd ? ;+140
|
counter_sum dd ? ;+140 ;;
|
||||||
saved_box BOX ;+144
|
saved_box BOX ;+144
|
||||||
ipc_start dd ? ;+160
|
ipc_start dd ? ;+160
|
||||||
ipc_size dd ? ;+164
|
ipc_size dd ? ;+164
|
||||||
@ -529,7 +531,9 @@ struct APPDATA
|
|||||||
wnd_clientbox BOX ;+216
|
wnd_clientbox BOX ;+216
|
||||||
priority dd ? ;+232
|
priority dd ? ;+232
|
||||||
in_schedule LHEAD ;+236
|
in_schedule LHEAD ;+236
|
||||||
rd 3 ;+244
|
counter_add dd ? ;+244 ;;
|
||||||
|
cpu_usage dd ? ;+248 ;;
|
||||||
|
dd ? ;+252
|
||||||
ends
|
ends
|
||||||
|
|
||||||
assert sizeof.APPDATA = 256
|
assert sizeof.APPDATA = 256
|
||||||
@ -537,19 +541,20 @@ assert sizeof.APPDATA = 256
|
|||||||
APP_OBJ_OFFSET = 48
|
APP_OBJ_OFFSET = 48
|
||||||
APP_EV_OFFSET = 40
|
APP_EV_OFFSET = 40
|
||||||
|
|
||||||
|
; Note: in future TASKDATA will be merged into APPDATA
|
||||||
struct TASKDATA
|
struct TASKDATA
|
||||||
event_mask dd ? ; mask which stores event types allowed for task
|
event_mask dd ? ;+0 mask which stores event types allowed for task
|
||||||
pid dd ?
|
pid dd ? ;+4
|
||||||
dw ?
|
dw ? ;+8
|
||||||
state db ?
|
state db ? ;+10
|
||||||
db ?
|
db ? ;+11
|
||||||
dw ?
|
dw ? ;+12
|
||||||
wnd_number db ?
|
wnd_number db ? ;+14
|
||||||
db ?
|
db ? ;+15
|
||||||
mem_start dd ?
|
mem_start dd ? ;+16
|
||||||
counter_sum dd ?
|
counter_sum dd ? ;+20
|
||||||
counter_add dd ?
|
counter_add dd ? ;+24
|
||||||
cpu_usage dd ?
|
cpu_usage dd ? ;+28
|
||||||
ends
|
ends
|
||||||
|
|
||||||
TSTATE_RUNNING = 0
|
TSTATE_RUNNING = 0
|
||||||
|
@ -48,7 +48,7 @@ get_debuggee_slot:
|
|||||||
jz .ret_bad
|
jz .ret_bad
|
||||||
shl eax, 5
|
shl eax, 5
|
||||||
push ebx
|
push ebx
|
||||||
mov ebx, [CURRENT_TASK]
|
mov ebx, [current_slot_idx]
|
||||||
cmp [SLOT_BASE+eax*8+APPDATA.debugger_slot], ebx
|
cmp [SLOT_BASE+eax*8+APPDATA.debugger_slot], ebx
|
||||||
pop ebx
|
pop ebx
|
||||||
jnz .ret_bad
|
jnz .ret_bad
|
||||||
@ -92,14 +92,14 @@ debug_suspend:
|
|||||||
call get_debuggee_slot
|
call get_debuggee_slot
|
||||||
jc .ret
|
jc .ret
|
||||||
; } End patch
|
; } End patch
|
||||||
mov cl, [CURRENT_TASK+eax+TASKDATA.state] ; process state
|
mov cl, [TASK_TABLE+eax+TASKDATA.state] ; process state
|
||||||
test cl, cl
|
test cl, cl
|
||||||
jz .1
|
jz .1
|
||||||
cmp cl, 5
|
cmp cl, 5
|
||||||
jnz .ret
|
jnz .ret
|
||||||
mov cl, 2
|
mov cl, 2
|
||||||
.2:
|
.2:
|
||||||
mov [CURRENT_TASK+eax+TASKDATA.state], cl
|
mov [TASK_TABLE+eax+TASKDATA.state], cl
|
||||||
.ret:
|
.ret:
|
||||||
sti
|
sti
|
||||||
ret
|
ret
|
||||||
@ -108,14 +108,14 @@ debug_suspend:
|
|||||||
jmp .2
|
jmp .2
|
||||||
|
|
||||||
do_resume:
|
do_resume:
|
||||||
mov cl, [CURRENT_TASK+eax+TASKDATA.state]
|
mov cl, [TASK_TABLE+eax+TASKDATA.state]
|
||||||
cmp cl, 1
|
cmp cl, 1
|
||||||
jz .1
|
jz .1
|
||||||
cmp cl, 2
|
cmp cl, 2
|
||||||
jnz .ret
|
jnz .ret
|
||||||
mov cl, 5
|
mov cl, 5
|
||||||
.2:
|
.2:
|
||||||
mov [CURRENT_TASK+eax+TASKDATA.state], cl
|
mov [TASK_TABLE+eax+TASKDATA.state], cl
|
||||||
.ret:
|
.ret:
|
||||||
ret
|
ret
|
||||||
.1:
|
.1:
|
||||||
@ -416,7 +416,7 @@ debugger_notify:
|
|||||||
pop ecx
|
pop ecx
|
||||||
pop ecx
|
pop ecx
|
||||||
pop ecx
|
pop ecx
|
||||||
cmp dword [CURRENT_TASK], 1
|
cmp dword [current_slot_idx], 1
|
||||||
jnz .notos
|
jnz .notos
|
||||||
cmp [timer_ticks], edi
|
cmp [timer_ticks], edi
|
||||||
jae .ret
|
jae .ret
|
||||||
|
@ -354,7 +354,7 @@ endp
|
|||||||
|
|
||||||
align 4
|
align 4
|
||||||
proc get_curr_task
|
proc get_curr_task
|
||||||
mov eax, [CURRENT_TASK]
|
mov eax, [current_slot_idx]
|
||||||
shl eax, 8
|
shl eax, 8
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
@ -1211,9 +1211,9 @@ proc load_library stdcall, file_name:dword, encoding:dword
|
|||||||
call malloc
|
call malloc
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .fail_and_free_user
|
jz .fail_and_free_user
|
||||||
mov ebx, [CURRENT_TASK]
|
mov ebx, [current_slot_idx]
|
||||||
shl ebx, 5
|
shl ebx, 5
|
||||||
mov edx, [CURRENT_TASK+ebx+TASKDATA.pid]
|
mov edx, [TASK_TABLE+ebx+TASKDATA.pid]
|
||||||
mov [eax+HDLL.pid], edx
|
mov [eax+HDLL.pid], edx
|
||||||
push eax
|
push eax
|
||||||
call init_dlls_in_thread
|
call init_dlls_in_thread
|
||||||
|
@ -168,7 +168,7 @@ fpu_save:
|
|||||||
mov edi, eax
|
mov edi, eax
|
||||||
|
|
||||||
mov ecx, [fpu_owner]
|
mov ecx, [fpu_owner]
|
||||||
mov esi, [CURRENT_TASK]
|
mov esi, [current_slot_idx]
|
||||||
cmp ecx, esi
|
cmp ecx, esi
|
||||||
jne .save
|
jne .save
|
||||||
|
|
||||||
@ -216,7 +216,7 @@ avx_save:
|
|||||||
mov edi, eax
|
mov edi, eax
|
||||||
|
|
||||||
mov ecx, [fpu_owner]
|
mov ecx, [fpu_owner]
|
||||||
mov esi, [CURRENT_TASK]
|
mov esi, [current_slot_idx]
|
||||||
cmp ecx, esi
|
cmp ecx, esi
|
||||||
jne .save
|
jne .save
|
||||||
|
|
||||||
@ -276,7 +276,7 @@ fpu_restore:
|
|||||||
cli
|
cli
|
||||||
|
|
||||||
mov ecx, [fpu_owner]
|
mov ecx, [fpu_owner]
|
||||||
mov eax, [CURRENT_TASK]
|
mov eax, [current_slot_idx]
|
||||||
cmp ecx, eax
|
cmp ecx, eax
|
||||||
jne .copy
|
jne .copy
|
||||||
|
|
||||||
@ -318,7 +318,7 @@ avx_restore:
|
|||||||
cli
|
cli
|
||||||
|
|
||||||
mov ecx, [fpu_owner]
|
mov ecx, [fpu_owner]
|
||||||
mov eax, [CURRENT_TASK]
|
mov eax, [current_slot_idx]
|
||||||
cmp ecx, eax
|
cmp ecx, eax
|
||||||
jne .copy
|
jne .copy
|
||||||
|
|
||||||
@ -372,7 +372,7 @@ except_7: ;#NM exception handler
|
|||||||
mov es, ax
|
mov es, ax
|
||||||
|
|
||||||
mov ebx, [fpu_owner]
|
mov ebx, [fpu_owner]
|
||||||
cmp ebx, [CURRENT_TASK]
|
cmp ebx, [current_slot_idx]
|
||||||
je .exit
|
je .exit
|
||||||
|
|
||||||
shl ebx, 8
|
shl ebx, 8
|
||||||
@ -383,7 +383,7 @@ except_7: ;#NM exception handler
|
|||||||
mov eax, [xsave_eax]
|
mov eax, [xsave_eax]
|
||||||
mov edx, [xsave_edx]
|
mov edx, [xsave_edx]
|
||||||
xsave [ecx]
|
xsave [ecx]
|
||||||
mov ebx, [CURRENT_TASK]
|
mov ebx, [current_slot_idx]
|
||||||
mov [fpu_owner], ebx
|
mov [fpu_owner], ebx
|
||||||
shl ebx, 8
|
shl ebx, 8
|
||||||
mov ecx, [ebx+SLOT_BASE+APPDATA.fpu_state]
|
mov ecx, [ebx+SLOT_BASE+APPDATA.fpu_state]
|
||||||
@ -396,7 +396,7 @@ except_7: ;#NM exception handler
|
|||||||
jnc .no_SSE
|
jnc .no_SSE
|
||||||
|
|
||||||
fxsave [eax]
|
fxsave [eax]
|
||||||
mov ebx, [CURRENT_TASK]
|
mov ebx, [current_slot_idx]
|
||||||
mov [fpu_owner], ebx
|
mov [fpu_owner], ebx
|
||||||
shl ebx, 8
|
shl ebx, 8
|
||||||
mov eax, [ebx+SLOT_BASE+APPDATA.fpu_state]
|
mov eax, [ebx+SLOT_BASE+APPDATA.fpu_state]
|
||||||
@ -406,7 +406,7 @@ except_7: ;#NM exception handler
|
|||||||
|
|
||||||
.no_SSE:
|
.no_SSE:
|
||||||
fnsave [eax]
|
fnsave [eax]
|
||||||
mov ebx, [CURRENT_TASK]
|
mov ebx, [current_slot_idx]
|
||||||
mov [fpu_owner], ebx
|
mov [fpu_owner], ebx
|
||||||
shl ebx, 8
|
shl ebx, 8
|
||||||
mov eax, [ebx+SLOT_BASE+APPDATA.fpu_state]
|
mov eax, [ebx+SLOT_BASE+APPDATA.fpu_state]
|
||||||
|
@ -1396,9 +1396,9 @@ align 4
|
|||||||
mov edx, E_ACCESS
|
mov edx, E_ACCESS
|
||||||
ja .fail
|
ja .fail
|
||||||
|
|
||||||
mov ebx, [CURRENT_TASK]
|
mov ebx, [current_slot_idx]
|
||||||
shl ebx, 5
|
shl ebx, BSF sizeof.TASKDATA
|
||||||
mov ebx, [CURRENT_TASK + ebx + 4]
|
mov ebx, [TASK_TABLE + ebx + TASKDATA.pid]
|
||||||
mov eax, sizeof.SMAP
|
mov eax, sizeof.SMAP
|
||||||
|
|
||||||
call create_kernel_object
|
call create_kernel_object
|
||||||
|
@ -93,7 +93,7 @@ do_change_task:
|
|||||||
;param:
|
;param:
|
||||||
; ebx = address of the APPDATA for incoming task (new)
|
; ebx = address of the APPDATA for incoming task (new)
|
||||||
;warning:
|
;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)
|
; [current_slot] is the outcoming (old), and set here to a new value (ebx)
|
||||||
;scratched: eax,ecx,esi
|
;scratched: eax,ecx,esi
|
||||||
mov esi, ebx
|
mov esi, ebx
|
||||||
@ -140,7 +140,7 @@ do_change_task:
|
|||||||
mov eax, [xsave_eax]
|
mov eax, [xsave_eax]
|
||||||
mov edx, [xsave_edx]
|
mov edx, [xsave_edx]
|
||||||
xsave [ecx]
|
xsave [ecx]
|
||||||
mov ecx, [CURRENT_TASK]
|
mov ecx, [current_slot_idx]
|
||||||
mov [fpu_owner], ecx
|
mov [fpu_owner], ecx
|
||||||
mov ecx, [current_slot]
|
mov ecx, [current_slot]
|
||||||
mov ecx, [ecx+APPDATA.fpu_state]
|
mov ecx, [ecx+APPDATA.fpu_state]
|
||||||
@ -261,7 +261,7 @@ SCHEDULE_HIGHER_PRIORITY = 1
|
|||||||
; edi = address of the TASKDATA for the selected task
|
; edi = address of the TASKDATA for the selected task
|
||||||
; ZF = 1 if the task is the same
|
; ZF = 1 if the task is the same
|
||||||
;warning:
|
;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)!!!
|
; [current_slot] is not set to new value (ebx)!!!
|
||||||
;scratched: eax,ecx
|
;scratched: eax,ecx
|
||||||
proc find_next_task
|
proc find_next_task
|
||||||
@ -288,7 +288,7 @@ proc find_next_task
|
|||||||
mov ebx, [ebx+APPDATA.in_schedule.next]
|
mov ebx, [ebx+APPDATA.in_schedule.next]
|
||||||
mov edi, ebx
|
mov edi, ebx
|
||||||
shr edi, 3
|
shr edi, 3
|
||||||
add edi, CURRENT_TASK - (SLOT_BASE shr 3)
|
add edi, TASK_TABLE - (SLOT_BASE shr 3)
|
||||||
mov al, [edi+TASKDATA.state]
|
mov al, [edi+TASKDATA.state]
|
||||||
test al, al
|
test al, al
|
||||||
jz .task_found ; state == 0
|
jz .task_found ; state == 0
|
||||||
@ -328,7 +328,7 @@ proc find_next_task
|
|||||||
.found:
|
.found:
|
||||||
; the line below assumes APPDATA is 256 bytes long and SLOT_BASE is
|
; the line below assumes APPDATA is 256 bytes long and SLOT_BASE is
|
||||||
; aligned on 0x10000
|
; aligned on 0x10000
|
||||||
mov [CURRENT_TASK], bh
|
mov byte [current_slot_idx], bh
|
||||||
mov [TASK_BASE], edi
|
mov [TASK_BASE], edi
|
||||||
rdtsc ;call _rdtsc
|
rdtsc ;call _rdtsc
|
||||||
mov [edi+TASKDATA.counter_add], eax; for next using update_counters
|
mov [edi+TASKDATA.counter_add], eax; for next using update_counters
|
||||||
|
@ -342,9 +342,9 @@ lock_application_table:
|
|||||||
mov ecx, application_table_mutex
|
mov ecx, application_table_mutex
|
||||||
call mutex_lock
|
call mutex_lock
|
||||||
|
|
||||||
mov eax, [CURRENT_TASK]
|
mov eax, [current_slot_idx]
|
||||||
shl eax, 5
|
shl eax, BSF sizeof.TASKDATA
|
||||||
add eax, CURRENT_TASK+TASKDATA.pid
|
add eax, TASK_TABLE+TASKDATA.pid
|
||||||
mov eax, [eax]
|
mov eax, [eax]
|
||||||
|
|
||||||
mov [application_table_owner], eax
|
mov [application_table_owner], eax
|
||||||
@ -418,8 +418,8 @@ destroy_thread:
|
|||||||
test edx, edx
|
test edx, edx
|
||||||
jnz @F
|
jnz @F
|
||||||
pop esi
|
pop esi
|
||||||
shl esi, 5
|
shl esi, BSF sizeof.TASKDATA
|
||||||
mov [CURRENT_TASK+esi+TASKDATA.state], 9
|
mov [TASK_TABLE+esi+TASKDATA.state], 9
|
||||||
ret
|
ret
|
||||||
@@:
|
@@:
|
||||||
push edx ;save .process
|
push edx ;save .process
|
||||||
@ -506,8 +506,8 @@ destroy_thread:
|
|||||||
jb .loop
|
jb .loop
|
||||||
; get process PID
|
; get process PID
|
||||||
mov eax, esi
|
mov eax, esi
|
||||||
shl eax, 5
|
shl eax, BSF sizeof.TASKDATA
|
||||||
mov eax, [eax+CURRENT_TASK+TASKDATA.pid]
|
mov eax, [eax+TASK_TABLE+TASKDATA.pid]
|
||||||
; 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 +578,12 @@ destroy_thread:
|
|||||||
; debuggee test
|
; debuggee test
|
||||||
pushad
|
pushad
|
||||||
mov edi, esi
|
mov edi, esi
|
||||||
shl edi, 5
|
shl edi, BSF sizeof.TASKDATA
|
||||||
mov eax, [SLOT_BASE+edi*8+APPDATA.debugger_slot]
|
mov eax, [SLOT_BASE+edi*8+APPDATA.debugger_slot]
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .nodebug
|
jz .nodebug
|
||||||
movi ecx, 8
|
movi ecx, 8
|
||||||
push dword [CURRENT_TASK+edi+TASKDATA.pid]; PID
|
push dword [TASK_TABLE+edi+TASKDATA.pid]; PID
|
||||||
push 2
|
push 2
|
||||||
call debugger_notify
|
call debugger_notify
|
||||||
pop ecx
|
pop ecx
|
||||||
@ -638,8 +638,8 @@ destroy_thread:
|
|||||||
jbe .nothing_to_activate
|
jbe .nothing_to_activate
|
||||||
lea esi, [WIN_POS+eax*2]
|
lea esi, [WIN_POS+eax*2]
|
||||||
movzx edi, word [esi] ; edi = process
|
movzx edi, word [esi] ; edi = process
|
||||||
shl edi, 5
|
shl edi, BSF sizeof.TASKDATA
|
||||||
cmp [CURRENT_TASK + edi + TASKDATA.state], byte 9 ; skip dead slots
|
cmp [TASK_TABLE + edi + TASKDATA.state], byte 9 ; skip dead slots
|
||||||
je .check_next_window
|
je .check_next_window
|
||||||
add edi, window_data
|
add edi, window_data
|
||||||
; \begin{diamond}[19.09.2006]
|
; \begin{diamond}[19.09.2006]
|
||||||
@ -653,8 +653,8 @@ destroy_thread:
|
|||||||
.dont_activate:
|
.dont_activate:
|
||||||
|
|
||||||
push esi ; remove hd1 & cd & flp reservation
|
push esi ; remove hd1 & cd & flp reservation
|
||||||
shl esi, 5
|
shl esi, BSF sizeof.TASKDATA
|
||||||
mov esi, [esi+CURRENT_TASK+TASKDATA.pid]
|
mov esi, [esi+TASK_TABLE+TASKDATA.pid]
|
||||||
cmp [cd_status], esi
|
cmp [cd_status], esi
|
||||||
jnz @f
|
jnz @f
|
||||||
call free_cd_channel
|
call free_cd_channel
|
||||||
@ -669,8 +669,8 @@ destroy_thread:
|
|||||||
|
|
||||||
pusha ; remove all port reservations
|
pusha ; remove all port reservations
|
||||||
mov edx, esi
|
mov edx, esi
|
||||||
shl edx, 5
|
shl edx, BSF sizeof.TASKDATA
|
||||||
add edx, CURRENT_TASK
|
add edx, TASK_TABLE
|
||||||
mov edx, [edx+TASKDATA.pid]
|
mov edx, [edx+TASKDATA.pid]
|
||||||
|
|
||||||
rmpr0:
|
rmpr0:
|
||||||
@ -713,8 +713,8 @@ destroy_thread:
|
|||||||
|
|
||||||
popa
|
popa
|
||||||
mov edi, esi ; do not run this process slot
|
mov edi, esi ; do not run this process slot
|
||||||
shl edi, 5
|
shl edi, BSF sizeof.TASKDATA
|
||||||
mov [edi+CURRENT_TASK + TASKDATA.state], byte 9
|
mov [edi+TASK_TABLE + TASKDATA.state], byte 9
|
||||||
; 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*0x100+APPDATA.debugger_slot
|
||||||
|
@ -494,7 +494,7 @@ pid_to_slot:
|
|||||||
;ecx = offset of current process info entry
|
;ecx = offset of current process info entry
|
||||||
;ebx = maximum permitted offset
|
;ebx = maximum permitted offset
|
||||||
; state 9 means "not used"
|
; 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
|
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
|
||||||
@ -970,7 +970,7 @@ proc set_app_params stdcall,slot:dword, params:dword, flags:dword
|
|||||||
rep movsd
|
rep movsd
|
||||||
|
|
||||||
shr ebx, 3
|
shr ebx, 3
|
||||||
mov dword [CURRENT_TASK+ebx+0x10], 0
|
mov dword [TASK_TABLE+ebx+TASKDATA.mem_start], 0
|
||||||
|
|
||||||
mov ebx, [slot]
|
mov ebx, [slot]
|
||||||
mov eax, ebx
|
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
|
; 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, 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.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)
|
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
|
; set if debuggee
|
||||||
test byte [flags], 1
|
test byte [flags], 1
|
||||||
jz .no_debug
|
jz .no_debug
|
||||||
mov eax, [CURRENT_TASK]
|
mov eax, [current_slot_idx]
|
||||||
mov [SLOT_BASE+ebx*8+APPDATA.debugger_slot], eax
|
mov [SLOT_BASE+ebx*8+APPDATA.debugger_slot], eax
|
||||||
.no_debug:
|
.no_debug:
|
||||||
mov [CURRENT_TASK+ebx+TASKDATA.state], dl
|
mov [TASK_TABLE+ebx+TASKDATA.state], dl
|
||||||
lea edx, [SLOT_BASE+ebx*8]
|
lea edx, [SLOT_BASE+ebx*8]
|
||||||
call scheduler_add_thread
|
call scheduler_add_thread
|
||||||
ret
|
ret
|
||||||
|
@ -49,7 +49,7 @@ endg
|
|||||||
|
|
||||||
; This internal function acquires the lock for the global list.
|
; This internal function acquires the lock for the global list.
|
||||||
lock_timer_list:
|
lock_timer_list:
|
||||||
mov edx, [CURRENT_TASK]
|
mov edx, [current_slot_idx]
|
||||||
@@:
|
@@:
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
lock cmpxchg [timer_list_owner], edx
|
lock cmpxchg [timer_list_owner], edx
|
||||||
|
@ -827,7 +827,7 @@ v86_irq:
|
|||||||
v86_irq2:
|
v86_irq2:
|
||||||
mov esi, [v86_irqhooks+edi*8] ; get VM handle
|
mov esi, [v86_irqhooks+edi*8] ; get VM handle
|
||||||
mov eax, [esi+V86_machine.process]
|
mov eax, [esi+V86_machine.process]
|
||||||
mov ecx, [CURRENT_TASK]
|
mov ecx, [current_slot_idx]
|
||||||
shl ecx, 8
|
shl ecx, 8
|
||||||
cmp [SLOT_BASE+ecx+APPDATA.process], eax
|
cmp [SLOT_BASE+ecx+APPDATA.process], eax
|
||||||
jnz .notcurrent
|
jnz .notcurrent
|
||||||
@ -900,7 +900,7 @@ v86_irq2:
|
|||||||
call update_counters
|
call update_counters
|
||||||
lea edi, [ebx + 0x100000000 - SLOT_BASE]
|
lea edi, [ebx + 0x100000000 - SLOT_BASE]
|
||||||
shr edi, 3
|
shr edi, 3
|
||||||
add edi, CURRENT_TASK
|
add edi, TASK_TABLE
|
||||||
call find_next_task.found
|
call find_next_task.found
|
||||||
call do_change_task
|
call do_change_task
|
||||||
popad
|
popad
|
||||||
|
@ -438,7 +438,8 @@ default_io_map dd ?
|
|||||||
LFBSize dd ?
|
LFBSize dd ?
|
||||||
|
|
||||||
current_process 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 ?
|
thread_count dd ?
|
||||||
|
|
||||||
; device addresses
|
; device addresses
|
||||||
|
@ -56,9 +56,9 @@ reserve_cd:
|
|||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
reserve_ok2:
|
reserve_ok2:
|
||||||
push eax
|
push eax
|
||||||
mov eax, [CURRENT_TASK]
|
mov eax, [current_slot_idx]
|
||||||
shl eax, 5
|
shl eax, 5
|
||||||
mov eax, [eax+CURRENT_TASK+TASKDATA.pid]
|
mov eax, [eax+TASK_TABLE+TASKDATA.pid]
|
||||||
mov [cd_status], eax
|
mov [cd_status], eax
|
||||||
pop eax
|
pop eax
|
||||||
sti
|
sti
|
||||||
|
@ -75,7 +75,7 @@ syscall_button: ;////////////// system function 8 //////////////
|
|||||||
add edi, eax
|
add edi, eax
|
||||||
; NOTE: this code doesn't rely on SYS_BUTTON struct,
|
; NOTE: this code doesn't rely on SYS_BUTTON struct,
|
||||||
; please revise it, if you change something.
|
; please revise it, if you change something.
|
||||||
mov ax, [CURRENT_TASK]
|
mov ax, word [current_slot_idx]
|
||||||
stosw
|
stosw
|
||||||
mov ax, dx
|
mov ax, dx
|
||||||
stosw ; button id number: bits 0-15
|
stosw ; button id number: bits 0-15
|
||||||
@ -226,7 +226,7 @@ syscall_button: ;////////////// system function 8 //////////////
|
|||||||
add esi, -sizeof.SYS_BUTTON
|
add esi, -sizeof.SYS_BUTTON
|
||||||
|
|
||||||
; does it belong to our process?
|
; does it belong to our process?
|
||||||
mov ax, [CURRENT_TASK]
|
mov ax, word [current_slot_idx]
|
||||||
cmp ax, [esi + SYS_BUTTON.pslot]
|
cmp ax, [esi + SYS_BUTTON.pslot]
|
||||||
jne .next_button
|
jne .next_button
|
||||||
|
|
||||||
|
@ -389,7 +389,7 @@ get_event_queue:
|
|||||||
;info:
|
;info:
|
||||||
; client testing function for get_event_ex
|
; client testing function for get_event_ex
|
||||||
;warning:
|
;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
|
; -may be assumed, that interrupt are disabled
|
||||||
; -it is not restriction for scratched registers
|
; -it is not restriction for scratched registers
|
||||||
;param:
|
;param:
|
||||||
@ -410,7 +410,7 @@ get_event_alone:
|
|||||||
;info:
|
;info:
|
||||||
; client testing function for wait_event
|
; client testing function for wait_event
|
||||||
;warning:
|
;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
|
; -may be assumed, that interrupt are disabled
|
||||||
; -it is not restriction for scratched registers
|
; -it is not restriction for scratched registers
|
||||||
;param:
|
;param:
|
||||||
@ -502,16 +502,16 @@ get_event_for_app: ;; used from f10,f11,f23
|
|||||||
;info:
|
;info:
|
||||||
; client testing function for applications (f10,f23)
|
; client testing function for applications (f10,f23)
|
||||||
;warning:
|
;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
|
; -may be assumed, that interrupt are disabled
|
||||||
; -it is not restriction for scratched registers
|
; -it is not restriction for scratched registers
|
||||||
;param:
|
;param:
|
||||||
; ebx - APPDATA address of testing slot
|
; ebx - APPDATA address of testing slot
|
||||||
;retval:
|
;retval:
|
||||||
; eax - event number (=0 => no events)
|
; 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
|
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]
|
mov ecx, [edi+TASKDATA.event_mask]
|
||||||
and ecx, 0x7FFFFFFF
|
and ecx, 0x7FFFFFFF
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
|
@ -395,7 +395,7 @@ _noinside2:
|
|||||||
shl eax, 4
|
shl eax, 4
|
||||||
add eax, edi
|
add eax, edi
|
||||||
|
|
||||||
mov bx, [CURRENT_TASK]
|
mov bx, word [current_slot_idx]
|
||||||
mov [eax], bx
|
mov [eax], bx
|
||||||
mov word [eax+2], 1 ; button id
|
mov word [eax+2], 1 ; button id
|
||||||
xor ebx, ebx
|
xor ebx, ebx
|
||||||
@ -426,7 +426,7 @@ _noinside2:
|
|||||||
shl eax, 4
|
shl eax, 4
|
||||||
add eax, edi
|
add eax, edi
|
||||||
|
|
||||||
mov bx, [CURRENT_TASK]
|
mov bx, word [current_slot_idx]
|
||||||
mov [eax], bx
|
mov [eax], bx
|
||||||
mov word [eax+2], -1 ; button id
|
mov word [eax+2], -1 ; button id
|
||||||
xor ebx, ebx
|
xor ebx, ebx
|
||||||
|
@ -59,7 +59,7 @@ syscall_draw_window: ;///// system function 0 /////////////////////////////////
|
|||||||
; type IV & V - skinned window (resizable & not)
|
; type IV & V - skinned window (resizable & not)
|
||||||
mov eax, [thread_count]
|
mov eax, [thread_count]
|
||||||
movzx eax, word[WIN_POS + eax * 2]
|
movzx eax, word[WIN_POS + eax * 2]
|
||||||
cmp eax, [CURRENT_TASK]
|
cmp eax, [current_slot_idx]
|
||||||
setz al
|
setz al
|
||||||
movzx eax, al
|
movzx eax, al
|
||||||
push eax
|
push eax
|
||||||
@ -312,7 +312,7 @@ syscall_move_window: ;///// system function 67 ////////////////////////////////
|
|||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
;? <description>
|
;? <description>
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
mov edi, [CURRENT_TASK]
|
mov edi, [current_slot_idx]
|
||||||
shl edi, 5
|
shl edi, 5
|
||||||
add edi, window_data
|
add edi, window_data
|
||||||
|
|
||||||
@ -367,7 +367,7 @@ align 4
|
|||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
syscall_window_settings: ;///// system function 71 ////////////////////////////
|
syscall_window_settings: ;///// system function 71 ////////////////////////////
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
mov edi, [CURRENT_TASK]
|
mov edi, [current_slot_idx]
|
||||||
shl edi, 5
|
shl edi, 5
|
||||||
or [edi + window_data + WDATA.fl_wstyle], WSTYLE_HASCAPTION
|
or [edi + window_data + WDATA.fl_wstyle], WSTYLE_HASCAPTION
|
||||||
cmp ebx, 2
|
cmp ebx, 2
|
||||||
@ -445,7 +445,7 @@ align 4
|
|||||||
movzx edi, word[WIN_POS + esi * 2]
|
movzx edi, word[WIN_POS + esi * 2]
|
||||||
shl edi, 5 ;size of TASKDATA and WDATA = 32 bytes
|
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
|
je .skip_window
|
||||||
|
|
||||||
add edi, window_data
|
add edi, window_data
|
||||||
@ -985,7 +985,7 @@ align 4
|
|||||||
movzx edi, word[WIN_POS + eax * 2]
|
movzx edi, word[WIN_POS + eax * 2]
|
||||||
shl edi, 5
|
shl edi, 5
|
||||||
; it is a unused slot?
|
; it is a unused slot?
|
||||||
cmp dword [edi+CURRENT_TASK+TASKDATA.state], 9
|
cmp byte [edi+TASK_TABLE+TASKDATA.state], TSTATE_FREE
|
||||||
je @f
|
je @f
|
||||||
; it is a hidden thread?
|
; it is a hidden thread?
|
||||||
lea esi, [edi*8+SLOT_BASE+APPDATA.app_name]
|
lea esi, [edi*8+SLOT_BASE+APPDATA.app_name]
|
||||||
@ -1552,7 +1552,7 @@ window._.sys_set_window: ;/////////////////////////////////////////////////////
|
|||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
;< edx = pointer to WDATA struct
|
;< edx = pointer to WDATA struct
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
mov eax, [CURRENT_TASK]
|
mov eax, [current_slot_idx]
|
||||||
shl eax, 5
|
shl eax, 5
|
||||||
add eax, window_data
|
add eax, window_data
|
||||||
; save window colors
|
; save window colors
|
||||||
@ -1611,7 +1611,7 @@ align 4
|
|||||||
|
|
||||||
pop edi ecx
|
pop edi ecx
|
||||||
|
|
||||||
mov esi, [CURRENT_TASK]
|
mov esi, [current_slot_idx]
|
||||||
movzx esi, word[WIN_STACK + esi * 2]
|
movzx esi, word[WIN_STACK + esi * 2]
|
||||||
lea esi, [WIN_POS + esi * 2]
|
lea esi, [WIN_POS + esi * 2]
|
||||||
call waredraw
|
call waredraw
|
||||||
@ -2125,8 +2125,8 @@ align 4
|
|||||||
ja .exit.no_redraw
|
ja .exit.no_redraw
|
||||||
|
|
||||||
movzx edx, word[esi]
|
movzx edx, word[esi]
|
||||||
shl edx, 5
|
shl edx, 5 ; size of TASKDATA and WDATA is 32 bytes
|
||||||
cmp [CURRENT_TASK + edx + TASKDATA.state], TSTATE_FREE
|
cmp byte [TASK_TABLE + edx + TASKDATA.state], TSTATE_FREE
|
||||||
je .next_window
|
je .next_window
|
||||||
|
|
||||||
mov eax, [edi + WDATA.box.top]
|
mov eax, [edi + WDATA.box.top]
|
||||||
@ -2174,13 +2174,13 @@ window._.draw_window_caption: ;////////////////////////////////////////////////
|
|||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov edx, [thread_count]
|
mov edx, [thread_count]
|
||||||
movzx edx, word[WIN_POS + edx * 2]
|
movzx edx, word[WIN_POS + edx * 2]
|
||||||
cmp edx, [CURRENT_TASK]
|
cmp edx, [current_slot_idx]
|
||||||
jne @f
|
jne @f
|
||||||
inc eax
|
inc eax
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
align 4
|
align 4
|
||||||
@@:
|
@@:
|
||||||
mov edx, [CURRENT_TASK]
|
mov edx, [current_slot_idx]
|
||||||
shl edx, 5
|
shl edx, 5
|
||||||
add edx, window_data
|
add edx, window_data
|
||||||
movzx ebx, [edx + WDATA.fl_wstyle]
|
movzx ebx, [edx + WDATA.fl_wstyle]
|
||||||
@ -2216,7 +2216,7 @@ align 4
|
|||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
align 4
|
align 4
|
||||||
.2:
|
.2:
|
||||||
mov edi, [CURRENT_TASK]
|
mov edi, [current_slot_idx]
|
||||||
shl edi, 5
|
shl edi, 5
|
||||||
test [edi + window_data + WDATA.fl_wstyle], WSTYLE_HASCAPTION
|
test [edi + window_data + WDATA.fl_wstyle], WSTYLE_HASCAPTION
|
||||||
jz .exit
|
jz .exit
|
||||||
@ -2402,7 +2402,7 @@ align 4
|
|||||||
movzx edi, word[WIN_POS + esi * 2]
|
movzx edi, word[WIN_POS + esi * 2]
|
||||||
shl edi, 5 ;size of TASKDATA and WDATA = 32 bytes
|
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
|
je .skip_window
|
||||||
|
|
||||||
add edi, window_data
|
add edi, window_data
|
||||||
|
@ -625,10 +625,10 @@ high_code:
|
|||||||
xor ecx, ecx
|
xor ecx, ecx
|
||||||
call scheduler_add_thread
|
call scheduler_add_thread
|
||||||
|
|
||||||
mov dword [CURRENT_TASK], 2
|
mov dword [current_slot_idx], 2
|
||||||
mov [thread_count], 2
|
mov [thread_count], 2
|
||||||
mov dword [current_slot], SLOT_BASE + sizeof.APPDATA*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
|
; Move other CPUs to deep sleep, if it is useful
|
||||||
uglobal
|
uglobal
|
||||||
@ -1177,7 +1177,7 @@ proc setup_os_slot
|
|||||||
|
|
||||||
mov eax, edx
|
mov eax, edx
|
||||||
shr eax, 3
|
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 [eax+TASKDATA.wnd_number], dh
|
||||||
mov byte [eax+TASKDATA.pid], dh
|
mov byte [eax+TASKDATA.pid], dh
|
||||||
|
|
||||||
@ -1600,7 +1600,7 @@ draw_num_text:
|
|||||||
; add window start x & y
|
; add window start x & y
|
||||||
mov ecx, [TASK_BASE]
|
mov ecx, [TASK_BASE]
|
||||||
|
|
||||||
mov edi, [CURRENT_TASK]
|
mov edi, [current_slot_idx]
|
||||||
shl edi, 8
|
shl edi, 8
|
||||||
|
|
||||||
mov eax, [ecx-twdw+WDATA.box.left]
|
mov eax, [ecx-twdw+WDATA.box.left]
|
||||||
@ -1910,7 +1910,7 @@ dd .loadCursorUni
|
|||||||
shl ebx, 16
|
shl ebx, 16
|
||||||
mov bx, word [esi-twdw+WDATA.box.top]
|
mov bx, word [esi-twdw+WDATA.box.top]
|
||||||
sub eax, ebx
|
sub eax, ebx
|
||||||
mov edi, [CURRENT_TASK]
|
mov edi, [current_slot_idx]
|
||||||
shl edi, 8
|
shl edi, 8
|
||||||
sub ax, word[edi+SLOT_BASE+APPDATA.wnd_clientbox.top]
|
sub ax, word[edi+SLOT_BASE+APPDATA.wnd_clientbox.top]
|
||||||
rol eax, 16
|
rol eax, 16
|
||||||
@ -1968,7 +1968,7 @@ dd .loadCursorUni
|
|||||||
.msz:
|
.msz:
|
||||||
mov edi, [thread_count]
|
mov edi, [thread_count]
|
||||||
movzx edi, word [WIN_POS + edi*2]
|
movzx edi, word [WIN_POS + edi*2]
|
||||||
cmp edi, [CURRENT_TASK]
|
cmp edi, [current_slot_idx]
|
||||||
jne @f
|
jne @f
|
||||||
mov ax, [MOUSE_SCROLL_H]
|
mov ax, [MOUSE_SCROLL_H]
|
||||||
shl eax, 16
|
shl eax, 16
|
||||||
@ -2217,17 +2217,17 @@ 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+CURRENT_TASK+TASKDATA.pid]
|
mov edx, [ecx+TASK_TABLE+TASKDATA.pid]
|
||||||
add ecx, CURRENT_TASK+TASKDATA.state
|
add ecx, TASK_TABLE+TASKDATA.state
|
||||||
cmp byte [ecx], TSTATE_FREE
|
cmp byte [ecx], TSTATE_FREE
|
||||||
jz noprocessterminate
|
jz noprocessterminate
|
||||||
push eax
|
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
|
call is_kernel_thread
|
||||||
pop eax
|
pop eax
|
||||||
jz noprocessterminate
|
jz noprocessterminate
|
||||||
push ecx edx
|
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
|
call request_terminate
|
||||||
pop edx ecx
|
pop edx ecx
|
||||||
test eax, eax
|
test eax, eax
|
||||||
@ -2353,7 +2353,7 @@ sysfn_zmodif:
|
|||||||
|
|
||||||
cmp edx, -1
|
cmp edx, -1
|
||||||
jne @f
|
jne @f
|
||||||
mov edx, [CURRENT_TASK]
|
mov edx, [current_slot_idx]
|
||||||
@@:
|
@@:
|
||||||
cmp edx, [thread_count]
|
cmp edx, [thread_count]
|
||||||
ja .fail
|
ja .fail
|
||||||
@ -2363,7 +2363,7 @@ sysfn_zmodif:
|
|||||||
mov eax, edx
|
mov eax, edx
|
||||||
shl edx, 5
|
shl edx, 5
|
||||||
|
|
||||||
cmp [edx + CURRENT_TASK + TASKDATA.state], 9
|
cmp [edx + TASK_TABLE + TASKDATA.state], 9
|
||||||
je .fail
|
je .fail
|
||||||
|
|
||||||
cmp ecx, 1
|
cmp ecx, 1
|
||||||
@ -2408,7 +2408,7 @@ sysfn_zmodif:
|
|||||||
|
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
sysfn_getidletime: ; 18.4 = GET IDLETIME
|
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
|
mov [esp+32], eax
|
||||||
ret
|
ret
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
@ -2875,7 +2875,7 @@ align 4
|
|||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
align 4
|
align 4
|
||||||
@@:
|
@@:
|
||||||
mov eax, [CURRENT_TASK]
|
mov eax, [current_slot_idx]
|
||||||
mov [bgrlockpid], eax
|
mov [bgrlockpid], eax
|
||||||
cmp [img_background], static_background_data
|
cmp [img_background], static_background_data
|
||||||
jz .nomem
|
jz .nomem
|
||||||
@ -2923,7 +2923,7 @@ nosb6:
|
|||||||
jnz nosb7
|
jnz nosb7
|
||||||
cmp [bgrlock], 0
|
cmp [bgrlock], 0
|
||||||
jz .err
|
jz .err
|
||||||
mov eax, [CURRENT_TASK]
|
mov eax, [current_slot_idx]
|
||||||
cmp [bgrlockpid], eax
|
cmp [bgrlockpid], eax
|
||||||
jnz .err
|
jnz .err
|
||||||
mov eax, ecx
|
mov eax, ecx
|
||||||
@ -3103,7 +3103,7 @@ align 4
|
|||||||
sys_getkey:
|
sys_getkey:
|
||||||
mov [esp + 32], dword 1
|
mov [esp + 32], dword 1
|
||||||
; test main buffer
|
; 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]
|
movzx ecx, word [WIN_STACK + ebx * 2]
|
||||||
mov edx, [thread_count]
|
mov edx, [thread_count]
|
||||||
cmp ecx, edx
|
cmp ecx, edx
|
||||||
@ -3158,7 +3158,7 @@ align 4
|
|||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
align 4
|
align 4
|
||||||
sys_getbutton:
|
sys_getbutton:
|
||||||
mov ebx, [CURRENT_TASK] ; TOP OF WINDOW STACK
|
mov ebx, [current_slot_idx] ; TOP OF WINDOW STACK
|
||||||
mov [esp + 32], dword 1
|
mov [esp + 32], dword 1
|
||||||
movzx ecx, word [WIN_STACK + ebx * 2]
|
movzx ecx, word [WIN_STACK + ebx * 2]
|
||||||
mov edx, [thread_count] ; less than 256 processes
|
mov edx, [thread_count] ; less than 256 processes
|
||||||
@ -3195,7 +3195,7 @@ sys_cpuusage:
|
|||||||
|
|
||||||
cmp ecx, -1 ; who am I ?
|
cmp ecx, -1 ; who am I ?
|
||||||
jne .no_who_am_i
|
jne .no_who_am_i
|
||||||
mov ecx, [CURRENT_TASK]
|
mov ecx, [current_slot_idx]
|
||||||
.no_who_am_i:
|
.no_who_am_i:
|
||||||
cmp ecx, max_processes
|
cmp ecx, max_processes
|
||||||
ja .nofillbuf
|
ja .nofillbuf
|
||||||
@ -3211,7 +3211,7 @@ sys_cpuusage:
|
|||||||
shl ecx, 5
|
shl ecx, 5
|
||||||
|
|
||||||
; +0: dword: memory usage
|
; +0: dword: memory usage
|
||||||
mov eax, [ecx+CURRENT_TASK+TASKDATA.cpu_usage]
|
mov eax, [ecx+TASK_TABLE+TASKDATA.cpu_usage]
|
||||||
mov [ebx], eax
|
mov [ebx], eax
|
||||||
; +10: 11 bytes: name of the process
|
; +10: 11 bytes: name of the process
|
||||||
push ecx
|
push ecx
|
||||||
@ -3238,7 +3238,7 @@ sys_cpuusage:
|
|||||||
stosd
|
stosd
|
||||||
|
|
||||||
; +30: PID/TID
|
; +30: PID/TID
|
||||||
mov eax, [ecx+CURRENT_TASK+TASKDATA.pid]
|
mov eax, [ecx+TASK_TABLE+TASKDATA.pid]
|
||||||
stosd
|
stosd
|
||||||
|
|
||||||
; window position and size
|
; window position and size
|
||||||
@ -3250,7 +3250,7 @@ sys_cpuusage:
|
|||||||
movsd
|
movsd
|
||||||
|
|
||||||
; Process state (+50)
|
; Process state (+50)
|
||||||
mov eax, dword [ecx+CURRENT_TASK+TASKDATA.state]
|
movzx eax, byte [ecx+TASK_TABLE+TASKDATA.state]
|
||||||
stosd
|
stosd
|
||||||
|
|
||||||
; Window client area box
|
; Window client area box
|
||||||
@ -3265,7 +3265,7 @@ sys_cpuusage:
|
|||||||
stosb
|
stosb
|
||||||
|
|
||||||
; Event mask (+71)
|
; Event mask (+71)
|
||||||
mov EAX, dword [ECX+CURRENT_TASK+TASKDATA.event_mask]
|
mov EAX, dword [ECX+TASK_TABLE+TASKDATA.event_mask]
|
||||||
stosd
|
stosd
|
||||||
|
|
||||||
; Keyboard mode (+75)
|
; Keyboard mode (+75)
|
||||||
@ -3364,7 +3364,7 @@ sys_redrawstat:
|
|||||||
cmp ebx, 1
|
cmp ebx, 1
|
||||||
jne no_widgets_away
|
jne no_widgets_away
|
||||||
; buttons away
|
; buttons away
|
||||||
mov ecx, [CURRENT_TASK]
|
mov ecx, [current_slot_idx]
|
||||||
sys_newba2:
|
sys_newba2:
|
||||||
mov edi, [BTN_ADDR]
|
mov edi, [BTN_ADDR]
|
||||||
cmp [edi], dword 0 ; empty button list ?
|
cmp [edi], dword 0 ; empty button list ?
|
||||||
@ -3402,7 +3402,7 @@ sys_redrawstat:
|
|||||||
jnz srl1
|
jnz srl1
|
||||||
|
|
||||||
mov edx, [TASK_BASE] ; return whole screen draw area for this app
|
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.left], 0
|
||||||
mov [edx + RECT.top], 0
|
mov [edx + RECT.top], 0
|
||||||
mov eax, [_display.width]
|
mov eax, [_display.width]
|
||||||
@ -3565,7 +3565,7 @@ nocpustart:
|
|||||||
mov [mouse_active], 0
|
mov [mouse_active], 0
|
||||||
|
|
||||||
xor edi, edi
|
xor edi, edi
|
||||||
mov ebx, CURRENT_TASK
|
mov ebx, TASK_TABLE
|
||||||
|
|
||||||
mov ecx, [thread_count]
|
mov ecx, [thread_count]
|
||||||
movzx eax, word [WIN_POS + ecx*2] ; active window
|
movzx eax, word [WIN_POS + ecx*2] ; active window
|
||||||
@ -3707,7 +3707,7 @@ markz:
|
|||||||
push ecx edx
|
push ecx edx
|
||||||
cmp [edx+TASKDATA.state], TSTATE_FREE
|
cmp [edx+TASKDATA.state], TSTATE_FREE
|
||||||
jz .nokill
|
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
|
cmp [edx+APPDATA.process], sys_proc
|
||||||
jz .nokill
|
jz .nokill
|
||||||
call request_terminate
|
call request_terminate
|
||||||
@ -4453,7 +4453,7 @@ sys_putimage_palette:
|
|||||||
pop ecx
|
pop ecx
|
||||||
jz sys_putimage.exit
|
jz sys_putimage.exit
|
||||||
|
|
||||||
mov eax, [CURRENT_TASK]
|
mov eax, [current_slot_idx]
|
||||||
shl eax, 8
|
shl eax, 8
|
||||||
add dx, word [eax+SLOT_BASE+APPDATA.wnd_clientbox.top]
|
add dx, word [eax+SLOT_BASE+APPDATA.wnd_clientbox.top]
|
||||||
rol edx, 16
|
rol edx, 16
|
||||||
@ -5015,7 +5015,7 @@ sys_process_def:
|
|||||||
cmp ebx, 7
|
cmp ebx, 7
|
||||||
jae .not_support ;if >=8 then or eax,-1
|
jae .not_support ;if >=8 then or eax,-1
|
||||||
|
|
||||||
mov edi, [CURRENT_TASK]
|
mov edi, [current_slot_idx]
|
||||||
jmp dword [f66call+ebx*4]
|
jmp dword [f66call+ebx*4]
|
||||||
|
|
||||||
.not_support:
|
.not_support:
|
||||||
@ -5112,9 +5112,9 @@ align 4
|
|||||||
test eax, eax
|
test eax, eax
|
||||||
jnz @f
|
jnz @f
|
||||||
; get current PID
|
; get current PID
|
||||||
mov eax, [CURRENT_TASK]
|
mov eax, [current_slot_idx]
|
||||||
shl eax, 5
|
shl eax, 5
|
||||||
mov eax, [eax+CURRENT_TASK+TASKDATA.pid]
|
mov eax, [eax+TASK_TABLE+TASKDATA.pid]
|
||||||
; set current PID for lock input
|
; set current PID for lock input
|
||||||
mov [PID_lock_input], eax
|
mov [PID_lock_input], eax
|
||||||
@@:
|
@@:
|
||||||
@ -5127,9 +5127,9 @@ align 4
|
|||||||
test eax, eax
|
test eax, eax
|
||||||
jz @f
|
jz @f
|
||||||
; get current PID
|
; get current PID
|
||||||
mov ebx, [CURRENT_TASK]
|
mov ebx, [current_slot_idx]
|
||||||
shl ebx, 5
|
shl ebx, 5
|
||||||
mov ebx, [ebx+CURRENT_TASK+TASKDATA.pid]
|
mov ebx, [ebx+TASK_TABLE+TASKDATA.pid]
|
||||||
; compare current lock input with current PID
|
; compare current lock input with current PID
|
||||||
cmp ebx, eax
|
cmp ebx, eax
|
||||||
jne @f
|
jne @f
|
||||||
|
@ -316,7 +316,7 @@ end virtual
|
|||||||
|
|
||||||
lea edi, [edi+ebx*4]
|
lea edi, [edi+ebx*4]
|
||||||
|
|
||||||
mov ebx, [CURRENT_TASK]
|
mov ebx, [current_slot_idx]
|
||||||
; check for hardware cursor
|
; check for hardware cursor
|
||||||
cmp [_display.select_cursor], select_cursor
|
cmp [_display.select_cursor], select_cursor
|
||||||
je .core_32.software_cursor
|
je .core_32.software_cursor
|
||||||
@ -410,7 +410,7 @@ align 4
|
|||||||
|
|
||||||
lea ebx, [ebx+ebx*2]
|
lea ebx, [ebx+ebx*2]
|
||||||
lea edi, [LFB_BASE+edi+ebx]
|
lea edi, [LFB_BASE+edi+ebx]
|
||||||
mov ebx, [CURRENT_TASK]
|
mov ebx, [current_slot_idx]
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
.outer24:
|
.outer24:
|
||||||
@ -475,7 +475,7 @@ align 4
|
|||||||
|
|
||||||
.core_16:
|
.core_16:
|
||||||
lea edi, [LFB_BASE+edi+ebx*2]
|
lea edi, [LFB_BASE+edi+ebx*2]
|
||||||
mov ebx, [CURRENT_TASK]
|
mov ebx, [current_slot_idx]
|
||||||
|
|
||||||
.outer16:
|
.outer16:
|
||||||
mov [esp+.extra_var1], edi
|
mov [esp+.extra_var1], edi
|
||||||
|
@ -422,9 +422,9 @@ align 4
|
|||||||
push esi
|
push esi
|
||||||
push edi
|
push edi
|
||||||
|
|
||||||
mov eax, [CURRENT_TASK]
|
mov eax, [current_slot_idx]
|
||||||
shl eax, 5
|
shl eax, 5
|
||||||
mov eax, [CURRENT_TASK+eax+4]
|
mov eax, [TASK_TABLE+eax+4]
|
||||||
mov ebx, [src]
|
mov ebx, [src]
|
||||||
mov ecx, [flags]
|
mov ecx, [flags]
|
||||||
call create_cursor ;eax, ebx, ecx
|
call create_cursor ;eax, ebx, ecx
|
||||||
@ -459,9 +459,9 @@ proc delete_cursor stdcall, hcursor:dword
|
|||||||
cmp [esi+CURSOR.magic], 'CURS'
|
cmp [esi+CURSOR.magic], 'CURS'
|
||||||
jne .fail
|
jne .fail
|
||||||
|
|
||||||
mov ebx, [CURRENT_TASK]
|
mov ebx, [current_slot_idx]
|
||||||
shl ebx, 5
|
shl ebx, 5
|
||||||
mov ebx, [CURRENT_TASK+ebx+4]
|
mov ebx, [TASK_TABLE+ebx+4]
|
||||||
cmp ebx, [esi+CURSOR.pid]
|
cmp ebx, [esi+CURSOR.pid]
|
||||||
jne .fail
|
jne .fail
|
||||||
|
|
||||||
|
@ -272,7 +272,7 @@ end virtual
|
|||||||
mov [putimg.real_sy_and_abs_cy], ecx
|
mov [putimg.real_sy_and_abs_cy], ecx
|
||||||
|
|
||||||
; get process number
|
; get process number
|
||||||
mov ebx, [CURRENT_TASK]
|
mov ebx, [current_slot_idx]
|
||||||
|
|
||||||
cmp byte [_display.bits_per_pixel], 16
|
cmp byte [_display.bits_per_pixel], 16
|
||||||
je put_image_end_16
|
je put_image_end_16
|
||||||
@ -886,7 +886,7 @@ __sys_putpixel:
|
|||||||
mov edx, [d_width_calc_area + ebx*4]
|
mov edx, [d_width_calc_area + ebx*4]
|
||||||
add edx, [_display.win_map]
|
add edx, [_display.win_map]
|
||||||
movzx edx, byte [eax+edx]
|
movzx edx, byte [eax+edx]
|
||||||
cmp edx, [CURRENT_TASK]
|
cmp edx, [current_slot_idx]
|
||||||
jne .exit
|
jne .exit
|
||||||
|
|
||||||
.forced:
|
.forced:
|
||||||
@ -1477,7 +1477,7 @@ end virtual
|
|||||||
add edx, LFB_BASE
|
add edx, LFB_BASE
|
||||||
|
|
||||||
; get process number
|
; get process number
|
||||||
mov ebx, [CURRENT_TASK] ; bl - process num
|
mov ebx, [current_slot_idx] ; bl - process num
|
||||||
mov esi, [drbar.real_sy]
|
mov esi, [drbar.real_sy]
|
||||||
mov eax, [drbar.color] ; BBGGRR00
|
mov eax, [drbar.color] ; BBGGRR00
|
||||||
rol eax, 8
|
rol eax, 8
|
||||||
|
Loading…
Reference in New Issue
Block a user