From 0d57361f667494e063f621c46bdd028df2efd7e8 Mon Sep 17 00:00:00 2001 From: Ry Date: Thu, 23 Jun 2022 16:38:05 -0700 Subject: [PATCH] Allow tasks to not free their memory when they end --- kernel/task.asm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kernel/task.asm b/kernel/task.asm index 1f04979..89c13d4 100644 --- a/kernel/task.asm +++ b/kernel/task.asm @@ -5,7 +5,7 @@ ; r0: task ID ; r1: pointer to task code ; r2: pointer to task stack -; r3: pointer to memory block to free when task ends +; r3: pointer to memory block to free when task ends, or zero for none ; outputs: ; none new_task: @@ -52,7 +52,8 @@ end_current_task: call task_load bcl [task_id_bitmap], r2 ; mark this task ID as unused mov r0, r5 ; memory block pointer - call free_memory + cmp r0, 0 + ifnz call free_memory end_current_task_no_mark_no_free: pop r0 ; pop the return address off of the stack