Allow tasks to not free their memory when they end

This commit is contained in:
Ry 2022-06-23 16:38:05 -07:00
parent d1d2df0d74
commit 0d57361f66

View File

@ -5,7 +5,7 @@
; r0: task ID ; r0: task ID
; r1: pointer to task code ; r1: pointer to task code
; r2: pointer to task stack ; 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: ; outputs:
; none ; none
new_task: new_task:
@ -52,7 +52,8 @@ end_current_task:
call task_load call task_load
bcl [task_id_bitmap], r2 ; mark this task ID as unused bcl [task_id_bitmap], r2 ; mark this task ID as unused
mov r0, r5 ; memory block pointer mov r0, r5 ; memory block pointer
call free_memory cmp r0, 0
ifnz call free_memory
end_current_task_no_mark_no_free: end_current_task_no_mark_no_free:
pop r0 ; pop the return address off of the stack pop r0 ; pop the return address off of the stack