diff --git a/fox32os.def b/fox32os.def index 73203f1..416bed3 100644 --- a/fox32os.def +++ b/fox32os.def @@ -12,6 +12,7 @@ yield_task: jmp [0x00000A14] end_current_task: jmp [0x00000A18] get_current_task_id: jmp [0x00000A1C] get_unused_task_id: jmp [0x00000A20] +is_task_id_used: jmp [0x00000A24] ; memory jump table allocate_memory: jmp [0x00000B10] diff --git a/kernel/main.asm b/kernel/main.asm index be8c166..8bb9503 100644 --- a/kernel/main.asm +++ b/kernel/main.asm @@ -28,6 +28,7 @@ jump_table: data.32 end_current_task data.32 get_current_task_id data.32 get_unused_task_id + data.32 is_task_id_used ; memory jump table org.pad 0x00000B10 diff --git a/kernel/task.asm b/kernel/task.asm index 365be5f..7f16700 100644 --- a/kernel/task.asm +++ b/kernel/task.asm @@ -133,6 +133,15 @@ get_current_task_id: pop r2 ret +; check if a task ID is used +; inputs: +; r0: task ID +; outputs: +; Z flag: set if unused, reset if used +is_task_id_used: + bts [task_id_bitmap], r0 + ret + task_load: mov r2, [r0] ; task ID add r0, 4