[PATCH][AArch32][libgloss] Fix semihosting SYS_EXIT call on semihosting v1.
Corinna Vinschen
vinschen@redhat.com
Thu Jul 12 15:32:00 GMT 2018
On Jul 11 12:39, Tamar Christina wrote:
> From 5c8c95cdf19602fb3ad569fbcbeda4ce5304b537 Mon Sep 17 00:00:00 2001
> From: Tamar Christina <tamar.christina@arm.com>
> Date: Wed, 11 Jul 2018 13:26:16 +0100
> Subject: [PATCH] Fix AArch32 semihosting SYS_EXIT call on semihosting v1.
>
> The current SYS_EXIT has a bug that when making the call it always uses
> the v2 calling convention. This is undefined behavior according to the
> semihosting specification:
> https://developer.arm.com/docs/100863/latest/semihosting-operations/sys_exit-0x18
>
> This patch fixes it by making sure v1 passes the argument directly in the register instead
> of in a block. And for v2 it does the same if the v2 extension isn't supported.
>
> The sequence generated now is
>
> 12424: ebfffecd bl 11f60 <_has_ext_exit_extended>
> 12428: e3500000 cmp r0, #0
> 1242c: 11a0500d movne r5, sp
> 12430: 059d5000 ldreq r5, [sp]
> 12434: e1a00004 mov r0, r4
> 12438: e1a01005 mov r1, r5
> 1243c: ef00f000 svc 0x0000f000
>
> Signed-off-by: Tamar Christina <tamar.christina@arm.com>
> ---
> libgloss/arm/_kill.c | 6 ++++++
> 1 file changed, 6 insertions(+)
Pushed.
Thanks,
Corinna
--
Corinna Vinschen
Cygwin Maintainer
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/newlib/attachments/20180712/b6ded45c/attachment.sig>
More information about the Newlib
mailing list