Re: [PATCH][AArch32][libgloss] Fix semihosting SYS_EXIT call on semihosting v1.

Corinna Vinschen <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
On Jul 11 12:39, Tamar Christina wrote:
> From 5c8c95cdf19602fb3ad569fbcbeda4ce5304b537 Mon Sep 17 00:00:00 2001
> From: Tamar Christina <[email protected]>
> 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 <[email protected]>
> ---
>  libgloss/arm/_kill.c | 6 ++++++
>  1 file changed, 6 insertions(+)

Pushed.


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEoVYPmneWZnwT6kwF9TYGna5ET6AFAltGH80ACgkQ9TYGna5E
T6C4iBAAiwc6ywezDNQW9i4uR4kRLsu76SGfIw28nONti1iNoQfc/H2mGbIk0DAH
kQgNWIMWO35bJTJObTJP3FS8O7BBG2q1PsTUC+3uWqjroCuBkDGa4bmJTi7kuyEE
0XMC01crkhkekonTcq2UgmTIONbRLqXePys2Rj1Sqz+SRpkVZ7rSwCTFqUy+EHUZ
ftAZsRfx0fTw2af83t08cb7xoxQ/EdrJEd1Z8/wCU+B+pNVWXXMk24ZCDk0BJM02
mslb4+pNUfUK8Jbbk+rEc22g5KqXrj0159qMCwqRE/GB2mlCADI1UCx+dHPQ0IOG
1ENbZfAEIDelc4ptPzlopcd4vT9tZQtOTeb0oJDIbCLh61MbKFkI7UKJb1Q9VHwL
N9RCpfNPej0JEkmj0NFiMR9xfUkKwCSCVQbgdKPNzzzpJuhot3r+3rth2yI+JPyF
YK5r0wfNe1PlYI1Cukao9uQzZkNxz7QVf0r/hzWCqk0y4SCMosfU4OQkxwB2gR7u
QvovMT9j/wJInPGeqFFdpqgpyETw9vlbcc15RyyPHVZFLndPVUKosdbnKl/LwP8H
gEn5UtLjXVVDBPV5E3GVoH8uvXo6jw0A0sRfx3/ZB6z7rqP1iX5nP1UoeY/9a5N5
OK/GN8LVUX0aHwJJI8U8KEc/8bvYRydjkujRUm7jFUdyxNfuK+Q=
=idTs
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.