aboutsummaryrefslogtreecommitdiff
path: root/sim/mips
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2022-11-11 22:57:05 +0700
committerMike Frysinger <vapier@gentoo.org>2022-12-21 22:27:11 -0500
commit0fb6c560ffa591fbb7f8aa7de4f6719e20ced208 (patch)
tree2ce518bb0ad16f919ae3e86444dba188ee0e689e /sim/mips
parentf4ac2306058aecab760b05e425d089a1c86e0618 (diff)
downloadgdb-0fb6c560ffa591fbb7f8aa7de4f6719e20ced208.zip
gdb-0fb6c560ffa591fbb7f8aa7de4f6719e20ced208.tar.gz
gdb-0fb6c560ffa591fbb7f8aa7de4f6719e20ced208.tar.bz2
sim: mips: always resolve active bfd mach dynamically
Don't assume that the default bfd that we configured for is the one that is always active when running a program. We already have access to the real runtime value, so use it directly. This simplifies the code quite a bit, and will make it easier to support multiple mach's in a single binary.
Diffstat (limited to 'sim/mips')
-rwxr-xr-xsim/mips/configure48
-rw-r--r--sim/mips/configure.ac48
-rw-r--r--sim/mips/sim-main.h13
3 files changed, 3 insertions, 106 deletions
diff --git a/sim/mips/configure b/sim/mips/configure
index b0ba7ba..19b91fa 100755
--- a/sim/mips/configure
+++ b/sim/mips/configure
@@ -1988,7 +1988,6 @@ sim_igen_machine="-M mipsIV"
sim_m16_machine="-M mips16,mipsIII"
sim_igen_filter="32,64,f"
sim_m16_filter="16"
-sim_mach_default="mips8000"
case "${target}" in
mips*tx39*) sim_gen=IGEN
@@ -1997,18 +1996,15 @@ case "${target}" in
;;
mips64vr43*-*-*) sim_gen=IGEN
sim_igen_machine="-M mipsIV"
- sim_mach_default="mips8000"
;;
mips64vr5*-*-*) sim_gen=IGEN
sim_igen_machine="-M vr5000"
- sim_mach_default="mips5000"
;;
mips64vr41*) sim_gen=M16
sim_igen_machine="-M vr4100"
sim_m16_machine="-M vr4100"
sim_igen_filter="32,64,f"
sim_m16_filter="16"
- sim_mach_default="mips4100"
;;
mips64vr-*-* | mips64vrel-*-*)
sim_gen=MULTI
@@ -2044,42 +2040,35 @@ case "${target}" in
mipsisa32r6*-*-*) sim_gen=IGEN
sim_igen_machine="-M mips32r6"
sim_igen_filter="32,f"
- sim_mach_default="mipsisa32r6"
;;
mipsisa32*-*-*) sim_gen=M16
sim_igen_machine="-M mips32,mips16,mips16e,smartmips"
sim_m16_machine="-M mips16,mips16e,mips32"
sim_igen_filter="32,f"
- sim_mach_default="mipsisa32"
;;
mipsisa64r2*-*-*) sim_gen=M16
sim_igen_machine="-M mips64r2,mips3d,mips16,mips16e,mdmx,dsp,dsp2"
sim_m16_machine="-M mips16,mips16e,mips64r2"
sim_igen_filter="32,64,f"
- sim_mach_default="mipsisa64r2"
;;
mipsisa64r6*-*-*) sim_gen=IGEN
sim_igen_machine="-M mips64r6"
sim_igen_filter="32,64,f"
- sim_mach_default="mipsisa64r6"
;;
mipsisa64sb1*-*-*) sim_gen=IGEN
sim_igen_machine="-M mips64,mips3d,sb1"
sim_igen_filter="32,64,f"
- sim_mach_default="mips_sb1"
;;
mipsisa64*-*-*) sim_gen=M16
sim_igen_machine="-M mips64,mips3d,mips16,mips16e,mdmx"
sim_m16_machine="-M mips16,mips16e,mips64"
sim_igen_filter="32,64,f"
- sim_mach_default="mipsisa64"
;;
mips*lsi*) sim_gen=M16
sim_igen_machine="-M mipsIII,mips16"
sim_m16_machine="-M mips16,mipsIII"
sim_igen_filter="32,f"
sim_m16_filter="16"
- sim_mach_default="mips4000"
;;
mips*-*-*) sim_gen=IGEN
sim_igen_filter="32,f"
@@ -2279,47 +2268,10 @@ __EOF__
cat << __EOF__ >> multi-run.c
}
}
-
-int
-mips_mach_multi (SIM_DESC sd)
-{
- if (STATE_ARCHITECTURE (sd) == NULL)
- return bfd_mach_${sim_multi_default};
-
- switch (STATE_ARCHITECTURE (SD)->mach)
- {
__EOF__
-
- # Add case statements for this engine to mips_mach_multi().
- for fc in ${sim_multi_configs}; do
-
- # Split up the entry. ${c} contains the first three elements.
- # Note: outer sqaure brackets are m4 quotes.
- c=`echo ${fc} | sed 's/:[^:]*$//'`
- bfdmachs=`echo ${fc} | sed 's/.*://'`
-
- for mach in `echo ${bfdmachs} | sed 's/,/ /g'`; do
- echo " case bfd_mach_${mach}:" >> multi-run.c
- done
- done
-
- cat << __EOF__ >> multi-run.c
- return (STATE_ARCHITECTURE (SD)->mach);
- default:
- return bfd_mach_${sim_multi_default};
- }
-}
-__EOF__
-
- SIM_SUBTARGET="$SIM_SUBTARGET -DMIPS_MACH_MULTI"
else
# For clean-extra
sim_multi_src=doesnt-exist.c
-
- if test x"${sim_mach_default}" = x""; then
- as_fn_error $? "Error in configure.ac: \${sim_mach_default} not defined" "$LINENO" 5
- fi
- SIM_SUBTARGET="$SIM_SUBTARGET -DMIPS_MACH_DEFAULT=bfd_mach_${sim_mach_default}"
fi
sim_igen_flags="-F ${sim_igen_filter} ${sim_igen_machine} ${sim_igen_smp}"
sim_m16_flags=" -F ${sim_m16_filter} ${sim_m16_machine} ${sim_igen_smp}"
diff --git a/sim/mips/configure.ac b/sim/mips/configure.ac
index f1d9f3d..52e54bc 100644
--- a/sim/mips/configure.ac
+++ b/sim/mips/configure.ac
@@ -66,7 +66,6 @@ sim_igen_machine="-M mipsIV"
sim_m16_machine="-M mips16,mipsIII"
sim_igen_filter="32,64,f"
sim_m16_filter="16"
-sim_mach_default="mips8000"
case "${target}" in
mips*tx39*) sim_gen=IGEN
@@ -75,18 +74,15 @@ case "${target}" in
;;
mips64vr43*-*-*) sim_gen=IGEN
sim_igen_machine="-M mipsIV"
- sim_mach_default="mips8000"
;;
mips64vr5*-*-*) sim_gen=IGEN
sim_igen_machine="-M vr5000"
- sim_mach_default="mips5000"
;;
mips64vr41*) sim_gen=M16
sim_igen_machine="-M vr4100"
sim_m16_machine="-M vr4100"
sim_igen_filter="32,64,f"
sim_m16_filter="16"
- sim_mach_default="mips4100"
;;
mips64vr-*-* | mips64vrel-*-*)
sim_gen=MULTI
@@ -122,42 +118,35 @@ case "${target}" in
mipsisa32r6*-*-*) sim_gen=IGEN
sim_igen_machine="-M mips32r6"
sim_igen_filter="32,f"
- sim_mach_default="mipsisa32r6"
;;
mipsisa32*-*-*) sim_gen=M16
sim_igen_machine="-M mips32,mips16,mips16e,smartmips"
sim_m16_machine="-M mips16,mips16e,mips32"
sim_igen_filter="32,f"
- sim_mach_default="mipsisa32"
;;
mipsisa64r2*-*-*) sim_gen=M16
sim_igen_machine="-M mips64r2,mips3d,mips16,mips16e,mdmx,dsp,dsp2"
sim_m16_machine="-M mips16,mips16e,mips64r2"
sim_igen_filter="32,64,f"
- sim_mach_default="mipsisa64r2"
;;
mipsisa64r6*-*-*) sim_gen=IGEN
sim_igen_machine="-M mips64r6"
sim_igen_filter="32,64,f"
- sim_mach_default="mipsisa64r6"
;;
mipsisa64sb1*-*-*) sim_gen=IGEN
sim_igen_machine="-M mips64,mips3d,sb1"
sim_igen_filter="32,64,f"
- sim_mach_default="mips_sb1"
;;
mipsisa64*-*-*) sim_gen=M16
sim_igen_machine="-M mips64,mips3d,mips16,mips16e,mdmx"
sim_m16_machine="-M mips16,mips16e,mips64"
sim_igen_filter="32,64,f"
- sim_mach_default="mipsisa64"
;;
mips*lsi*) sim_gen=M16
sim_igen_machine="-M mipsIII,mips16"
sim_m16_machine="-M mips16,mipsIII"
sim_igen_filter="32,f"
sim_m16_filter="16"
- sim_mach_default="mips4000"
;;
mips*-*-*) sim_gen=IGEN
sim_igen_filter="32,f"
@@ -357,47 +346,10 @@ __EOF__
cat << __EOF__ >> multi-run.c
}
}
-
-int
-mips_mach_multi (SIM_DESC sd)
-{
- if (STATE_ARCHITECTURE (sd) == NULL)
- return bfd_mach_${sim_multi_default};
-
- switch (STATE_ARCHITECTURE (SD)->mach)
- {
__EOF__
-
- # Add case statements for this engine to mips_mach_multi().
- for fc in ${sim_multi_configs}; do
-
- # Split up the entry. ${c} contains the first three elements.
- # Note: outer sqaure brackets are m4 quotes.
- c=`echo ${fc} | sed ['s/:[^:]*$//']`
- bfdmachs=`echo ${fc} | sed 's/.*://'`
-
- for mach in `echo ${bfdmachs} | sed 's/,/ /g'`; do
- echo " case bfd_mach_${mach}:" >> multi-run.c
- done
- done
-
- cat << __EOF__ >> multi-run.c
- return (STATE_ARCHITECTURE (SD)->mach);
- default:
- return bfd_mach_${sim_multi_default};
- }
-}
-__EOF__
-
- SIM_SUBTARGET="$SIM_SUBTARGET -DMIPS_MACH_MULTI"
else
# For clean-extra
sim_multi_src=doesnt-exist.c
-
- if test x"${sim_mach_default}" = x""; then
- AC_MSG_ERROR(Error in configure.ac: \${sim_mach_default} not defined)
- fi
- SIM_SUBTARGET="$SIM_SUBTARGET -DMIPS_MACH_DEFAULT=bfd_mach_${sim_mach_default}"
fi
sim_igen_flags="-F ${sim_igen_filter} ${sim_igen_machine} ${sim_igen_smp}"
sim_m16_flags=" -F ${sim_m16_filter} ${sim_m16_machine} ${sim_igen_smp}"
diff --git a/sim/mips/sim-main.h b/sim/mips/sim-main.h
index ea203c4..3868fff 100644
--- a/sim/mips/sim-main.h
+++ b/sim/mips/sim-main.h
@@ -1051,24 +1051,17 @@ void mips_cpu_exception_trigger(SIM_DESC sd, sim_cpu* cpu, address_word pc);
void mips_cpu_exception_suspend(SIM_DESC sd, sim_cpu* cpu, int exception);
void mips_cpu_exception_resume(SIM_DESC sd, sim_cpu* cpu, int exception);
-#ifdef MIPS_MACH_MULTI
-extern int mips_mach_multi(SIM_DESC sd);
-#define MIPS_MACH(SD) mips_mach_multi(SD)
-#else
-#define MIPS_MACH(SD) MIPS_MACH_DEFAULT
-#endif
-
/* Macros for determining whether a MIPS IV or MIPS V part is subject
to the hi/lo restrictions described in mips.igen. */
#define MIPS_MACH_HAS_MT_HILO_HAZARD(SD) \
- (MIPS_MACH (SD) != bfd_mach_mips5500)
+ (STATE_ARCHITECTURE (SD)->mach != bfd_mach_mips5500)
#define MIPS_MACH_HAS_MULT_HILO_HAZARD(SD) \
- (MIPS_MACH (SD) != bfd_mach_mips5500)
+ (STATE_ARCHITECTURE (SD)->mach != bfd_mach_mips5500)
#define MIPS_MACH_HAS_DIV_HILO_HAZARD(SD) \
- (MIPS_MACH (SD) != bfd_mach_mips5500)
+ (STATE_ARCHITECTURE (SD)->mach != bfd_mach_mips5500)
#if H_REVEALS_MODULE_P (SIM_MAIN_INLINE)
#include "sim-main.c"