From a041bc55dbb21a8ae671c94214bd85200935833e Mon Sep 17 00:00:00 2001 From: Max Wash Date: Sat, 21 Mar 2026 10:44:21 +0000 Subject: [PATCH] lib: c: rt: call task_exit once main() returns --- lib/libc/runtime/x86_64/crt0.s | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/libc/runtime/x86_64/crt0.s b/lib/libc/runtime/x86_64/crt0.s index 5096aa2..514aeb3 100644 --- a/lib/libc/runtime/x86_64/crt0.s +++ b/lib/libc/runtime/x86_64/crt0.s @@ -6,6 +6,9 @@ .extern main .type main, @function +.extern task_exit +.type task_exit, @function + _start: # Args (as provided by the ABI) # %rdi: int argc @@ -13,4 +16,7 @@ _start: # %rdx: kern_handle_t task # %rcx: kern_handle_t address_space call main + + mov %rax, %rdi + call task_exit 1: jmp 1b