forked from KolibriOS/kolibrios
delete TASKDATA
git-svn-id: svn://kolibrios.org@9709 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
1fdbd55957
commit
707dc7c2e6
@ -224,11 +224,11 @@ OS_BASE = 0x80000000
|
||||
|
||||
window_data = OS_BASE + 0x0001000
|
||||
|
||||
TASK_TABLE = OS_BASE + 0x0003000
|
||||
;TASK_TABLE = OS_BASE + 0x0003000
|
||||
;CURRENT_TASK = OS_BASE + 0x0003000
|
||||
;TASK_COUNT = OS_BASE + 0x0003004
|
||||
TASK_BASE = OS_BASE + 0x0003010
|
||||
TASK_DATA = OS_BASE + 0x0003020
|
||||
;TASK_BASE = OS_BASE + 0x0003010
|
||||
;TASK_DATA = OS_BASE + 0x0003020
|
||||
;TASK_EVENT = OS_BASE + 0x0003020
|
||||
|
||||
CDDataBuf = OS_BASE + 0x0005000
|
||||
@ -281,7 +281,7 @@ LFB_BASE = 0xFE000000
|
||||
|
||||
new_app_base = 0;
|
||||
|
||||
twdw = TASK_TABLE - window_data
|
||||
;twdw = TASK_TABLE - window_data
|
||||
|
||||
std_application_base_address = new_app_base
|
||||
RING0_STACK_SIZE = 0x2000
|
||||
@ -511,16 +511,16 @@ struct APPDATA
|
||||
wait_test dd ? ;+96 +++
|
||||
wait_param dd ? ;+100 +++
|
||||
tls_base dd ? ;+104
|
||||
event_mask dd ? ;+108 ; R stores event types allowed for task
|
||||
tid dd ? ;+112 ; R thread id
|
||||
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
|
||||
state db ? ;+124 ; R thread state
|
||||
wnd_number db ? ;+125 ; R
|
||||
state db ? ;+124 thread state
|
||||
wnd_number db ? ;+125
|
||||
dw ? ;+126
|
||||
wnd_shape dd ? ;+128
|
||||
wnd_shape_scale dd ? ;+132
|
||||
mem_start dd ? ;+136 ; R
|
||||
mem_start dd ? ;+136
|
||||
counter_sum dd ? ;+140 ; R
|
||||
saved_box BOX ;+144
|
||||
ipc_start dd ? ;+160
|
||||
@ -549,20 +549,20 @@ APP_OBJ_OFFSET = 48
|
||||
APP_EV_OFFSET = 40
|
||||
|
||||
; Note: in future TASKDATA will be merged into APPDATA
|
||||
struct TASKDATA
|
||||
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
|
||||
;struct TASKDATA
|
||||
; 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
|
||||
|
||||
; Thread states:
|
||||
TSTATE_RUNNING = 0
|
||||
|
@ -46,10 +46,10 @@ get_debuggee_slot:
|
||||
call pid_to_slot
|
||||
test eax, eax
|
||||
jz .ret_bad
|
||||
shl eax, 5
|
||||
shl eax, BSF sizeof.APPDATA
|
||||
push ebx
|
||||
mov ebx, [current_slot_idx]
|
||||
cmp [SLOT_BASE+eax*8+APPDATA.debugger_slot], ebx
|
||||
cmp [SLOT_BASE+eax+APPDATA.debugger_slot], ebx
|
||||
pop ebx
|
||||
jnz .ret_bad
|
||||
; clc ; automatically
|
||||
@ -63,7 +63,7 @@ debug_detach:
|
||||
; destroys eax,ebx
|
||||
call get_debuggee_slot
|
||||
jc .ret
|
||||
and dword [eax*8+SLOT_BASE+APPDATA.debugger_slot], 0
|
||||
and dword [eax+SLOT_BASE+APPDATA.debugger_slot], 0
|
||||
call do_resume
|
||||
.ret:
|
||||
sti
|
||||
@ -74,7 +74,7 @@ debug_terminate:
|
||||
call get_debuggee_slot
|
||||
jc debug_detach.ret
|
||||
mov ecx, eax
|
||||
shr ecx, 5
|
||||
shr ecx, BSF sizeof.APPDATA
|
||||
; push 2
|
||||
; pop ebx
|
||||
mov edx, esi
|
||||
@ -92,14 +92,14 @@ debug_suspend:
|
||||
call get_debuggee_slot
|
||||
jc .ret
|
||||
; } End patch
|
||||
mov cl, [TASK_TABLE+eax+TASKDATA.state] ; process state
|
||||
mov cl, [SLOT_BASE + eax + APPDATA.state] ; process state
|
||||
test cl, cl
|
||||
jz .1
|
||||
cmp cl, 5
|
||||
jnz .ret
|
||||
mov cl, 2
|
||||
.2:
|
||||
mov [TASK_TABLE+eax+TASKDATA.state], cl
|
||||
mov [SLOT_BASE + eax + APPDATA.state], cl
|
||||
.ret:
|
||||
sti
|
||||
ret
|
||||
@ -108,14 +108,14 @@ debug_suspend:
|
||||
jmp .2
|
||||
|
||||
do_resume:
|
||||
mov cl, [TASK_TABLE+eax+TASKDATA.state]
|
||||
mov cl, [SLOT_BASE + eax + APPDATA.state]
|
||||
cmp cl, 1
|
||||
jz .1
|
||||
cmp cl, 2
|
||||
jnz .ret
|
||||
mov cl, 5
|
||||
.2:
|
||||
mov [TASK_TABLE+eax+TASKDATA.state], cl
|
||||
mov [SLOT_BASE + eax + APPDATA.state], cl
|
||||
.ret:
|
||||
ret
|
||||
.1:
|
||||
@ -128,7 +128,7 @@ debug_resume:
|
||||
cli
|
||||
mov eax, ecx
|
||||
call pid_to_slot
|
||||
shl eax, 5
|
||||
shl eax, BSF sizeof.APPDATA
|
||||
jz .ret
|
||||
call do_resume
|
||||
.ret:
|
||||
@ -155,12 +155,12 @@ debug_getcontext:
|
||||
call get_debuggee_slot
|
||||
jc .ret
|
||||
|
||||
shr eax, 5
|
||||
shr eax, 8
|
||||
cmp eax, [fpu_owner]
|
||||
jne @f
|
||||
inc bh ; set swap context flag
|
||||
@@:
|
||||
shl eax, 8
|
||||
shl eax, BSF sizeof.APPDATA
|
||||
mov edi, esi
|
||||
mov eax, [eax+SLOT_BASE+APPDATA.pl0_stack]
|
||||
lea esi, [eax+RING0_STACK_SIZE]
|
||||
@ -231,7 +231,7 @@ debug_setcontext:
|
||||
call get_debuggee_slot
|
||||
jc .stiret
|
||||
; mov esi, edx
|
||||
mov eax, [eax*8+SLOT_BASE+APPDATA.pl0_stack]
|
||||
mov eax, [eax+SLOT_BASE+APPDATA.pl0_stack]
|
||||
lea edi, [eax+RING0_STACK_SIZE]
|
||||
|
||||
.ring0:
|
||||
@ -267,7 +267,7 @@ debug_set_drx:
|
||||
call get_debuggee_slot
|
||||
jc .errret
|
||||
mov ebp, eax
|
||||
lea eax, [eax*8+SLOT_BASE+APPDATA.dbg_regs]
|
||||
lea eax, [eax+SLOT_BASE+APPDATA.dbg_regs]
|
||||
; [eax]=dr0, [eax+4]=dr1, [eax+8]=dr2, [eax+C]=dr3
|
||||
; [eax+10]=dr7
|
||||
cmp esi, OS_BASE
|
||||
@ -294,7 +294,7 @@ debug_set_drx:
|
||||
jnz .okret
|
||||
; imul eax, ebp, tss_step/32
|
||||
; and byte [eax + tss_data + TSS._trap], not 1
|
||||
and [ebp*8 + SLOT_BASE+APPDATA.dbg_state], not 1
|
||||
and [ebp + SLOT_BASE+APPDATA.dbg_state], not 1
|
||||
.okret:
|
||||
and dword [esp+32], 0
|
||||
sti
|
||||
@ -341,7 +341,7 @@ debug_set_drx:
|
||||
or [eax+10h+2], dx ; set R/W and LEN fields
|
||||
; imul eax, ebp, tss_step/32
|
||||
; or byte [eax + tss_data + TSS._trap], 1
|
||||
or [ebp*8 + SLOT_BASE+APPDATA.dbg_state], 1
|
||||
or [ebp + SLOT_BASE+APPDATA.dbg_state], 1
|
||||
jmp .okret
|
||||
|
||||
debug_read_process_memory:
|
||||
@ -354,7 +354,7 @@ debug_read_process_memory:
|
||||
; destroys all
|
||||
call get_debuggee_slot
|
||||
jc .err
|
||||
shr eax, 5
|
||||
shr eax, 8
|
||||
mov ecx, edi
|
||||
call read_process_memory
|
||||
sti
|
||||
@ -374,7 +374,7 @@ debug_write_process_memory:
|
||||
; destroys all
|
||||
call get_debuggee_slot
|
||||
jc debug_read_process_memory.err
|
||||
shr eax, 5
|
||||
shr eax, 8
|
||||
mov ecx, edi
|
||||
call write_process_memory
|
||||
sti
|
||||
|
@ -280,7 +280,6 @@ proc find_next_task
|
||||
test bl, bl
|
||||
jz .start
|
||||
mov ebx, [current_slot]
|
||||
mov edi, [TASK_BASE]
|
||||
mov eax, [ebx+APPDATA.priority]
|
||||
test eax, eax
|
||||
jz .unlock_found
|
||||
@ -293,11 +292,7 @@ proc find_next_task
|
||||
jz .priority_next
|
||||
.task_loop:
|
||||
mov ebx, [ebx+APPDATA.in_schedule.next]
|
||||
;mov al, [ebx+APPDATA.state]
|
||||
mov edi, ebx ;
|
||||
shr edi, 3 ;
|
||||
add edi, TASK_TABLE - (SLOT_BASE shr 3) ; on delete
|
||||
mov al, [edi+TASKDATA.state] ;
|
||||
mov al, [ebx+APPDATA.state]
|
||||
test al, al
|
||||
jz .task_found ; state == 0
|
||||
cmp al, 5
|
||||
@ -317,7 +312,6 @@ proc find_next_task
|
||||
xor eax, eax
|
||||
@@:
|
||||
mov [ebx+APPDATA.wait_param], eax ; retval for wait
|
||||
mov [edi+TASKDATA.state], TSTATE_RUNNING ; on delete
|
||||
mov [ebx+APPDATA.state], TSTATE_RUNNING
|
||||
.task_found:
|
||||
mov [scheduler_current+ecx*4], ebx
|
||||
@ -338,7 +332,7 @@ proc find_next_task
|
||||
; the line below assumes APPDATA is 256 bytes long and SLOT_BASE is
|
||||
; aligned on 0x10000
|
||||
mov byte [current_slot_idx], bh
|
||||
mov [TASK_BASE], edi
|
||||
|
||||
rdtsc ;call _rdtsc
|
||||
mov [ebx-sizeof.APPDATA+APPDATA.counter_add], eax; for next using update_counters
|
||||
;mov [edi+TASKDATA.counter_add], eax; for next using update_counters
|
||||
@ -352,7 +346,6 @@ proc find_next_task
|
||||
cmp ecx, [esp]
|
||||
jb .priority_loop
|
||||
mov ebx, [current_slot]
|
||||
mov edi, [TASK_BASE]
|
||||
jmp .unlock_found
|
||||
endp
|
||||
|
||||
|
@ -38,7 +38,7 @@ mutex_lock:
|
||||
|
||||
list_add_tail esp, ecx ;esp= new waiter, ecx= list head
|
||||
|
||||
mov edx, [TASK_BASE]
|
||||
mov edx, [current_slot]
|
||||
mov [esp+MUTEX_WAITER.task], edx
|
||||
|
||||
.forever:
|
||||
@ -48,7 +48,7 @@ mutex_lock:
|
||||
dec eax
|
||||
jz @F
|
||||
|
||||
mov [edx+TASKDATA.state], TSTATE_RUN_SUSPENDED
|
||||
mov [edx + APPDATA.state], TSTATE_RUN_SUSPENDED
|
||||
call change_task
|
||||
jmp .forever
|
||||
@@:
|
||||
@ -80,7 +80,7 @@ mutex_unlock:
|
||||
je @F
|
||||
|
||||
mov eax, [eax+MUTEX_WAITER.task]
|
||||
mov [eax+TASKDATA.state], TSTATE_RUNNING
|
||||
mov [eax + APPDATA.state], TSTATE_RUNNING
|
||||
@@:
|
||||
popfd
|
||||
ret
|
||||
@ -111,10 +111,10 @@ down_read:
|
||||
@@:
|
||||
sub esp, sizeof.MUTEX_WAITER
|
||||
|
||||
mov eax, [TASK_BASE]
|
||||
mov eax, [current_slot]
|
||||
mov [esp+MUTEX_WAITER.task], eax
|
||||
mov [esp+MUTEX_WAITER.type], RWSEM_WAITING_FOR_READ
|
||||
mov [eax+TASKDATA.state], TSTATE_RUN_SUSPENDED
|
||||
mov [eax + APPDATA.state], TSTATE_RUN_SUSPENDED
|
||||
|
||||
list_add_tail esp, ecx ;esp= new waiter, ecx= list head
|
||||
|
||||
@ -138,10 +138,10 @@ down_write:
|
||||
cli
|
||||
sub esp, sizeof.MUTEX_WAITER
|
||||
|
||||
mov edx, [TASK_BASE]
|
||||
mov edx, [current_slot]
|
||||
mov [esp+MUTEX_WAITER.task], edx
|
||||
mov [esp+MUTEX_WAITER.type], RWSEM_WAITING_FOR_WRITE
|
||||
mov [edx+TASKDATA.state], TSTATE_RUN_SUSPENDED
|
||||
mov [edx + APPDATA.state], TSTATE_RUN_SUSPENDED
|
||||
|
||||
list_add_tail esp, ecx ;esp= new waiter, ecx= list head
|
||||
|
||||
@ -152,7 +152,7 @@ down_write:
|
||||
test eax, [ecx+RWSEM.count]
|
||||
jz @F
|
||||
|
||||
mov [edx+TASKDATA.state], TSTATE_RUN_SUSPENDED
|
||||
mov [edx + APPDATA.state], TSTATE_RUN_SUSPENDED
|
||||
call change_task
|
||||
jmp .forever
|
||||
@@:
|
||||
@ -178,7 +178,7 @@ up_read:
|
||||
je @F
|
||||
|
||||
mov eax, [eax+MUTEX_WAITER.task]
|
||||
mov [eax+TASKDATA.state], TSTATE_RUNNING
|
||||
mov [eax + APPDATA.state], TSTATE_RUNNING
|
||||
@@:
|
||||
popfd
|
||||
ret
|
||||
@ -202,7 +202,7 @@ up_write:
|
||||
jnz .wake
|
||||
|
||||
mov eax, [eax+MUTEX_WAITER.task]
|
||||
mov [eax+TASKDATA.state], TSTATE_RUNNING
|
||||
mov [eax + APPDATA.state], TSTATE_RUNNING
|
||||
.done:
|
||||
popfd
|
||||
ret
|
||||
@ -220,7 +220,7 @@ up_write:
|
||||
mov ebx, [eax+MUTEX_WAITER.list.next]
|
||||
list_del eax
|
||||
mov edx, [eax+MUTEX_WAITER.task]
|
||||
mov [edx+TASKDATA.state], TSTATE_RUNNING
|
||||
mov [edx + APPDATA.state], TSTATE_RUNNING
|
||||
inc esi
|
||||
cmp edi, ebx
|
||||
je .wake_done
|
||||
|
@ -150,9 +150,9 @@ exc_c: ; exceptions (all but 7th - #NM)
|
||||
test eax, eax
|
||||
jnz .debug
|
||||
; not debuggee => say error and terminate
|
||||
call show_error_parameters
|
||||
call show_error_parameters ; this function output in edx = current_slot
|
||||
sti
|
||||
mov [edx + TASKDATA.state], TSTATE_TERMINATING
|
||||
mov [edx + APPDATA.state], TSTATE_TERMINATING
|
||||
call wakeup_osloop
|
||||
call change_task
|
||||
; If we're here, then the main OS thread has crashed before initializing IDLE thread.
|
||||
@ -186,8 +186,8 @@ exc_c: ; exceptions (all but 7th - #NM)
|
||||
mov cl, 12 ; debug_message size
|
||||
call debugger_notify ;; only ONE using, inline ??? SEE: core/debug.inc
|
||||
add esp, 12
|
||||
mov edx, [TASK_BASE]
|
||||
mov [edx+TASKDATA.state], TSTATE_RUN_SUSPENDED
|
||||
mov edx, [current_slot]
|
||||
mov [edx + APPDATA.state], TSTATE_RUN_SUSPENDED
|
||||
call change_task ; SEE: core/shed.inc
|
||||
restore_ring3_context
|
||||
iretd
|
||||
@ -288,6 +288,27 @@ show_error_parameters:
|
||||
test eax, eax
|
||||
jnz .error_ESP
|
||||
DEBUGF 1, " [ESP+32]: %x\n",[ebx]
|
||||
;for input instruction
|
||||
mov ebx, [reg_eip+4]
|
||||
call .check_ESP
|
||||
test eax, eax
|
||||
jnz .error_ESP
|
||||
DEBUGF 1, "K : [EIP]: %x",[ebx]
|
||||
add ebx, 4
|
||||
call .check_ESP
|
||||
test eax, eax
|
||||
jnz .error_ESP
|
||||
DEBUGF 1, " [EIP+4]: %x",[ebx]
|
||||
add ebx, 4
|
||||
call .check_ESP
|
||||
test eax, eax
|
||||
jnz .error_ESP
|
||||
DEBUGF 1, " [EIP+8]: %x\n",[ebx]
|
||||
add ebx, 4
|
||||
call .check_ESP
|
||||
test eax, eax
|
||||
jnz .error_ESP
|
||||
DEBUGF 1, "K : [EIP+12]: %x\n",[ebx]
|
||||
pop edx ecx ebx eax
|
||||
ret
|
||||
.error_ESP:
|
||||
@ -412,13 +433,12 @@ destroy_thread:
|
||||
|
||||
push esi ;save .slot
|
||||
|
||||
shl esi, 8
|
||||
shl esi, BSF sizeof.APPDATA
|
||||
mov edx, [SLOT_BASE+esi+APPDATA.process]
|
||||
test edx, edx
|
||||
jnz @F
|
||||
mov [SLOT_BASE + esi + APPDATA.state], TSTATE_FREE
|
||||
pop esi
|
||||
shl esi, BSF sizeof.TASKDATA
|
||||
mov [TASK_TABLE+esi+TASKDATA.state], TSTATE_FREE
|
||||
ret
|
||||
@@:
|
||||
push edx ;save .process
|
||||
@ -428,7 +448,7 @@ destroy_thread:
|
||||
|
||||
; if the process is in V86 mode...
|
||||
mov eax, [.slot]
|
||||
shl eax, 8
|
||||
shl eax, BSF sizeof.APPDATA
|
||||
mov esi, [eax+SLOT_BASE+APPDATA.pl0_stack]
|
||||
add esi, RING0_STACK_SIZE
|
||||
cmp [eax+SLOT_BASE+APPDATA.saved_esp0], esi
|
||||
@ -445,7 +465,7 @@ destroy_thread:
|
||||
.nov86:
|
||||
; destroy per-thread kernel objects
|
||||
mov esi, [.slot]
|
||||
shl esi, 8
|
||||
shl esi, BSF sizeof.APPDATA
|
||||
add esi, SLOT_BASE+APP_OBJ_OFFSET
|
||||
@@:
|
||||
mov eax, [esi+APPOBJ.fd]
|
||||
@ -591,7 +611,7 @@ destroy_thread:
|
||||
popad
|
||||
|
||||
mov ebx, [.slot]
|
||||
shl ebx, 8
|
||||
shl ebx, BSF sizeof.APPDATA
|
||||
push ebx
|
||||
mov ebx, [SLOT_BASE+ebx+APPDATA.pl0_stack]
|
||||
|
||||
@ -602,7 +622,7 @@ destroy_thread:
|
||||
stdcall kernel_free, ebx
|
||||
|
||||
mov edi, [.slot]
|
||||
shl edi, 8
|
||||
shl edi, BSF sizeof.APPDATA
|
||||
add edi, SLOT_BASE
|
||||
|
||||
mov eax, [edi+APPDATA.io_map]
|
||||
@ -637,9 +657,10 @@ destroy_thread:
|
||||
jbe .nothing_to_activate
|
||||
lea esi, [WIN_POS+eax*2]
|
||||
movzx edi, word [esi] ; edi = process
|
||||
shl edi, BSF sizeof.TASKDATA
|
||||
cmp [TASK_TABLE + edi + TASKDATA.state], TSTATE_FREE ; skip free slots
|
||||
shl edi, BSF sizeof.APPDATA
|
||||
cmp [SLOT_BASE + edi + APPDATA.state], TSTATE_FREE ; skip free slots
|
||||
je .check_next_window
|
||||
shr edi, 3
|
||||
add edi, window_data
|
||||
; \begin{diamond}[19.09.2006]
|
||||
; skip minimized windows
|
||||
@ -711,8 +732,8 @@ destroy_thread:
|
||||
|
||||
popa
|
||||
mov edi, esi ; do not run this process slot
|
||||
shl edi, BSF sizeof.TASKDATA
|
||||
mov [edi+TASK_TABLE + TASKDATA.state], TSTATE_FREE
|
||||
shl edi, BSF sizeof.APPDATA
|
||||
mov [edi + SLOT_BASE + APPDATA.state], TSTATE_FREE
|
||||
; debugger test - terminate all debuggees
|
||||
mov eax, 2
|
||||
mov ecx, SLOT_BASE+2*sizeof.APPDATA + APPDATA.debugger_slot
|
||||
|
@ -487,26 +487,22 @@ pid_to_slot:
|
||||
push ebx
|
||||
push ecx
|
||||
mov ebx, [thread_count]
|
||||
shl ebx, BSF sizeof.TASKDATA ; multiply by size
|
||||
;shl ebx, BSF sizeof.APPDATA ; multiply by size
|
||||
shl ebx, BSF sizeof.APPDATA ; multiply by size
|
||||
; add 2*32 cause:
|
||||
; [TASK_TABLE; TASK_TABLE + 32) isnt a task actually
|
||||
; skip first process in the task table
|
||||
mov ecx, 2*32 ;sizeof.TASKDATA
|
||||
;mov ecx, sizeof.APPDATA
|
||||
;mov ecx, 2*32 ;sizeof.TASKDATA
|
||||
mov ecx, sizeof.APPDATA
|
||||
|
||||
.loop:
|
||||
;ecx = offset of current process info entry
|
||||
;ebx = maximum permitted offset
|
||||
cmp [TASK_TABLE+ecx+TASKDATA.state], TSTATE_FREE
|
||||
cmp [SLOT_BASE + ecx + APPDATA.state], TSTATE_FREE
|
||||
jz .endloop ;skip empty slots
|
||||
;cmp [ecx+SLOT_BASE+APPDATA.state], TSTATE_FREE
|
||||
;jz .endloop ;skip empty slots
|
||||
cmp [ecx*8 + SLOT_BASE + APPDATA.tid], eax;check PID
|
||||
cmp [ecx + SLOT_BASE + APPDATA.tid], eax;check PID
|
||||
jz .pid_found
|
||||
.endloop:
|
||||
add ecx, sizeof.TASKDATA
|
||||
;add ecx, sizeof.APPDATA
|
||||
add ecx, sizeof.APPDATA
|
||||
cmp ecx, ebx
|
||||
jle .loop
|
||||
|
||||
@ -516,8 +512,7 @@ pid_to_slot:
|
||||
ret
|
||||
|
||||
.pid_found:
|
||||
shr ecx, BSF sizeof.TASKDATA ; divide by size
|
||||
;shr ecx, BSF sizeof.APPDATA
|
||||
shr ecx, BSF sizeof.APPDATA ; divide by size
|
||||
mov eax, ecx ;convert offset to index of slot
|
||||
pop ecx
|
||||
pop ebx
|
||||
@ -903,8 +898,7 @@ common_app_entry:
|
||||
cmp [ebx+APPDATA.debugger_slot], 0
|
||||
je .exit
|
||||
mov [ebx+APPDATA.state], TSTATE_RUN_SUSPENDED
|
||||
mov eax, [TASK_BASE]
|
||||
mov [eax+TASKDATA.state], TSTATE_RUN_SUSPENDED
|
||||
mov [ebx + APPDATA.state], TSTATE_RUN_SUSPENDED
|
||||
call change_task
|
||||
.exit:
|
||||
popad
|
||||
@ -932,7 +926,7 @@ proc set_app_params stdcall,slot:dword, params:dword, flags:dword
|
||||
mov eax, [slot]
|
||||
mov ebx, eax
|
||||
|
||||
shl eax, 8
|
||||
shl eax, BSF sizeof.APPDATA
|
||||
mov [eax+SLOT_BASE+APPDATA.fpu_state], edi
|
||||
mov [eax+SLOT_BASE+APPDATA.exc_handler], 0
|
||||
mov [eax+SLOT_BASE+APPDATA.except_mask], 0
|
||||
@ -952,7 +946,7 @@ proc set_app_params stdcall,slot:dword, params:dword, flags:dword
|
||||
|
||||
cmp [thread_count], ebx
|
||||
adc [thread_count], 0 ; update number of processes
|
||||
shl ebx, 8
|
||||
shl ebx, BSF sizeof.APPDATA
|
||||
lea edx, [ebx+SLOT_BASE+APP_EV_OFFSET]
|
||||
mov [SLOT_BASE+APPDATA.fd_ev+ebx], edx
|
||||
mov [SLOT_BASE+APPDATA.bk_ev+ebx], edx
|
||||
@ -987,7 +981,7 @@ proc set_app_params stdcall,slot:dword, params:dword, flags:dword
|
||||
mov eax, [slot]
|
||||
mov [ebx+SLOT_BASE+APPDATA.wnd_number], al
|
||||
mov ebx, eax
|
||||
shl ebx, 5
|
||||
shl ebx, BSF sizeof.WDATA
|
||||
lea ecx, [draw_data+ebx];ecx - pointer to draw data
|
||||
|
||||
; set window state to 'normal' (non-minimized/maximized/rolled-up) state
|
||||
@ -1037,20 +1031,18 @@ proc set_app_params stdcall,slot:dword, params:dword, flags:dword
|
||||
|
||||
lea edx, [ebx+REG_RET]
|
||||
mov ebx, [slot]
|
||||
shl ebx, 5
|
||||
mov [ebx*8+SLOT_BASE+APPDATA.saved_esp], edx
|
||||
shl ebx, BSF sizeof.APPDATA
|
||||
mov [ebx+SLOT_BASE+APPDATA.saved_esp], edx
|
||||
|
||||
xor edx, edx; process state - running
|
||||
; set if debuggee
|
||||
test byte [flags], 1
|
||||
jz .no_debug
|
||||
mov eax, [current_slot_idx]
|
||||
mov [SLOT_BASE+ebx*8+APPDATA.debugger_slot], eax
|
||||
mov [SLOT_BASE+ebx+APPDATA.debugger_slot], eax
|
||||
.no_debug:
|
||||
mov [TASK_TABLE+ebx+TASKDATA.state], dl
|
||||
;shl ebx, 3
|
||||
;mov [ebx+SLOT_BASE+APPDATA.state], dl
|
||||
lea edx, [SLOT_BASE+ebx*8]
|
||||
mov [SLOT_BASE + ebx + APPDATA.state], dl
|
||||
lea edx, [SLOT_BASE+ebx]
|
||||
call scheduler_add_thread
|
||||
ret
|
||||
endp
|
||||
|
@ -898,9 +898,6 @@ v86_irq2:
|
||||
mov word [esi-sizeof.v86_regs+v86_regs.cs], cx
|
||||
and byte [esi-sizeof.v86_regs+v86_regs.eflags+1], not 3
|
||||
call update_counters
|
||||
lea edi, [ebx + 0x100000000 - SLOT_BASE]
|
||||
shr edi, 3
|
||||
add edi, TASK_TABLE
|
||||
call find_next_task.found
|
||||
call do_change_task
|
||||
popad
|
||||
|
@ -136,9 +136,10 @@ syscall_button: ;////////////// system function 8 //////////////
|
||||
dec ebp
|
||||
shr ebx, 16
|
||||
shr ecx, 16
|
||||
mov eax, [TASK_BASE]
|
||||
add ebx, [eax - twdw + WDATA.box.left]
|
||||
add ecx, [eax - twdw + WDATA.box.top]
|
||||
mov eax, [current_slot_idx]
|
||||
shl eax, BSF sizeof.WDATA
|
||||
add ebx, [eax + window_data + WDATA.box.left]
|
||||
add ecx, [eax + window_data + WDATA.box.top]
|
||||
mov eax, ebx
|
||||
inc eax
|
||||
mov edx, ebx
|
||||
|
@ -280,9 +280,7 @@ Wait_events_ex:
|
||||
mov [esi+APPDATA.wait_timeout], ebx
|
||||
mov eax, [timer_ticks]
|
||||
mov [esi+APPDATA.wait_begin], eax
|
||||
mov [esi+APPDATA.state], TSTATE_WAITING
|
||||
mov eax, [TASK_BASE]
|
||||
mov [eax+TASKDATA.state], TSTATE_WAITING
|
||||
mov [esi + APPDATA.state], TSTATE_WAITING
|
||||
call change_task
|
||||
mov eax, [esi+APPDATA.wait_param]
|
||||
;--------------------------------------
|
||||
@ -513,7 +511,7 @@ get_event_for_app: ;; used from f10,f11,f23
|
||||
movzx edi, bh ; bh is assumed as [current_slot_idx]
|
||||
mov ecx, [ebx+APPDATA.event_mask]
|
||||
shl edi, 5
|
||||
add edi, TASK_TABLE ; edi is assumed as [TASK_BASE]
|
||||
add edi, window_data
|
||||
and ecx, 0x7FFFFFFF
|
||||
;--------------------------------------
|
||||
align 4
|
||||
@ -541,7 +539,7 @@ align 4
|
||||
;--------------------------------------
|
||||
align 4
|
||||
.WndRedraw: ; eax=0, retval WndRedraw=1
|
||||
cmp [edi-twdw+WDATA.fl_redraw], al;al==0
|
||||
cmp [edi + WDATA.fl_redraw], al;al==0
|
||||
jne .result
|
||||
jmp .loop
|
||||
;--------------------------------------
|
||||
|
@ -726,10 +726,11 @@ dd .loadCursorUni
|
||||
mov eax, [MOUSE_X]
|
||||
shl eax, 16
|
||||
mov ax, [MOUSE_Y]
|
||||
mov esi, [TASK_BASE]
|
||||
mov bx, word [esi-twdw+WDATA.box.left]
|
||||
mov esi, [current_slot_idx]
|
||||
shl esi, BSF sizeof.WDATA
|
||||
mov bx, word [esi + window_data + WDATA.box.left]
|
||||
shl ebx, 16
|
||||
mov bx, word [esi-twdw+WDATA.box.top]
|
||||
mov bx, word [esi + window_data + WDATA.box.top]
|
||||
sub eax, ebx
|
||||
mov edi, [current_slot_idx]
|
||||
shl edi, 8
|
||||
|
@ -78,9 +78,10 @@ syscall_setpixel:
|
||||
mov eax, ebx
|
||||
mov ebx, ecx
|
||||
mov ecx, edx
|
||||
mov edx, [TASK_BASE]
|
||||
add eax, [edx-twdw+WDATA.box.left]
|
||||
add ebx, [edx-twdw+WDATA.box.top]
|
||||
mov edx, [current_slot_idx]
|
||||
shl edx, BSF sizeof.WDATA
|
||||
add eax, [edx + window_data + WDATA.box.left]
|
||||
add ebx, [edx + window_data + WDATA.box.top]
|
||||
mov edi, [current_slot]
|
||||
add eax, [edi+APPDATA.wnd_clientbox.left]
|
||||
add ebx, [edi+APPDATA.wnd_clientbox.top]
|
||||
@ -103,13 +104,14 @@ syscall_writetext:
|
||||
pop esi
|
||||
jnz .err
|
||||
|
||||
mov eax, [TASK_BASE]
|
||||
mov ebp, [eax-twdw+WDATA.box.left]
|
||||
mov eax, [current_slot_idx]
|
||||
shl eax, BSF sizeof.WDATA
|
||||
mov ebp, [eax + window_data + WDATA.box.left]
|
||||
push esi
|
||||
mov esi, [current_slot]
|
||||
add ebp, [esi+APPDATA.wnd_clientbox.left]
|
||||
shl ebp, 16
|
||||
add ebp, [eax-twdw+WDATA.box.top]
|
||||
add ebp, [eax + window_data + WDATA.box.top]
|
||||
add bp, word[esi+APPDATA.wnd_clientbox.top]
|
||||
pop esi
|
||||
test ecx, 0x08000000 ; redirect the output to the user area
|
||||
@ -163,15 +165,16 @@ syscall_drawrect:
|
||||
align 4
|
||||
; system function 38
|
||||
syscall_drawline:
|
||||
mov edi, [TASK_BASE]
|
||||
movzx eax, word[edi-twdw+WDATA.box.left]
|
||||
mov edi, [current_slot_idx]
|
||||
shl edi, BSF sizeof.WDATA
|
||||
movzx eax, word[edi + window_data + WDATA.box.left]
|
||||
mov ebp, eax
|
||||
mov esi, [current_slot]
|
||||
add ebp, [esi+APPDATA.wnd_clientbox.left]
|
||||
add ax, word[esi+APPDATA.wnd_clientbox.left]
|
||||
add ebp, ebx
|
||||
shl eax, 16
|
||||
movzx ebx, word[edi-twdw+WDATA.box.top]
|
||||
movzx ebx, word[edi + window_data + WDATA.box.top]
|
||||
add eax, ebp
|
||||
mov ebp, ebx
|
||||
add ebp, [esi+APPDATA.wnd_clientbox.top]
|
||||
@ -429,7 +432,7 @@ align 4
|
||||
; system function 67
|
||||
syscall_move_window:
|
||||
mov edi, [current_slot_idx]
|
||||
shl edi, 5
|
||||
shl edi, BSF sizeof.WDATA
|
||||
add edi, window_data
|
||||
|
||||
test [edi + WDATA.fl_wdrawn], 1
|
||||
@ -485,7 +488,7 @@ align 4
|
||||
; system function 71
|
||||
syscall_window_settings:
|
||||
mov edi, [current_slot_idx]
|
||||
shl edi, 5
|
||||
shl edi, BSF sizeof.WDATA
|
||||
or [edi + window_data + WDATA.fl_wstyle], WSTYLE_HASCAPTION
|
||||
cmp ebx, 2
|
||||
jz @f
|
||||
@ -556,9 +559,9 @@ align 4
|
||||
align 4
|
||||
.next_window:
|
||||
movzx edi, word[WIN_POS + esi * 2]
|
||||
shl edi, 5 ;size of TASKDATA and WDATA = 32 bytes
|
||||
shl edi, BSF sizeof.WDATA ;size of TASKDATA and WDATA = 32 bytes
|
||||
|
||||
cmp byte [TASK_TABLE + edi + TASKDATA.state], TSTATE_FREE
|
||||
cmp byte [SLOT_BASE + edi*8 + APPDATA.state], TSTATE_FREE
|
||||
je .skip_window
|
||||
|
||||
add edi, window_data
|
||||
@ -625,7 +628,7 @@ align 4
|
||||
;---------------------------------------------
|
||||
mov esi, [thread_count]
|
||||
movzx edi, word[WIN_POS + esi * 2]
|
||||
shl edi, 5
|
||||
shl edi, BSF sizeof.WDATA
|
||||
add edi, window_data
|
||||
|
||||
pop eax ebx ecx edx
|
||||
@ -1033,7 +1036,7 @@ waredraw:
|
||||
pushad
|
||||
mov edi, [thread_count]
|
||||
movzx esi, word[WIN_POS + edi * 2]
|
||||
shl esi, 5
|
||||
shl esi, BSF sizeof.WDATA
|
||||
add esi, window_data
|
||||
|
||||
mov eax, [esi + WDATA.box.left]
|
||||
@ -1085,9 +1088,9 @@ minimize_all_window:
|
||||
align 4
|
||||
.loop:
|
||||
movzx edi, word[WIN_POS + eax * 2]
|
||||
shl edi, 5
|
||||
shl edi, BSF sizeof.WDATA
|
||||
; it is a unused slot?
|
||||
cmp byte [edi+TASK_TABLE+TASKDATA.state], TSTATE_FREE
|
||||
cmp byte [edi*8 + SLOT_BASE + APPDATA.state], TSTATE_FREE
|
||||
je @f
|
||||
; it is a hidden thread?
|
||||
lea esi, [edi*8+SLOT_BASE+APPDATA.app_name]
|
||||
@ -1133,7 +1136,7 @@ minimize_window:
|
||||
|
||||
; is it already minimized?
|
||||
movzx edi, word[WIN_POS + eax * 2]
|
||||
shl edi, 5
|
||||
shl edi, BSF sizeof.WDATA
|
||||
add edi, window_data
|
||||
test [edi + WDATA.fl_wstate], WSTATE_MINIMIZED
|
||||
jnz .exit
|
||||
@ -1194,7 +1197,7 @@ restore_minimized_window:
|
||||
; is it already restored?
|
||||
movzx esi, word[WIN_POS + eax * 2]
|
||||
mov edi, esi
|
||||
shl edi, 5
|
||||
shl edi, BSF sizeof.WDATA
|
||||
add edi, window_data
|
||||
test [edi + WDATA.fl_wstate], WSTATE_MINIMIZED
|
||||
jz .exit
|
||||
@ -1262,7 +1265,7 @@ align 4
|
||||
;> esi = process slot
|
||||
sys_window_maximize_handler:
|
||||
mov edi, esi
|
||||
shl edi, 5
|
||||
shl edi, BSF sizeof.WDATA
|
||||
add edi, window_data
|
||||
|
||||
; can window change its height?
|
||||
@ -1293,7 +1296,7 @@ sys_window_maximize_handler:
|
||||
align 4
|
||||
.restore_size:
|
||||
mov eax, esi
|
||||
shl eax, 8
|
||||
shl eax, BSF sizeof.APPDATA
|
||||
add eax, SLOT_BASE + APPDATA.saved_box
|
||||
push [eax + BOX.height] \
|
||||
[eax + BOX.width] \
|
||||
@ -1327,7 +1330,7 @@ align 4
|
||||
;> esi = process slot
|
||||
sys_window_rollup_handler:
|
||||
mov edx, esi
|
||||
shl edx, 8
|
||||
shl edx, BSF sizeof.APPDATA
|
||||
add edx, SLOT_BASE
|
||||
|
||||
; toggle normal/rolled up window state
|
||||
@ -1394,7 +1397,7 @@ sys_window_end_moving_handler:
|
||||
; call window._.end_moving__box
|
||||
|
||||
mov edi, esi
|
||||
shl edi, 5
|
||||
shl edi, BSF sizeof.WDATA
|
||||
add edi, window_data
|
||||
|
||||
test [fl_moving], 1
|
||||
@ -1630,7 +1633,7 @@ align 4
|
||||
;< edx = pointer to WDATA struct
|
||||
window._.sys_set_window:
|
||||
mov eax, [current_slot_idx]
|
||||
shl eax, 5
|
||||
shl eax, BSF sizeof.WDATA
|
||||
add eax, window_data
|
||||
; save window colors
|
||||
mov [eax + WDATA.cl_workarea], edx
|
||||
@ -1866,7 +1869,7 @@ end virtual
|
||||
cmp esi, 1
|
||||
jz .check_for_shaped_window
|
||||
mov edi, esi
|
||||
shl edi, 5
|
||||
shl edi, BSF sizeof.WDATA
|
||||
cmp [window_data + edi + WDATA.box.width], 0
|
||||
jnz .check_for_shaped_window
|
||||
cmp [window_data + edi + WDATA.box.height], 0
|
||||
@ -1875,7 +1878,7 @@ end virtual
|
||||
align 4
|
||||
.check_for_shaped_window:
|
||||
mov edi, esi
|
||||
shl edi, 8
|
||||
shl edi, BSF sizeof.APPDATA
|
||||
add edi, SLOT_BASE
|
||||
cmp [edi + APPDATA.wnd_shape], 0
|
||||
jne .shaped_window
|
||||
@ -1950,7 +1953,7 @@ align 4
|
||||
push edx ecx ; for loop - x,y size
|
||||
|
||||
mov ecx, esi
|
||||
shl ecx, 5
|
||||
shl ecx, BSF sizeof.WDATA
|
||||
mov edx, [window_data + ecx + WDATA.box.top]
|
||||
push [window_data + ecx + WDATA.box.width] ; for loop - width
|
||||
mov ecx, [window_data + ecx + WDATA.box.left]
|
||||
@ -2036,7 +2039,7 @@ window._.window_activate:
|
||||
; DEBUGF 1, "K : thread_count (0x%x)\n", ebx
|
||||
|
||||
movzx ebx, word[WIN_POS + ebx * 2]
|
||||
shl ebx, 5
|
||||
shl ebx, BSF sizeof.WDATA
|
||||
add eax, window_data
|
||||
mov al, [window_data + ebx + WDATA.fl_wstyle]
|
||||
and al, 0x0f
|
||||
@ -2191,8 +2194,8 @@ align 4
|
||||
ja .exit.no_redraw
|
||||
|
||||
movzx edx, word[esi]
|
||||
shl edx, 5 ; size of TASKDATA and WDATA is 32 bytes
|
||||
cmp byte [TASK_TABLE + edx + TASKDATA.state], TSTATE_FREE
|
||||
shl edx, BSF sizeof.WDATA ; size of TASKDATA and WDATA is 32 bytes
|
||||
cmp byte [SLOT_BASE + edx*8 - sizeof.APPDATA + APPDATA.state], TSTATE_FREE
|
||||
je .next_window
|
||||
|
||||
mov eax, [edi + WDATA.box.top]
|
||||
@ -2283,7 +2286,7 @@ align 4
|
||||
align 4
|
||||
.2:
|
||||
mov edi, [current_slot_idx]
|
||||
shl edi, 5
|
||||
shl edi, BSF sizeof.WDATA
|
||||
test [edi + window_data + WDATA.fl_wstyle], WSTYLE_HASCAPTION
|
||||
jz .exit
|
||||
mov edx, [edi * 8 + SLOT_BASE + APPDATA.wnd_caption]
|
||||
@ -2387,18 +2390,19 @@ align 4
|
||||
; void __fastcall get_window_rect(struct RECT* rc);
|
||||
; ecx = pointer to RECT
|
||||
window._.get_rect:
|
||||
mov eax, [TASK_BASE]
|
||||
mov eax, [current_slot_idx]
|
||||
shl eax, BSF sizeof.WDATA
|
||||
|
||||
mov edx, [eax-twdw + WDATA.box.left]
|
||||
mov edx, [eax + window_data + WDATA.box.left]
|
||||
mov [ecx+RECT.left], edx
|
||||
|
||||
add edx, [eax-twdw + WDATA.box.width]
|
||||
add edx, [eax + window_data + WDATA.box.width]
|
||||
mov [ecx+RECT.right], edx
|
||||
|
||||
mov edx, [eax-twdw + WDATA.box.top]
|
||||
mov edx, [eax +window_data + WDATA.box.top]
|
||||
mov [ecx+RECT.top], edx
|
||||
|
||||
add edx, [eax-twdw + WDATA.box.height]
|
||||
add edx, [eax + window_data + WDATA.box.height]
|
||||
mov [ecx+RECT.bottom], edx
|
||||
ret
|
||||
;------------------------------------------------------------------------------
|
||||
@ -2438,7 +2442,7 @@ window._.set_top_wnd:
|
||||
cmp ebp, 1
|
||||
jbe .exit
|
||||
|
||||
shl esi, 5
|
||||
shl esi, BSF sizeof.WDATA
|
||||
cmp [esi + window_data + WDATA.z_modif], ZPOS_ALWAYS_TOP
|
||||
je .exit
|
||||
|
||||
@ -2457,9 +2461,9 @@ align 4
|
||||
align 4
|
||||
.next_window:
|
||||
movzx edi, word[WIN_POS + esi * 2]
|
||||
shl edi, 5 ;size of TASKDATA and WDATA = 32 bytes
|
||||
shl edi, BSF sizeof.WDATA ;size of TASKDATA and WDATA = 32 bytes
|
||||
|
||||
cmp byte [TASK_TABLE + edi + TASKDATA.state], TSTATE_FREE
|
||||
cmp byte [SLOT_BASE + edi*8 + APPDATA.state], TSTATE_FREE
|
||||
je .skip_window
|
||||
|
||||
add edi, window_data
|
||||
|
@ -630,7 +630,6 @@ high_code:
|
||||
mov dword [current_slot_idx], 2
|
||||
mov [thread_count], 2
|
||||
mov dword [current_slot], SLOT_BASE + sizeof.APPDATA*2
|
||||
mov dword [TASK_BASE], TASK_TABLE + sizeof.TASKDATA*2
|
||||
|
||||
; Move other CPUs to deep sleep, if it is useful
|
||||
uglobal
|
||||
@ -1932,8 +1931,6 @@ sys_end:
|
||||
|
||||
mov eax, [current_slot]
|
||||
mov [eax+APPDATA.state], TSTATE_ZOMBIE
|
||||
mov eax, [TASK_BASE] ;
|
||||
mov [eax+TASKDATA.state], TSTATE_ZOMBIE ; delete
|
||||
call wakeup_osloop
|
||||
|
||||
.waitterm: ; wait here for termination
|
||||
@ -1953,7 +1950,7 @@ restore_default_cursor_before_killing:
|
||||
|
||||
add eax, [_display.win_map]
|
||||
movzx edx, byte [ebx+eax]
|
||||
shl edx, 8
|
||||
shl edx, BSF sizeof.APPDATA
|
||||
mov esi, [edx+SLOT_BASE+APPDATA.cursor]
|
||||
|
||||
cmp esi, [current_cursor]
|
||||
@ -2043,18 +2040,18 @@ sysfn_terminate: ; 18.2 = TERMINATE
|
||||
cmp ecx, edx
|
||||
ja noprocessterminate
|
||||
mov eax, [thread_count]
|
||||
shl ecx, BSF sizeof.TASKDATA
|
||||
mov edx, [ecx*8 + SLOT_BASE + APPDATA.tid]
|
||||
add ecx, TASK_TABLE+TASKDATA.state
|
||||
cmp byte [ecx], TSTATE_FREE
|
||||
shl ecx, BSF sizeof.APPDATA
|
||||
add ecx, SLOT_BASE
|
||||
mov edx, [ecx + APPDATA.tid]
|
||||
cmp byte [ecx + APPDATA.state], TSTATE_FREE
|
||||
jz noprocessterminate
|
||||
push eax
|
||||
lea eax, [(ecx-(TASK_TABLE and 1FFFFFFFh)-TASKDATA.state)*8+SLOT_BASE]
|
||||
mov eax, ecx
|
||||
call is_kernel_thread
|
||||
pop eax
|
||||
jz noprocessterminate
|
||||
push ecx edx
|
||||
lea edx, [(ecx-(TASK_TABLE and 1FFFFFFFh)-TASKDATA.state)*8+SLOT_BASE]
|
||||
mov edx, ecx
|
||||
call request_terminate
|
||||
pop edx ecx
|
||||
test eax, eax
|
||||
@ -2062,7 +2059,7 @@ sysfn_terminate: ; 18.2 = TERMINATE
|
||||
;--------------------------------------
|
||||
; terminate all network sockets it used
|
||||
pusha
|
||||
mov eax, edx
|
||||
mov eax, edx ;TODO: check function
|
||||
call socket_process_end
|
||||
popa
|
||||
;--------------------------------------
|
||||
@ -2082,7 +2079,7 @@ sysfn_terminate: ; 18.2 = TERMINATE
|
||||
.restore_end:
|
||||
;--------------------------------------
|
||||
;call MEM_Heap_Lock ;guarantee that process isn't working with heap
|
||||
mov [ecx], byte 3; clear possible i40's
|
||||
mov [ecx + APPDATA.state], TSTATE_ZOMBIE; clear possible i40's
|
||||
call wakeup_osloop
|
||||
;call MEM_Heap_UnLock
|
||||
|
||||
@ -2189,13 +2186,10 @@ sysfn_zmodif:
|
||||
|
||||
mov eax, edx
|
||||
shl edx, 5
|
||||
;shl edx, 8
|
||||
|
||||
;cmp [edx + SLOT_BASE + APPDATA.state], TSTATE_FREE
|
||||
cmp [edx + TASK_TABLE + TASKDATA.state], TSTATE_FREE
|
||||
cmp [edx*8 + SLOT_BASE + APPDATA.state], TSTATE_FREE
|
||||
je .fail
|
||||
|
||||
;shr edx, 3
|
||||
cmp ecx, 1
|
||||
jnz .set_zmod
|
||||
|
||||
@ -2665,7 +2659,6 @@ sys_cpuusage:
|
||||
|
||||
; Process state (+50)
|
||||
movzx eax, byte [ecx*8 + SLOT_BASE + APPDATA.state]
|
||||
movzx eax, byte [ecx+TASK_TABLE+TASKDATA.state]
|
||||
stosd
|
||||
|
||||
; Window client area box
|
||||
@ -2745,8 +2738,9 @@ sys_redrawstat:
|
||||
cmp ebx, 2
|
||||
jnz srl1
|
||||
|
||||
mov edx, [TASK_BASE] ; return whole screen draw area for this app
|
||||
add edx, draw_data - TASK_TABLE
|
||||
mov edx, [current_slot_idx] ; return whole screen draw area for this app
|
||||
shl edx, 5
|
||||
add edx, draw_data
|
||||
mov [edx + RECT.left], 0
|
||||
mov [edx + RECT.top], 0
|
||||
mov eax, [_display.width]
|
||||
@ -2909,7 +2903,7 @@ nocpustart:
|
||||
mov [mouse_active], 0
|
||||
|
||||
xor edi, edi
|
||||
mov ebx, TASK_TABLE
|
||||
mov ebx, window_data
|
||||
|
||||
mov ecx, [thread_count]
|
||||
movzx eax, word [WIN_POS + ecx*2] ; active window
|
||||
@ -2922,7 +2916,7 @@ nocpustart:
|
||||
align 4
|
||||
.set_mouse_event:
|
||||
add edi, sizeof.APPDATA
|
||||
add ebx, sizeof.TASKDATA
|
||||
add ebx, sizeof.WDATA
|
||||
test [edi + SLOT_BASE + APPDATA.event_mask], 0x80000000
|
||||
jz .pos_filter
|
||||
|
||||
@ -2934,17 +2928,17 @@ align 4
|
||||
test [edi + SLOT_BASE + APPDATA.event_mask], 0x40000000
|
||||
jz .set
|
||||
|
||||
mov esi, [ebx-twdw+WDATA.box.left]
|
||||
mov esi, [ebx + WDATA.box.left]
|
||||
cmp eax, esi
|
||||
jb .skip
|
||||
add esi, [ebx-twdw+WDATA.box.width]
|
||||
add esi, [ebx + WDATA.box.width]
|
||||
cmp eax, esi
|
||||
ja .skip
|
||||
|
||||
mov esi, [ebx-twdw+WDATA.box.top]
|
||||
mov esi, [ebx + WDATA.box.top]
|
||||
cmp edx, esi
|
||||
jb .skip
|
||||
add esi, [ebx-twdw+WDATA.box.height]
|
||||
add esi, [ebx + WDATA.box.height]
|
||||
cmp edx, esi
|
||||
ja .skip
|
||||
;--------------------------------------
|
||||
@ -3043,15 +3037,14 @@ nobackgr:
|
||||
jne noshutdown
|
||||
|
||||
lea ecx, [edx-1]
|
||||
mov edx, OS_BASE+0x3040
|
||||
mov edx, SLOT_BASE + sizeof.APPDATA ;OS_BASE+0x3040
|
||||
jecxz no_mark_system_shutdown
|
||||
;--------------------------------------
|
||||
align 4
|
||||
markz:
|
||||
push ecx edx
|
||||
cmp [edx+TASKDATA.state], TSTATE_FREE
|
||||
cmp [edx + APPDATA.state], TSTATE_FREE
|
||||
jz .nokill
|
||||
lea edx, [(edx-(TASK_TABLE and 1FFFFFFFh))*8+SLOT_BASE]
|
||||
cmp [edx+APPDATA.process], sys_proc
|
||||
jz .nokill
|
||||
call request_terminate
|
||||
@ -3063,10 +3056,9 @@ markz:
|
||||
pop edx ecx
|
||||
test eax, eax
|
||||
jz @f
|
||||
mov [edx+TASKDATA.state], TSTATE_ZOMBIE
|
||||
;mov [edx+APPDATA.state], TSTATE_ZOMBIE
|
||||
mov [edx + APPDATA.state], TSTATE_ZOMBIE
|
||||
@@:
|
||||
add edx, 0x20
|
||||
add edx, sizeof.APPDATA
|
||||
loop markz
|
||||
call wakeup_osloop
|
||||
;--------------------------------------
|
||||
@ -3079,7 +3071,7 @@ no_mark_system_shutdown:
|
||||
align 4
|
||||
noshutdown:
|
||||
mov eax, [thread_count] ; termination
|
||||
mov ebx, TASK_DATA+TASKDATA.state
|
||||
mov ebx, SLOT_BASE + sizeof.APPDATA + APPDATA.state
|
||||
mov esi, 1
|
||||
;--------------------------------------
|
||||
align 4
|
||||
@ -3107,7 +3099,7 @@ newct:
|
||||
je system_shutdown
|
||||
|
||||
.noterminate:
|
||||
add ebx, 0x20
|
||||
add ebx, sizeof.APPDATA
|
||||
inc esi
|
||||
dec eax
|
||||
jnz newct
|
||||
|
@ -1860,9 +1860,8 @@ socket_block:
|
||||
|
||||
; Suspend the thread
|
||||
push edx
|
||||
mov edx, [TASK_BASE]
|
||||
mov [edx + TASKDATA.state], TSTATE_RUN_SUSPENDED
|
||||
mov edx, [current_slot]
|
||||
mov [edx + APPDATA.state], TSTATE_RUN_SUSPENDED
|
||||
|
||||
; Remember the thread ID so we can wake it up again
|
||||
mov edx, [edx + APPDATA.tid]
|
||||
@ -1903,14 +1902,11 @@ socket_notify:
|
||||
jz .error2
|
||||
xor ecx, ecx
|
||||
inc ecx
|
||||
;mov esi, TASK_DATA
|
||||
mov esi, SLOT_BASE + sizeof.APPDATA
|
||||
.next:
|
||||
;cmp [esi + TASKDATA.pid], ebx
|
||||
cmp [esi + APPDATA.tid], ebx
|
||||
je .found
|
||||
inc ecx
|
||||
;add esi, sizeof.TASKDATA
|
||||
add esi, sizeof.APPDATA
|
||||
cmp ecx, [thread_count]
|
||||
jbe .next
|
||||
@ -1943,8 +1939,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
|
||||
shl ecx, BSF sizeof.TASKDATA
|
||||
mov [ecx + TASK_TABLE + TASKDATA.state], TSTATE_RUNNING ; Run the thread
|
||||
shl ecx, BSF sizeof.APPDATA
|
||||
mov [SLOT_BASE + ecx + APPDATA.state], TSTATE_RUNNING ; Run the thread
|
||||
|
||||
DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_notify: Unblocked socket!\n"
|
||||
pop esi ecx ebx
|
||||
|
@ -126,14 +126,14 @@ align 4
|
||||
cli
|
||||
|
||||
sub esp, sizeof.MUTEX_WAITER
|
||||
mov ebx, [TASK_BASE]
|
||||
mov ebx, [current_slot]
|
||||
mov [esp+MUTEX_WAITER.task], ebx
|
||||
lea esi, [ebp+FUTEX.wait_list]
|
||||
|
||||
list_add_tail esp, esi ;esp= new waiter, esi= list head
|
||||
mov eax, edx
|
||||
.again:
|
||||
mov [ebx+TASKDATA.state], TSTATE_RUN_SUSPENDED
|
||||
mov [ebx + APPDATA.state], TSTATE_RUN_SUSPENDED
|
||||
call change_task
|
||||
|
||||
lock cmpxchg [ecx], edx
|
||||
@ -179,10 +179,9 @@ align 4
|
||||
mov [ebx+APPDATA.wait_param], ebp
|
||||
mov eax, [timer_ticks]
|
||||
mov [ebx+APPDATA.wait_begin], eax
|
||||
mov eax, [TASK_BASE]
|
||||
mov [eax+TASKDATA.state], TSTATE_WAITING
|
||||
mov [ebx + APPDATA.state], TSTATE_WAITING
|
||||
|
||||
mov [esp+MUTEX_WAITER.task], eax
|
||||
mov [esp+MUTEX_WAITER.task], ebx
|
||||
lea esi, [ebp+FUTEX.wait_list]
|
||||
|
||||
list_add_tail esp, esi ;esp= new waiter, esi= list head
|
||||
@ -232,7 +231,7 @@ align 4
|
||||
je .done
|
||||
|
||||
mov eax, [esi+MUTEX_WAITER.task]
|
||||
mov [eax+TASKDATA.state], TSTATE_RUNNING
|
||||
mov [eax + APPDATA.state], TSTATE_RUNNING
|
||||
|
||||
mov esi, [esi+MUTEX_WAITER.list.next]
|
||||
inc ecx
|
||||
|
@ -181,7 +181,7 @@ pipe_read:
|
||||
je @F
|
||||
|
||||
mov ecx, [ecx+MUTEX_WAITER.task]
|
||||
mov [ecx+TASKDATA.state], TSTATE_RUNNING ;activate writer task
|
||||
mov [ecx + APPDATA.state], TSTATE_RUNNING ;activate writer task
|
||||
@@:
|
||||
cmp [ebp+PIPE.count], 0
|
||||
je @F
|
||||
@ -191,7 +191,7 @@ pipe_read:
|
||||
je @F
|
||||
|
||||
mov eax, [eax+MUTEX_WAITER.task]
|
||||
mov [eax+TASKDATA.state], TSTATE_RUNNING ;activate reader task
|
||||
mov [eax + APPDATA.state], TSTATE_RUNNING ;activate reader task
|
||||
@@:
|
||||
lea ecx, [ebp+PIPE.pipe_lock]
|
||||
call mutex_unlock
|
||||
@ -202,7 +202,7 @@ pipe_read:
|
||||
cli
|
||||
|
||||
sub esp, sizeof.MUTEX_WAITER
|
||||
mov ebx, [TASK_BASE]
|
||||
mov ebx, [current_slot]
|
||||
mov [esp+MUTEX_WAITER.task], ebx
|
||||
lea edx, [ebp+PIPE.rlist]
|
||||
|
||||
@ -211,7 +211,7 @@ pipe_read:
|
||||
lea ecx, [ebp+PIPE.pipe_lock]
|
||||
call mutex_unlock
|
||||
|
||||
mov [ebx+TASKDATA.state], TSTATE_RUN_SUSPENDED
|
||||
mov [ebx + APPDATA.state], TSTATE_RUN_SUSPENDED
|
||||
call change_task
|
||||
|
||||
lea ecx, [ebp+PIPE.pipe_lock]
|
||||
@ -276,7 +276,7 @@ pipe_write:
|
||||
je @F
|
||||
|
||||
mov eax, [eax+MUTEX_WAITER.task]
|
||||
mov [eax+TASKDATA.state], TSTATE_RUNNING ;activate reader task
|
||||
mov [eax + APPDATA.state], TSTATE_RUNNING ;activate reader task
|
||||
@@:
|
||||
cmp [ebp+PIPE.count], 4096
|
||||
je @F
|
||||
@ -286,7 +286,7 @@ pipe_write:
|
||||
je @F
|
||||
|
||||
mov ecx, [eax+MUTEX_WAITER.task]
|
||||
mov [ecx+TASKDATA.state], TSTATE_RUNNING ;activate writer task
|
||||
mov [ecx + APPDATA.state], TSTATE_RUNNING ;activate writer task
|
||||
@@:
|
||||
popfd
|
||||
|
||||
@ -305,7 +305,7 @@ pipe_write:
|
||||
cli
|
||||
|
||||
sub esp, sizeof.MUTEX_WAITER
|
||||
mov ecx, [TASK_BASE]
|
||||
mov ecx, [current_slot]
|
||||
mov [esp+MUTEX_WAITER.task], ecx
|
||||
lea edx, [ebp+PIPE.wlist]
|
||||
|
||||
@ -314,7 +314,7 @@ pipe_write:
|
||||
lea ecx, [ebp+PIPE.pipe_lock]
|
||||
call mutex_unlock
|
||||
|
||||
mov [ecx+TASKDATA.state], TSTATE_RUN_SUSPENDED
|
||||
mov [ecx + APPDATA.state], TSTATE_RUN_SUSPENDED
|
||||
call change_task
|
||||
|
||||
lea ecx, [ebp+PIPE.pipe_lock]
|
||||
|
@ -398,9 +398,6 @@ vesa12_drawbar:
|
||||
push ebx
|
||||
push ecx
|
||||
push edx
|
||||
;mov ecx, [TASK_BASE]
|
||||
;add eax, [ecx-twdw+WDATA.box.left]
|
||||
;add ebx, [ecx-twdw+WDATA.box.top]
|
||||
mov ecx, [current_slot_idx]
|
||||
shl ecx, 5
|
||||
add eax, [ecx + window_data + WDATA.box.left]
|
||||
@ -769,9 +766,6 @@ vesa12_putimage:
|
||||
push edx
|
||||
movzx eax, word [esp+2]
|
||||
movzx ebx, word [esp+0]
|
||||
;mov ecx, [TASK_BASE]
|
||||
;add eax, [ecx-twdw+WDATA.box.left]
|
||||
;add ebx, [ecx-twdw+WDATA.box.top]
|
||||
mov ecx, [current_slot_idx]
|
||||
shl ecx, 5
|
||||
add eax, [ecx + window_data + WDATA.box.left]
|
||||
|
@ -495,9 +495,6 @@ VGA_draw_bar:
|
||||
align 4
|
||||
VGA_draw_bar_1:
|
||||
mov [temp.cx], eax
|
||||
;mov eax, [TASK_BASE]
|
||||
;add ebx, [eax-twdw + 4]
|
||||
;mov eax, [eax-twdw + 0]
|
||||
mov eax, [current_slot_idx]
|
||||
shl eax, 5
|
||||
add ebx, [eax+window_data+WDATA.box.top]
|
||||
|
Loading…
Reference in New Issue
Block a user