From 5c804fa301225434e02f0481e4b571763c527ec5 Mon Sep 17 00:00:00 2001 From: Alexander Myltsev Date: Tue, 13 Dec 2022 00:51:05 +0300 Subject: [PATCH] crt.c: extract _exit. --- user/crt.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/user/crt.c b/user/crt.c index 1a42f40..12dd78e 100644 --- a/user/crt.c +++ b/user/crt.c @@ -1,6 +1,9 @@ int main(); -void _start() { - int exit_status = main(); - asm("int $0x84": :"a"(exit_status)); +void _exit(int exit_status) { + asm("int $0x84": : "a"(0), "b"(exit_status)); +} + +void _start() { + _exit(main()); }