From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=55011 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PqTCr-0003r6-Px for qemu-devel@nongnu.org; Fri, 18 Feb 2011 11:29:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PqTCq-00008t-Gk for qemu-devel@nongnu.org; Fri, 18 Feb 2011 11:29:21 -0500 Received: from eu1sys200aog104.obsmtp.com ([207.126.144.117]:41277) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PqTCq-00008i-8C for qemu-devel@nongnu.org; Fri, 18 Feb 2011 11:29:20 -0500 Message-ID: <4D5E9E5C.70809@st.com> Date: Fri, 18 Feb 2011 17:29:16 +0100 From: Christophe Lyon MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] target-arm: return the right exit code when using semi-hosting. References: <1298043923-13787-1-git-send-email-christophe.lyon@st.com> In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: "qemu-devel@nongnu.org" On 18.02.2011 17:13, Peter Maydell wrote: > > 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 Indeed. > 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. Well, exit() is documented in the C ISO standard, so using its argument as exit code is doing what the user expects. > 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. We are using qemu to execute programs compiled in bare machine mode (eg with arm-none-eabi-gcc as opposed to arm-none-linux-gnueabi-gcc), where semihosting is used to communicate with the host environment. And we lack support for exit code. Christophe.