aboutsummaryrefslogtreecommitdiff
path: root/sim
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2016-01-02 10:54:42 -0500
committerMike Frysinger <vapier@gentoo.org>2021-05-01 23:10:28 -0400
commitd89a87ba3c100bdbe82c7bd98ad7b8a2435e002f (patch)
tree624938f5f0bcb58fe3527bf9fdbef2f65f856191 /sim
parente4821e2f5fd281eb6b88b642fa9beaf9c3a35070 (diff)
downloadgdb-d89a87ba3c100bdbe82c7bd98ad7b8a2435e002f.zip
gdb-d89a87ba3c100bdbe82c7bd98ad7b8a2435e002f.tar.gz
gdb-d89a87ba3c100bdbe82c7bd98ad7b8a2435e002f.tar.bz2
sim: bfin: move option inits to respective modules
Now that modules can self declare their own init funcs, change the mmu and mach logic to use it. We don't need to export the option symbols or specifically call this logic from the sim_open function anymore.
Diffstat (limited to 'sim')
-rw-r--r--sim/bfin/ChangeLog8
-rw-r--r--sim/bfin/dv-bfin_mmu.c12
-rw-r--r--sim/bfin/interp.c11
-rw-r--r--sim/bfin/machs.c12
4 files changed, 30 insertions, 13 deletions
diff --git a/sim/bfin/ChangeLog b/sim/bfin/ChangeLog
index 9e9c13e..4fe2a9d 100644
--- a/sim/bfin/ChangeLog
+++ b/sim/bfin/ChangeLog
@@ -1,5 +1,13 @@
2021-05-01 Mike Frysinger <vapier@gentoo.org>
+ * dv-bfin_mmu.c (bfin_mmu_options): Mark static.
+ (sim_install_bfin_mmu): New function & prototype.
+ * interp.c (e_sim_add_option_table): Delete.
+ * machs.c (bfin_mach_options): Mark static.
+ (sim_install_bfin_mach): New function & prototype.
+
+2021-05-01 Mike Frysinger <vapier@gentoo.org>
+
* config.in, configure: Regenerate.
2021-04-26 Mike Frysinger <vapier@gentoo.org>
diff --git a/sim/bfin/dv-bfin_mmu.c b/sim/bfin/dv-bfin_mmu.c
index 5f28256..cbaaaa2 100644
--- a/sim/bfin/dv-bfin_mmu.c
+++ b/sim/bfin/dv-bfin_mmu.c
@@ -277,7 +277,7 @@ enum {
OPTION_MMU_SKIP_TABLES = OPTION_START,
};
-const OPTION bfin_mmu_options[] =
+static const OPTION bfin_mmu_options[] =
{
{ {"mmu-skip-cplbs", no_argument, NULL, OPTION_MMU_SKIP_TABLES },
'\0', NULL, "Skip parsing of CPLB tables (big speed increase)",
@@ -301,6 +301,16 @@ bfin_mmu_option_handler (SIM_DESC sd, sim_cpu *current_cpu, int opt,
return SIM_RC_FAIL;
}
}
+
+/* Provide a prototype to silence -Wmissing-prototypes. */
+extern MODULE_INIT_FN sim_install_bfin_mmu;
+
+SIM_RC
+sim_install_bfin_mmu (SIM_DESC sd)
+{
+ SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
+ return sim_add_option_table (sd, NULL, bfin_mmu_options);
+}
#define MMU_STATE(cpu) DV_STATE_CACHED (cpu, mmu)
diff --git a/sim/bfin/interp.c b/sim/bfin/interp.c
index 49388e7..2aa9279 100644
--- a/sim/bfin/interp.c
+++ b/sim/bfin/interp.c
@@ -735,17 +735,6 @@ sim_open (SIM_OPEN_KIND kind, host_callback *callback,
if (STATE_ENVIRONMENT (sd) == ALL_ENVIRONMENT)
STATE_ENVIRONMENT (sd) = VIRTUAL_ENVIRONMENT;
- /* These options override any module options.
- Obviously ambiguity should be avoided, however the caller may wish to
- augment the meaning of an option. */
-#define e_sim_add_option_table(sd, options) \
- do { \
- extern const OPTION options[]; \
- sim_add_option_table (sd, NULL, options); \
- } while (0)
- e_sim_add_option_table (sd, bfin_mmu_options);
- e_sim_add_option_table (sd, bfin_mach_options);
-
/* The parser will print an error message for us, so we silently return. */
if (sim_parse_args (sd, argv) != SIM_RC_OK)
{
diff --git a/sim/bfin/machs.c b/sim/bfin/machs.c
index 8b7b106..a2060e8 100644
--- a/sim/bfin/machs.c
+++ b/sim/bfin/machs.c
@@ -1976,7 +1976,7 @@ enum {
OPTION_MACH_HW_BOARD_FILE,
};
-const OPTION bfin_mach_options[] =
+static const OPTION bfin_mach_options[] =
{
{ {"sirev", required_argument, NULL, OPTION_MACH_SIREV },
'\0', "NUMBER", "Set CPU silicon revision",
@@ -2019,3 +2019,13 @@ bfin_mach_option_handler (SIM_DESC sd, sim_cpu *current_cpu, int opt,
return SIM_RC_FAIL;
}
}
+
+/* Provide a prototype to silence -Wmissing-prototypes. */
+extern MODULE_INIT_FN sim_install_bfin_mach;
+
+SIM_RC
+sim_install_bfin_mach (SIM_DESC sd)
+{
+ SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
+ return sim_add_option_table (sd, NULL, bfin_mach_options);
+}