From deaa17cc2726c1e9d5c009cee754223278ddb08f Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Mon, 4 Mar 2024 14:41:20 +0100 Subject: [PATCH] core/init: set _native_retval to retval of main() --- core/lib/init.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/core/lib/init.c b/core/lib/init.c index 6b3cccd3e4..e21f6bff84 100644 --- a/core/lib/init.c +++ b/core/lib/init.c @@ -74,6 +74,17 @@ static void *main_trampoline(void *arg) } #endif +#ifdef CPU_NATIVE + extern unsigned _native_retval; + if (!_native_retval) { + _native_retval = res; + } +#endif + + if (IS_ACTIVE(CONFIG_CORE_EXIT_WITH_MAIN)) { + pm_off(); + } + return NULL; }