Add get_current_task_id
This commit is contained in:
parent
df95829e83
commit
887ebc4553
|
@ -10,6 +10,8 @@ parse_fxf_binary: jmp [0x00000910]
|
||||||
new_task: jmp [0x00000A10]
|
new_task: jmp [0x00000A10]
|
||||||
yield_task: jmp [0x00000A14]
|
yield_task: jmp [0x00000A14]
|
||||||
end_current_task: jmp [0x00000A18]
|
end_current_task: jmp [0x00000A18]
|
||||||
|
get_current_task_id: jmp [0x00000A1C]
|
||||||
|
get_unused_task_id: jmp [0x00000A20]
|
||||||
|
|
||||||
; memory jump table
|
; memory jump table
|
||||||
allocate_memory: jmp [0x00000B10]
|
allocate_memory: jmp [0x00000B10]
|
||||||
|
|
|
@ -26,6 +26,8 @@ jump_table:
|
||||||
data.32 new_task
|
data.32 new_task
|
||||||
data.32 yield_task
|
data.32 yield_task
|
||||||
data.32 end_current_task
|
data.32 end_current_task
|
||||||
|
data.32 get_current_task_id
|
||||||
|
data.32 get_unused_task_id
|
||||||
|
|
||||||
; memory jump table
|
; memory jump table
|
||||||
org.pad 0x00000B10
|
org.pad 0x00000B10
|
||||||
|
|
|
@ -106,10 +106,33 @@ get_unused_task_id_loop:
|
||||||
inc r0
|
inc r0
|
||||||
cmp r0, 32
|
cmp r0, 32
|
||||||
iflt jmp get_unused_task_id_loop
|
iflt jmp get_unused_task_id_loop
|
||||||
; if we reach this point, then add task IDs are used
|
; if we reach this point, then all task IDs are used
|
||||||
mov r0, 0
|
mov r0, 0
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
; get the task ID of the currently running task
|
||||||
|
; inputs:
|
||||||
|
; none
|
||||||
|
; outputs:
|
||||||
|
; r0: task ID
|
||||||
|
get_current_task_id:
|
||||||
|
push r2
|
||||||
|
push r3
|
||||||
|
push r4
|
||||||
|
push r5
|
||||||
|
push r6
|
||||||
|
|
||||||
|
mov r0, current_task
|
||||||
|
call task_load
|
||||||
|
mov r0, r2
|
||||||
|
|
||||||
|
pop r6
|
||||||
|
pop r5
|
||||||
|
pop r4
|
||||||
|
pop r3
|
||||||
|
pop r2
|
||||||
|
ret
|
||||||
|
|
||||||
task_load:
|
task_load:
|
||||||
mov r2, [r0] ; task ID
|
mov r2, [r0] ; task ID
|
||||||
add r0, 4
|
add r0, 4
|
||||||
|
|
Loading…
Reference in New Issue
Block a user