From: Mike Frysinger <vapier@gentoo.org>
To: gdb-patches@sourceware.org
Subject: [PATCH 13/20] sim: mn10300: standardize the arch-specific settings a little
Date: Fri, 23 Dec 2022 01:07:06 -0500 [thread overview]
Message-ID: <20221223060713.28821-14-vapier@gentoo.org> (raw)
In-Reply-To: <20221223060713.28821-1-vapier@gentoo.org>
Rename mn10300_sim.h to mn10300-sim.h to match other ports, and move most
of the arch-specific content out of sim-main.h to it. This isn't a big
win though as we still have to include the header in sim-main.h due to the
igen interface: it hardcodes including sim-main.h in its files. So until
we can fix that, we have to keep bleeding these settings into the common
codes.
Also take the opportunity to purge a lot of unused headers from these.
The local modules should already include the right headers, so there's
no need to force everyone to pull them in. A lot of this is a hold over
from the pre-igen days of this port.
---
sim/mn10300/interp.c | 2 --
sim/mn10300/{mn10300_sim.h => mn10300-sim.h} | 24 ++++++++------
sim/mn10300/op_utils.c | 10 +++---
sim/mn10300/sim-main.h | 34 ++++----------------
4 files changed, 27 insertions(+), 43 deletions(-)
rename sim/mn10300/{mn10300_sim.h => mn10300-sim.h} (94%)
diff --git a/sim/mn10300/interp.c b/sim/mn10300/interp.c
index 3ea8079b1fa7..8467070addb6 100644
--- a/sim/mn10300/interp.c
+++ b/sim/mn10300/interp.c
@@ -14,8 +14,6 @@
#include <stdlib.h>
#include <string.h>
-#include "bfd.h"
-
struct _state State;
diff --git a/sim/mn10300/mn10300_sim.h b/sim/mn10300/mn10300-sim.h
similarity index 94%
rename from sim/mn10300/mn10300_sim.h
rename to sim/mn10300/mn10300-sim.h
index f1ab23ffe4fb..f6e4d854a144 100644
--- a/sim/mn10300/mn10300_sim.h
+++ b/sim/mn10300/mn10300-sim.h
@@ -1,14 +1,8 @@
-#include <stdio.h>
-#include <ctype.h>
-#include "ansidecl.h"
-#include "sim/callback.h"
-#include "opcode/mn10300.h"
-#include <limits.h>
-#include "sim/sim.h"
-#include "bfd.h"
-#include "sim-fpu.h"
-#include "sim-signal.h"
+#ifndef MN10300_SIM_H
+#define MN10300_SIM_H
+/* For compatibility, until all functions converted to passing
+ SIM_DESC as an argument */
extern SIM_DESC simulator;
typedef struct
@@ -185,6 +179,14 @@ dw2u64 (dword data)
return data.low | (((uint64_t)data.high) << 32);
}
+/* Bring data in from the cold */
+
+#define IMEM8(EA) \
+(sim_core_read_aligned_1(STATE_CPU(sd, 0), EA, exec_map, (EA)))
+
+#define IMEM8_IMMED(EA, N) \
+(sim_core_read_aligned_1(STATE_CPU(sd, 0), EA, exec_map, (EA) + (N)))
+
/* Function declarations. */
INLINE_SIM_MAIN (void) genericAdd (uint32_t source, uint32_t destReg);
@@ -225,3 +227,5 @@ void fpu_fmadd (SIM_DESC, sim_cpu *, address_word, const void *, const void *,
void fpu_fmsub (SIM_DESC, sim_cpu *, address_word, const void *, const void *, const void *, void *, const struct fp_prec_t *);
void fpu_fnmadd (SIM_DESC, sim_cpu *, address_word, const void *, const void *, const void *, void *, const struct fp_prec_t *);
void fpu_fnmsub (SIM_DESC, sim_cpu *, address_word, const void *, const void *, const void *, void *, const struct fp_prec_t *);
+
+#endif
diff --git a/sim/mn10300/op_utils.c b/sim/mn10300/op_utils.c
index 2fccf2da207f..b29b803d8e7f 100644
--- a/sim/mn10300/op_utils.c
+++ b/sim/mn10300/op_utils.c
@@ -1,10 +1,7 @@
/* This must come before any other includes. */
#include "defs.h"
-#include "sim-main.h"
-#include "sim-signal.h"
-#include "sim-syscall.h"
-
+#include <errno.h>
#include <time.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
@@ -13,6 +10,11 @@
#include <sys/stat.h>
#include <sys/time.h>
+#include "sim/callback.h"
+
+#include "sim-main.h"
+#include "sim-signal.h"
+#include "sim-syscall.h"
#define REG0(X) ((X) & 0x3)
diff --git a/sim/mn10300/sim-main.h b/sim/mn10300/sim-main.h
index 77a7ba8ea0d4..09887b592379 100644
--- a/sim/mn10300/sim-main.h
+++ b/sim/mn10300/sim-main.h
@@ -26,40 +26,20 @@
#include "sim-basics.h"
-#include <signal.h> /* For kill() in insns:do_trap */
-
-#include <errno.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-/* These are generated files. */
-#include "itable.h"
-#include "idecode.h"
-
#define SIM_CORE_SIGNAL(SD,CPU,CIA,MAP,NR_BYTES,ADDR,TRANSFER,ERROR) \
mn10300_core_signal ((SD), (CPU), (CIA), (MAP), (NR_BYTES), (ADDR), (TRANSFER), (ERROR))
-
#include "sim-base.h"
-#include "mn10300_sim.h"
-
-/* Bring data in from the cold */
-
-#define IMEM8(EA) \
-(sim_core_read_aligned_1(STATE_CPU(sd, 0), EA, exec_map, (EA)))
-
-#define IMEM8_IMMED(EA, N) \
-(sim_core_read_aligned_1(STATE_CPU(sd, 0), EA, exec_map, (EA) + (N)))
-
-/* For compatibility, until all functions converted to passing
- SIM_DESC as an argument */
-extern SIM_DESC simulator;
+/**
+ * TODO: Move these includes to the igen files that need them.
+ * This requires extending the igen syntax to support header includes.
+ */
+#include "sim-fpu.h"
+#include "sim-signal.h"
-/* (re) initialize the simulator */
+#include "mn10300-sim.h"
-extern void engine_init(SIM_DESC sd);
extern SIM_CORE_SIGNAL_FN mn10300_core_signal;
#endif
--
2.39.0
next prev parent reply other threads:[~2022-12-23 6:07 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-23 6:06 [PATCH 00/20] sim: reduce sim-main.h pollution Mike Frysinger
2022-12-23 6:06 ` [PATCH 01/20] sim: avr: move arch-specific settings to internal header Mike Frysinger
2022-12-23 6:06 ` [PATCH 02/20] sim: aarch64: " Mike Frysinger
2022-12-23 6:06 ` [PATCH 03/20] sim: arm: " Mike Frysinger
2022-12-23 6:06 ` [PATCH 04/20] sim: cr16: " Mike Frysinger
2022-12-23 6:06 ` [PATCH 05/20] sim: d10v: " Mike Frysinger
2022-12-23 6:06 ` [PATCH 06/20] sim: ft32: " Mike Frysinger
2022-12-23 6:07 ` [PATCH 07/20] sim: msp430: " Mike Frysinger
2022-12-23 6:07 ` [PATCH 08/20] sim: v850: standardize the arch-specific settings a little Mike Frysinger
2022-12-23 6:07 ` [PATCH 09/20] sim: riscv: move arch-specific settings to internal header Mike Frysinger
2022-12-23 6:07 ` [PATCH 10/20] sim: moxie: " Mike Frysinger
2022-12-23 6:07 ` [PATCH 11/20] sim: example-synacor: " Mike Frysinger
2022-12-23 6:07 ` [PATCH 12/20] sim: microblaze: " Mike Frysinger
2022-12-23 6:07 ` Mike Frysinger [this message]
2022-12-23 6:07 ` [PATCH 14/20] sim: pru: " Mike Frysinger
2022-12-23 6:07 ` [PATCH 15/20] sim: h8300: " Mike Frysinger
2022-12-23 6:07 ` [PATCH 16/20] sim: mcore: " Mike Frysinger
2022-12-23 6:07 ` [PATCH 17/20] sim: sh: " Mike Frysinger
2022-12-23 6:07 ` [PATCH 18/20] sim: m68hc11: " Mike Frysinger
2022-12-23 6:07 ` [PATCH 19/20] sim: bfin: " Mike Frysinger
2022-12-23 6:07 ` [PATCH 20/20] sim: m32r: " Mike Frysinger
2022-12-24 1:55 ` [PATCH] sim: or1k: " Mike Frysinger
2022-12-24 10:18 ` Stafford Horne
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=20221223060713.28821-14-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).