From: Mike Frysinger <vapier@gentoo.org>
To: gdb-patches@sourceware.org
Subject: [PATCH] sim: mn10300: resolve syscalls dynamically
Date: Sun, 28 Nov 2021 01:05:24 -0500 [thread overview]
Message-ID: <20211128060524.28522-1-vapier@gentoo.org> (raw)
Avoid use of TARGET_<syscall> defines and rely on the callback layers
to resolve these dynamically so we can support multiple syscall layers
instead of assuming the newlib/libgloss numbers all the time.
---
sim/mn10300/mn10300.igen | 2 +-
sim/mn10300/mn10300_sim.h | 2 +-
sim/mn10300/op_utils.c | 5 ++---
3 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/sim/mn10300/mn10300.igen b/sim/mn10300/mn10300.igen
index f67468da17eb..9431c0b51790 100644
--- a/sim/mn10300/mn10300.igen
+++ b/sim/mn10300/mn10300.igen
@@ -3947,7 +3947,7 @@
{
/* OP_F0C0 (); */
PC = cia;
- do_syscall ();
+ do_syscall (SD);
}
diff --git a/sim/mn10300/mn10300_sim.h b/sim/mn10300/mn10300_sim.h
index f3e43a7c69ad..82306e667d2f 100644
--- a/sim/mn10300/mn10300_sim.h
+++ b/sim/mn10300/mn10300_sim.h
@@ -200,7 +200,7 @@ INLINE_SIM_MAIN (void) genericCmp (unsigned32 leftOpnd, unsigned32 rightOpnd);
INLINE_SIM_MAIN (void) genericOr (unsigned32 source, unsigned32 destReg);
INLINE_SIM_MAIN (void) genericXor (unsigned32 source, unsigned32 destReg);
INLINE_SIM_MAIN (void) genericBtst (unsigned32 leftOpnd, unsigned32 rightOpnd);
-INLINE_SIM_MAIN (void) do_syscall (void);
+INLINE_SIM_MAIN (void) do_syscall (SIM_DESC sd);
void program_interrupt (SIM_DESC sd, sim_cpu *cpu, sim_cia cia, SIM_SIGNAL sig);
void mn10300_cpu_exception_trigger(SIM_DESC sd, sim_cpu* cpu, address_word pc);
diff --git a/sim/mn10300/op_utils.c b/sim/mn10300/op_utils.c
index df95be3b1ac4..eb4439f5f09c 100644
--- a/sim/mn10300/op_utils.c
+++ b/sim/mn10300/op_utils.c
@@ -4,7 +4,6 @@
#include "sim-main.h"
#include "sim-signal.h"
#include "sim-syscall.h"
-#include "targ-vals.h"
#include <time.h>
#ifdef HAVE_UNISTD_H
@@ -132,7 +131,7 @@ genericBtst(unsigned32 leftOpnd, unsigned32 rightOpnd)
/* syscall */
INLINE_SIM_MAIN (void)
-do_syscall (void)
+do_syscall (SIM_DESC sd)
{
/* Registers passed to trap 0. */
@@ -150,7 +149,7 @@ do_syscall (void)
int save_errno = errno;
errno = 0;
- if (func == TARGET_SYS_exit)
+ if (cb_target_to_host_syscall (STATE_CALLBACK (sd), func) == CB_SYS_exit)
{
/* EXIT - caller can look in parm1 to work out the reason */
sim_engine_halt (simulator, STATE_CPU (simulator, 0), NULL, PC,
--
2.33.0
reply other threads:[~2021-11-28 6:05 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211128060524.28522-1-vapier@gentoo.org \
--to=vapier@gentoo.org \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).