[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [Bug 1216845] Re: qemu-system-arm semihosting always ca
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [Bug 1216845] Re: qemu-system-arm semihosting always calls exit(0) |
Date: |
Wed, 4 Feb 2015 20:21:15 +0000 |
On 4 February 2015 at 15:56, Karl Zimmerman
<address@hidden> wrote:
> Had a similar problem with my emulation environment. However, I did
> some inspection of the assembly code generated by newlib for ARM semi-
> hosting. While it initially appears that exit() and _exit() discard the
> status code, upon careful inspection one finds that it is pushed on the
> stack, with the SP pointing right to it at the point at which the SWI is
> executed.
>
> Thus, if the code passed to 0x18 is 0x20026, you can fetch the status
> code passed to exit() from the stack.
Yes, but this is an internal implementation detail of newlib,
not a part of the semihosting ABI. It might well change
in different versions of newlib and we can't rely on it.
-- PMM