forked from KolibriOS/kolibrios
refactoring pid_to_slot:
- use constants instead of hardcoded values - add more comments git-svn-id: svn://kolibrios.org@8851 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
31048e6d73
commit
75fe8b68da
@ -219,6 +219,7 @@ OS_BASE = 0x80000000
|
|||||||
|
|
||||||
window_data = OS_BASE + 0x0001000
|
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_COUNT = OS_BASE + 0x0003004
|
||||||
TASK_BASE = OS_BASE + 0x0003010
|
TASK_BASE = OS_BASE + 0x0003010
|
||||||
|
@ -484,15 +484,19 @@ pid_to_slot:
|
|||||||
push ebx
|
push ebx
|
||||||
push ecx
|
push ecx
|
||||||
mov ebx, [TASK_COUNT]
|
mov ebx, [TASK_COUNT]
|
||||||
shl ebx, 5
|
shl ebx, 5 ; ebx *= 32 (32 is size of TASKDATA struct)
|
||||||
|
; add 2*32 cause:
|
||||||
|
; 0x80003000 - 0x80003020 isnt a task actually
|
||||||
|
; skip first process in the task table
|
||||||
mov ecx, 2*32
|
mov ecx, 2*32
|
||||||
|
|
||||||
.loop:
|
.loop:
|
||||||
;ecx=offset of current process info entry
|
;ecx = offset of current process info entry
|
||||||
;ebx=maximum permitted offset
|
;ebx = maximum permitted offset
|
||||||
cmp byte [CURRENT_TASK+ecx+0xa], 9
|
; state 9 means "not used"
|
||||||
|
cmp byte [TASK_TABLE+ecx+TASKDATA.state], 9
|
||||||
jz .endloop ;skip empty slots
|
jz .endloop ;skip empty slots
|
||||||
cmp [CURRENT_TASK+ecx+0x4], eax;check PID
|
cmp [TASK_TABLE+ecx+TASKDATA.pid], eax;check PID
|
||||||
jz .pid_found
|
jz .pid_found
|
||||||
.endloop:
|
.endloop:
|
||||||
add ecx, 32
|
add ecx, 32
|
||||||
|
Loading…
Reference in New Issue
Block a user