qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] target/nios2: Pass semihosting arg to exit
@ 2023-08-01 15:22 Keith Packard via
  2023-08-01 15:24 ` Peter Maydell
  2023-08-01 21:45 ` Philippe Mathieu-Daudé
  0 siblings, 2 replies; 9+ messages in thread
From: Keith Packard via @ 2023-08-01 15:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Chris Wulff, Marek Vasut, Keith Packard

Instead of using R_ARG0 (the semihost function number), use R_ARG1
(the provided exit status).

Signed-off-by: Keith Packard <keithp@keithp.com>
---
 target/nios2/nios2-semi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/nios2/nios2-semi.c b/target/nios2/nios2-semi.c
index 3738774976..f3b7aee4f1 100644
--- a/target/nios2/nios2-semi.c
+++ b/target/nios2/nios2-semi.c
@@ -133,8 +133,8 @@ void do_nios2_semihosting(CPUNios2State *env)
     args = env->regs[R_ARG1];
     switch (nr) {
     case HOSTED_EXIT:
-        gdb_exit(env->regs[R_ARG0]);
-        exit(env->regs[R_ARG0]);
+        gdb_exit(env->regs[R_ARG1]);
+        exit(env->regs[R_ARG1]);
 
     case HOSTED_OPEN:
         GET_ARG(0);
-- 
2.40.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread
* [PATCH] target/nios2: Pass semihosting arg to exit
@ 2023-07-31 22:41 Keith Packard via
  2023-08-01 12:04 ` Peter Maydell
  0 siblings, 1 reply; 9+ messages in thread
From: Keith Packard via @ 2023-07-31 22:41 UTC (permalink / raw)
  To: qemu-devel; +Cc: Chris Wulff, Marek Vasut, Keith Packard

Instead of using the function number (which is always zero), fetch the
application-provided exit code argument and pass that to the two exit
functions.

Signed-off-by: Keith Packard <keithp@keithp.com>
---
 target/nios2/nios2-semi.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/target/nios2/nios2-semi.c b/target/nios2/nios2-semi.c
index 3738774976..ffd1f095f6 100644
--- a/target/nios2/nios2-semi.c
+++ b/target/nios2/nios2-semi.c
@@ -133,8 +133,9 @@ void do_nios2_semihosting(CPUNios2State *env)
     args = env->regs[R_ARG1];
     switch (nr) {
     case HOSTED_EXIT:
-        gdb_exit(env->regs[R_ARG0]);
-        exit(env->regs[R_ARG0]);
+        GET_ARG(0);
+        gdb_exit(arg0);
+        exit(arg0);
 
     case HOSTED_OPEN:
         GET_ARG(0);
-- 
2.40.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-08-01 21:46 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-01 15:22 [PATCH] target/nios2: Pass semihosting arg to exit Keith Packard via
2023-08-01 15:24 ` Peter Maydell
2023-08-01 21:45 ` Philippe Mathieu-Daudé
  -- strict thread matches above, loose matches on Subject: below --
2023-07-31 22:41 Keith Packard via
2023-08-01 12:04 ` Peter Maydell
2023-08-01 15:10   ` Keith Packard via
2023-08-01 15:17     ` Peter Maydell
2023-08-01 15:28       ` Keith Packard via
2023-08-01 15:33         ` Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).