On 18 February 2011 15:45, Christophe Lyon <christophe.l...@st.com> wrote: > On ARM, the SYS_EXIT semi-hosting call has no room for application > exit code, hence exiting a program from qemu always returns 0. > > This patch catches to argument passed to exit() and uses it as the > return code when processing SYS_EXIT.
I'm afraid you've just run into the limitations of semihosting as an API again: it doesn't provide a way for programs to pass out an exit code, and trying to shoehorn back doors for this into qemu just results in ugly code in qemu. The qemu implementation of semihosting should implement the semihosting API, not semihosting with weird undocumented extras. If you care about this sort of thing then linux-user mode is probably a better approach, as that is actually designed for a unixish program to run as-if-natively. -- PMM