From 7b681c5926d3699b33c936e34a8176833a03eaf2 Mon Sep 17 00:00:00 2001 From: Mathias Krause Date: Tue, 7 Feb 2017 19:03:29 +0100 Subject: libpayload: x86/main - propagate return value of main() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit According to coreboot’s payload API [1], the called payload should be able to return a value via %eax. Support this by changing the prototype of start_main() and pass on the return value of main() to the caller instead of discarding it. [1] https://www.coreboot.org/Payload_API Change-Id: I8442faea19cc8e04487092f8e61aa4e5cba3ba76 Signed-off-by: Mathias Krause Reviewed-on: https://review.coreboot.org/18334 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel Reviewed-by: Aaron Durbin --- payloads/libpayload/arch/x86/main.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'payloads') diff --git a/payloads/libpayload/arch/x86/main.c b/payloads/libpayload/arch/x86/main.c index fbd4dc4e18..f9a5e2cf83 100644 --- a/payloads/libpayload/arch/x86/main.c +++ b/payloads/libpayload/arch/x86/main.c @@ -42,8 +42,8 @@ char *main_argv[MAX_ARGC_COUNT]; * This is our C entry function - set up the system * and jump into the payload entry point. */ -void start_main(void); -void start_main(void) +int start_main(void); +int start_main(void) { extern int main(int argc, char **argv); @@ -67,10 +67,9 @@ void start_main(void) * In the future we may care about the return value. */ - (void) main(main_argc, (main_argc != 0) ? main_argv : NULL); - /* - * Returning here will go to the _leave function to return + * Returning from main() will go to the _leave function to return * us to the original context. */ + return main(main_argc, (main_argc != 0) ? main_argv : NULL); } -- cgit v1.2.3