[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 01/33] Pass semihosting exit code back to system.
From: |
Peter Maydell |
Subject: |
[Qemu-devel] [PULL 01/33] Pass semihosting exit code back to system. |
Date: |
Thu, 11 Dec 2014 12:19:23 +0000 |
From: Liviu Ionescu <address@hidden>
In order to run unit tests under semihosting, it is necessary to pass the
application exit code back to the system.
ARM defines only the code to be used for non-error application exit
(ADP_Stopped_ApplicationExit), all other codes should return non-zero
exit codes.
This patch checks if the application code passed via TARGET_SYS_EXIT is
ADP_Stopped_ApplicationExit, and return 0, otherwise return 1.
Signed-off-by: Liviu Ionescu <address@hidden>
Signed-off-by: Peter Maydell <address@hidden>
---
target-arm/arm-semi.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/target-arm/arm-semi.c b/target-arm/arm-semi.c
index ebb5235..a8b83e6 100644
--- a/target-arm/arm-semi.c
+++ b/target-arm/arm-semi.c
@@ -58,6 +58,10 @@
#define TARGET_SYS_HEAPINFO 0x16
#define TARGET_SYS_EXIT 0x18
+/* ADP_Stopped_ApplicationExit is used for exit(0),
+ * anything else is implemented as exit(1) */
+#define ADP_Stopped_ApplicationExit (0x20026)
+
#ifndef O_BINARY
#define O_BINARY 0
#endif
@@ -551,8 +555,11 @@ uint32_t do_arm_semihosting(CPUARMState *env)
return 0;
}
case TARGET_SYS_EXIT:
- gdb_exit(env, 0);
- exit(0);
+ /* ARM specifies only Stopped_ApplicationExit as normal
+ * exit, everything else is considered an error */
+ ret = (args == ADP_Stopped_ApplicationExit) ? 0 : 1;
+ gdb_exit(env, ret);
+ exit(ret);
default:
fprintf(stderr, "qemu: Unsupported SemiHosting SWI 0x%02x\n", nr);
cpu_dump_state(cs, stderr, fprintf, 0);
--
1.9.1
- [Qemu-devel] [PULL 10/33] target-arm: move AArch32 SCR into security reglist, (continued)
- [Qemu-devel] [PULL 10/33] target-arm: move AArch32 SCR into security reglist, Peter Maydell, 2014/12/11
- [Qemu-devel] [PULL 09/33] target-arm: insert AArch32 cpregs twice into hashtable, Peter Maydell, 2014/12/11
- [Qemu-devel] [PULL 07/33] target-arm: add CPREG secure state support, Peter Maydell, 2014/12/11
- [Qemu-devel] [PULL 06/33] target-arm: add non-secure Translation Block flag, Peter Maydell, 2014/12/11
- [Qemu-devel] [PULL 05/33] target-arm: add banked register accessors, Peter Maydell, 2014/12/11
- [Qemu-devel] [PULL 02/33] Add the "-semihosting-config" option., Peter Maydell, 2014/12/11
- [Qemu-devel] [PULL 20/33] target-arm: make DACR banked, Peter Maydell, 2014/12/11
- [Qemu-devel] [PULL 08/33] target-arm: add secure state bit to CPREG hash, Peter Maydell, 2014/12/11
- [Qemu-devel] [PULL 03/33] target-arm: extend async excp masking, Peter Maydell, 2014/12/11
- [Qemu-devel] [PULL 13/33] target-arm: add SDER definition, Peter Maydell, 2014/12/11
- [Qemu-devel] [PULL 01/33] Pass semihosting exit code back to system.,
Peter Maydell <=
- [Qemu-devel] [PULL 04/33] target-arm: add async excp target_el function, Peter Maydell, 2014/12/11
- Re: [Qemu-devel] [PULL 00/33] target-arm queue, Peter Maydell, 2014/12/11