Per the "Semihosting for AArch32 and AArch64" spec. v2 (2023Q3) [*]:
6.5 SYS_EXIT (0x18)
6.5.2 Entry (64-bit)
On entry, the PARAMETER REGISTER contains a pointer to
a two-field argument block:
. field 1
The exception type, which is one of the set of reason
codes in the above tables.
. field 2
A subcode, whose meaning depends on the reason code in
field 1.
In particular, if field 1 is ADP_Stopped_ApplicationExit
then field 2 is an exit status code, as passed to the C
standard library exit() function. [...]
Having libc exit() is declared as:
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
void
exit(int status);
the status is expected to be signed.
[*]
https://github.com/ARM-software/abi-aa/blob/2023q3-release/semihosting/semihosting.rst#652entry-64-bit
Fixes: 7446d35e1d ("target-arm/arm-semi.c: SYS_EXIT on A64 takes a parameter
block")
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
---
Based-on: <[email protected]>
---
semihosting/arm-compat-semi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/semihosting/arm-compat-semi.c b/semihosting/arm-compat-semi.c
index 0033a1e018..c419d0c33a 100644
--- a/semihosting/arm-compat-semi.c
+++ b/semihosting/arm-compat-semi.c
@@ -725,7 +725,7 @@ void do_common_semihosting(CPUState *cs)
case TARGET_SYS_EXIT:
case TARGET_SYS_EXIT_EXTENDED:
{
- uint32_t ret;
+ int ret;
if (common_semi_sys_exit_extended(cs, nr)) {
/*
--
2.41.0