[PATCH v2 5/7] target/mips: use semihosting_exit_request on semihosted exit syscall

Luc Michel posted 7 patches 3 years, 7 months ago
Maintainers: "Alex Bennée" <alex.bennee@linaro.org>, Eric Blake <eblake@redhat.com>, Markus Armbruster <armbru@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, Laurent Vivier <laurent@vivier.eu>, "Philippe Mathieu-Daudé" <f4bug@amsat.org>, Aurelien Jarno <aurelien@aurel32.net>, Jiaxun Yang <jiaxun.yang@flygoat.com>, Aleksandar Rikalo <aleksandar.rikalo@syrmia.com>, Chris Wulff <crwulff@gmail.com>, Marek Vasut <marex@denx.de>, Max Filippov <jcmvbkbc@gmail.com>
[PATCH v2 5/7] target/mips: use semihosting_exit_request on semihosted exit syscall
Posted by Luc Michel 3 years, 7 months ago
Use the new semihosting_exit_request instead of a call to exit when
handling a semihosted exit syscall.

Signed-off-by: Luc Michel <lmichel@kalray.eu>
---
 target/mips/tcg/sysemu/mips-semi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/mips/tcg/sysemu/mips-semi.c b/target/mips/tcg/sysemu/mips-semi.c
index b4a383ae90..94be486925 100644
--- a/target/mips/tcg/sysemu/mips-semi.c
+++ b/target/mips/tcg/sysemu/mips-semi.c
@@ -245,11 +245,11 @@ void helper_do_semihosting(CPUMIPSState *env)
     char *p, *p2;
 
     switch (op) {
     case UHI_exit:
         qemu_log("UHI(%d): exit(%d)\n", op, (int)gpr[4]);
-        exit(gpr[4]);
+        semihosting_exit_request(gpr[4]);
     case UHI_open:
         GET_TARGET_STRING(p, gpr[4]);
         if (!strcmp("/dev/stdin", p)) {
             gpr[2] = 0;
         } else if (!strcmp("/dev/stdout", p)) {
-- 
2.17.1
Re: [PATCH v2 5/7] target/mips: use semihosting_exit_request on semihosted exit syscall
Posted by Laurent Vivier 3 years, 7 months ago
Le 21/06/2022 à 14:59, Luc Michel a écrit :
> Use the new semihosting_exit_request instead of a call to exit when
> handling a semihosted exit syscall.
> 
> Signed-off-by: Luc Michel <lmichel@kalray.eu>
> ---
>   target/mips/tcg/sysemu/mips-semi.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/target/mips/tcg/sysemu/mips-semi.c b/target/mips/tcg/sysemu/mips-semi.c
> index b4a383ae90..94be486925 100644
> --- a/target/mips/tcg/sysemu/mips-semi.c
> +++ b/target/mips/tcg/sysemu/mips-semi.c
> @@ -245,11 +245,11 @@ void helper_do_semihosting(CPUMIPSState *env)
>       char *p, *p2;
>   
>       switch (op) {
>       case UHI_exit:
>           qemu_log("UHI(%d): exit(%d)\n", op, (int)gpr[4]);
> -        exit(gpr[4]);
> +        semihosting_exit_request(gpr[4]);
>       case UHI_open:
>           GET_TARGET_STRING(p, gpr[4]);
>           if (!strcmp("/dev/stdin", p)) {
>               gpr[2] = 0;
>           } else if (!strcmp("/dev/stdout", p)) {


Reviewed-by: Laurent Vivier <laurent@vivier.eu>