aboutsummaryrefslogtreecommitdiff
path: root/sim
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>1998-02-28 02:51:06 +0000
committerAndrew Cagney <cagney@redhat.com>1998-02-28 02:51:06 +0000
commit0e701ac37b0154048977636afe262f55a9150492 (patch)
treee84fefe5fad67b84aa35d7556388e8cc6161ed5f /sim
parent7c5d88c1bb671d64d01766531d48a1dfca8c8ee1 (diff)
downloadfsf-binutils-gdb-0e701ac37b0154048977636afe262f55a9150492.zip
fsf-binutils-gdb-0e701ac37b0154048977636afe262f55a9150492.tar.gz
fsf-binutils-gdb-0e701ac37b0154048977636afe262f55a9150492.tar.bz2
Add generic sim-info.c:sim_info() function using module mechanism.
Clean up compile probs in mips/vr5400.
Diffstat (limited to 'sim')
-rw-r--r--sim/common/ChangeLog29
-rw-r--r--sim/common/Make-common.in6
-rw-r--r--sim/common/sim-base.h13
-rw-r--r--sim/common/sim-info.c32
-rw-r--r--sim/common/sim-module.c153
-rw-r--r--sim/common/sim-profile.c14
-rw-r--r--sim/common/sim-profile.h247
-rw-r--r--sim/m32r/ChangeLog6
-rw-r--r--sim/m32r/Makefile.in18
-rw-r--r--sim/m32r/sim-if.c175
-rw-r--r--sim/mips/ChangeLog8
-rw-r--r--sim/mips/interp.c37
-rw-r--r--sim/mips/mdmx.igen17
-rw-r--r--sim/mips/sim-main.h2
-rw-r--r--sim/tic80/ChangeLog4
-rw-r--r--sim/tic80/Makefile.in6
-rw-r--r--sim/tic80/sim-calls.c6
-rw-r--r--sim/v850/ChangeLog16
-rw-r--r--sim/v850/interp.c38
19 files changed, 700 insertions, 127 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index d345e3f..e362e28 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,3 +1,32 @@
+Fri Feb 27 13:29:13 1998 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * sim-profile.c (profile_info): Rename from profile_print. Drop
+ misc and misc_cpu callback arguments. Use
+ PROFILE_INFO_CPU_CALLBACK and STATE_PROFILE_INFO_CALLBACK instead.
+ (profile_install): Install profile_info function.
+
+ * sim-profile.h (PROFILE_INFO_CPU_CALLBACK,
+ STATE_PROFILE_INFO_CALLBACK): Define.
+ (struct PROFILE_DATA): Add field info_cpu_callback.
+ (profile_print): Delete function.
+
+ * sim-base.h (STATE_MODULES): Define. Replace individual
+ STATE_*_LIST with single struct module_list.
+
+ * sim-module.h (MODULE_INFO_FN, MODULE_INFO_LIST): Declare.
+ (struct module_list): Declare.
+
+ * sim-module.h, sim-module.c (sim_module_add_info_fn,
+ sim_module_info): New functions.
+ (sim_module_install): Clean up module data structures.
+
+ * sim-info.c (sim_info): New file. New function. Call
+ sim_module_info.
+
+ * Make-common.in (sim-info.o): Define rule.
+ (SIM_NEW_COMMON_OBJS): Add sim-info.o.
+
+
Fri Feb 27 18:26:16 1998 Doug Evans <devans@canuck.cygnus.com>
* sim-base.h (sim_cpu_base): New members name, options.
diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in
index e5c69a7..485b676 100644
--- a/sim/common/Make-common.in
+++ b/sim/common/Make-common.in
@@ -144,6 +144,7 @@ SIM_NEW_COMMON_OBJS = \
sim-events.o \
sim-fpu.o \
sim-io.o \
+ sim-info.o \
sim-load.o \
sim-memopt.o \
sim-module.o \
@@ -333,6 +334,11 @@ sim-hrw.o: $(srccom)/sim-hrw.c $(sim-assert_h) $(sim_core_h) \
$(SIM_EXTRA_DEPS)
$(CC) -c $(srccom)/sim-hrw.c $(ALL_CFLAGS)
+sim-info.o: $(srccom)/sim-info.c $(sim-assert_h) \
+ $(srcroot)/include/remote-sim.h \
+ $(SIM_EXTRA_DEPS)
+ $(CC) -c $(srccom)/sim-info.c $(ALL_CFLAGS)
+
sim-inline.c: $(srccom)/sim-inline.c
rm -f $@ tmp-$@
echo "# 1 \"$(srccom)/$@\"" > tmp-$@
diff --git a/sim/common/sim-base.h b/sim/common/sim-base.h
index 5b2f48d..d5d875e 100644
--- a/sim/common/sim-base.h
+++ b/sim/common/sim-base.h
@@ -138,17 +138,8 @@ typedef struct {
#endif
/* List of installed module `init' handlers. */
- MODULE_INIT_LIST *init_list;
-#define STATE_INIT_LIST(sd) ((sd)->base.init_list)
- /* List of installed module `uninstall' handlers. */
- MODULE_UNINSTALL_LIST *uninstall_list;
-#define STATE_UNINSTALL_LIST(sd) ((sd)->base.uninstall_list)
- /* List of installed module `resume' handlers. */
- MODULE_RESUME_LIST *resume_list;
-#define STATE_RESUME_LIST(sd) ((sd)->base.resume_list)
- /* List of installed module `suspend' handlers. */
- MODULE_SUSPEND_LIST *suspend_list;
-#define STATE_SUSPEND_LIST(sd) ((sd)->base.suspend_list)
+ struct module_list *modules;
+#define STATE_MODULES(sd) ((sd)->base.modules)
/* Supported options. */
struct option_list *options;
diff --git a/sim/common/sim-info.c b/sim/common/sim-info.c
new file mode 100644
index 0000000..844bebe
--- /dev/null
+++ b/sim/common/sim-info.c
@@ -0,0 +1,32 @@
+/* Generic memory read/write for hardware simulator models.
+ Copyright (C) 1998 Free Software Foundation, Inc.
+ Contributed by Cygnus Support.
+
+This file is part of GDB, the GNU debugger.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#include "sim-main.h"
+#include "sim-assert.h"
+
+/* Generic implementation of sim_info that works with simulators using
+ sim-module. */
+
+void
+sim_info (SIM_DESC sd, int verbose)
+{
+ SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
+ sim_module_info (sd, verbose);
+}
diff --git a/sim/common/sim-module.c b/sim/common/sim-module.c
index c4dcd30..bb1dca4 100644
--- a/sim/common/sim-module.c
+++ b/sim/common/sim-module.c
@@ -70,6 +70,8 @@ SIM_RC
sim_pre_argv_init (SIM_DESC sd, const char *myname)
{
SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
+ SIM_ASSERT (STATE_MODULES (sd) == NULL);
+
STATE_MY_NAME (sd) = myname + strlen (myname);
while (STATE_MY_NAME (sd) > myname && STATE_MY_NAME (sd)[-1] != '/')
--STATE_MY_NAME (sd);
@@ -99,6 +101,7 @@ sim_post_argv_init (SIM_DESC sd)
{
int i;
SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
+ SIM_ASSERT (STATE_MODULES (sd) != NULL);
if (sim_module_init (sd) != SIM_RC_OK)
return SIM_RC_FAIL;
@@ -117,13 +120,17 @@ SIM_RC
sim_module_install (SIM_DESC sd)
{
MODULE_INSTALL_FN * const *modp;
+
SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
+ SIM_ASSERT (STATE_MODULES (sd) == NULL);
+ STATE_MODULES (sd) = ZALLOC (struct module_list);
for (modp = modules; *modp != NULL; ++modp)
{
if ((*modp) (sd) != SIM_RC_OK)
{
sim_module_uninstall (sd);
+ SIM_ASSERT (STATE_MODULES (sd) == NULL);
return SIM_RC_FAIL;
}
}
@@ -136,10 +143,13 @@ sim_module_install (SIM_DESC sd)
SIM_RC
sim_module_init (SIM_DESC sd)
{
+ struct module_list *modules = STATE_MODULES (sd);
MODULE_INIT_LIST *modp;
+
SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
+ SIM_ASSERT (STATE_MODULES (sd) == NULL);
- for (modp = STATE_INIT_LIST (sd); modp != NULL; modp = modp->next)
+ for (modp = modules->init_list; modp != NULL; modp = modp->next)
{
if ((*modp->fn) (sd) != SIM_RC_OK)
return SIM_RC_FAIL;
@@ -152,10 +162,13 @@ sim_module_init (SIM_DESC sd)
SIM_RC
sim_module_resume (SIM_DESC sd)
{
+ struct module_list *modules = STATE_MODULES (sd);
MODULE_RESUME_LIST *modp;
+
SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
+ SIM_ASSERT (STATE_MODULES (sd) == NULL);
- for (modp = STATE_RESUME_LIST (sd); modp != NULL; modp = modp->next)
+ for (modp = modules->resume_list; modp != NULL; modp = modp->next)
{
if ((*modp->fn) (sd) != SIM_RC_OK)
return SIM_RC_FAIL;
@@ -168,10 +181,13 @@ sim_module_resume (SIM_DESC sd)
SIM_RC
sim_module_suspend (SIM_DESC sd)
{
+ struct module_list *modules = STATE_MODULES (sd);
MODULE_SUSPEND_LIST *modp;
+
SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
+ SIM_ASSERT (STATE_MODULES (sd) == NULL);
- for (modp = STATE_SUSPEND_LIST (sd); modp != NULL; modp = modp->next)
+ for (modp = modules->suspend_list; modp != NULL; modp = modp->next)
{
if ((*modp->fn) (sd) != SIM_RC_OK)
return SIM_RC_FAIL;
@@ -184,12 +200,85 @@ sim_module_suspend (SIM_DESC sd)
void
sim_module_uninstall (SIM_DESC sd)
{
+ struct module_list *modules = STATE_MODULES (sd);
MODULE_UNINSTALL_LIST *modp;
+
SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
+ SIM_ASSERT (STATE_MODULES (sd) == NULL);
/* Uninstall the modules. */
- for (modp = STATE_UNINSTALL_LIST (sd); modp != NULL; modp = modp->next)
+ for (modp = modules->uninstall_list; modp != NULL; modp = modp->next)
(*modp->fn) (sd);
+
+ /* clean-up init list */
+ {
+ MODULE_INIT_LIST *n, *d;
+ for (d = modules->init_list; d != NULL; d = n)
+ {
+ n = d->next;
+ zfree (d);
+ }
+ }
+
+ /* clean-up resume list */
+ {
+ MODULE_RESUME_LIST *n, *d;
+ for (d = modules->resume_list; d != NULL; d = n)
+ {
+ n = d->next;
+ zfree (d);
+ }
+ }
+
+ /* clean-up suspend list */
+ {
+ MODULE_SUSPEND_LIST *n, *d;
+ for (d = modules->suspend_list; d != NULL; d = n)
+ {
+ n = d->next;
+ zfree (d);
+ }
+ }
+
+ /* clean-up uninstall list */
+ {
+ MODULE_UNINSTALL_LIST *n, *d;
+ for (d = modules->uninstall_list; d != NULL; d = n)
+ {
+ n = d->next;
+ zfree (d);
+ }
+ }
+
+ /* clean-up info list */
+ {
+ MODULE_INFO_LIST *n, *d;
+ for (d = modules->info_list; d != NULL; d = n)
+ {
+ n = d->next;
+ zfree (d);
+ }
+ }
+
+ zfree (modules);
+ STATE_MODULES (sd) = NULL;
+}
+
+/* Called when ever simulator info is needed */
+
+void
+sim_module_info (SIM_DESC sd, int verbose)
+{
+ struct module_list *modules = STATE_MODULES (sd);
+ MODULE_INFO_LIST *modp;
+
+ SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
+ SIM_ASSERT (STATE_MODULES (sd) == NULL);
+
+ for (modp = modules->info_list; modp != NULL; modp = modp->next)
+ {
+ (*modp->fn) (sd, verbose);
+ }
}
/* Add FN to the init handler list.
@@ -198,11 +287,14 @@ sim_module_uninstall (SIM_DESC sd)
void
sim_module_add_init_fn (SIM_DESC sd, MODULE_INIT_FN fn)
{
- MODULE_INIT_LIST *l =
- (MODULE_INIT_LIST *) xmalloc (sizeof (MODULE_INIT_LIST));
- MODULE_INIT_LIST **last = &STATE_INIT_LIST (sd);
+ struct module_list *modules = STATE_MODULES (sd);
+ MODULE_INIT_LIST *l = ZALLOC (MODULE_INIT_LIST);
+ MODULE_INIT_LIST **last;
+
SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
+ SIM_ASSERT (STATE_MODULES (sd) == NULL);
+ last = &modules->init_list;
while (*last != NULL)
last = &((*last)->next);
@@ -217,11 +309,14 @@ sim_module_add_init_fn (SIM_DESC sd, MODULE_INIT_FN fn)
void
sim_module_add_resume_fn (SIM_DESC sd, MODULE_RESUME_FN fn)
{
+ struct module_list *modules = STATE_MODULES (sd);
MODULE_RESUME_LIST *l = ZALLOC (MODULE_RESUME_LIST);
MODULE_RESUME_LIST **last;
+
SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
+ SIM_ASSERT (STATE_MODULES (sd) == NULL);
- last = &STATE_RESUME_LIST (sd);
+ last = &modules->resume_list;
while (*last != NULL)
last = &((*last)->next);
@@ -236,17 +331,20 @@ sim_module_add_resume_fn (SIM_DESC sd, MODULE_RESUME_FN fn)
void
sim_module_add_suspend_fn (SIM_DESC sd, MODULE_SUSPEND_FN fn)
{
+ struct module_list *modules = STATE_MODULES (sd);
MODULE_SUSPEND_LIST *l = ZALLOC (MODULE_SUSPEND_LIST);
MODULE_SUSPEND_LIST **last;
+
SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
+ SIM_ASSERT (STATE_MODULES (sd) == NULL);
- last = &STATE_SUSPEND_LIST (sd);
+ last = &modules->suspend_list;
while (*last != NULL)
last = &((*last)->next);
l->fn = fn;
- l->next = STATE_SUSPEND_LIST (sd);
- STATE_SUSPEND_LIST (sd) = l;
+ l->next = modules->suspend_list;
+ modules->suspend_list = l;
}
/* Add FN to the uninstall handler list.
@@ -255,10 +353,35 @@ sim_module_add_suspend_fn (SIM_DESC sd, MODULE_SUSPEND_FN fn)
void
sim_module_add_uninstall_fn (SIM_DESC sd, MODULE_UNINSTALL_FN fn)
{
- MODULE_UNINSTALL_LIST *l =
- (MODULE_UNINSTALL_LIST *) xmalloc (sizeof (MODULE_UNINSTALL_LIST));
+ struct module_list *modules = STATE_MODULES (sd);
+ MODULE_UNINSTALL_LIST *l = ZALLOC (MODULE_UNINSTALL_LIST);
+
+ SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
+ SIM_ASSERT (STATE_MODULES (sd) == NULL);
+
+ l->fn = fn;
+ l->next = modules->uninstall_list;
+ modules->uninstall_list = l;
+}
+
+/* Add FN to the info handler list.
+ Report info in the same order as the install. */
+
+void
+sim_module_add_info_fn (SIM_DESC sd, MODULE_INFO_FN fn)
+{
+ struct module_list *modules = STATE_MODULES (sd);
+ MODULE_INFO_LIST *l = ZALLOC (MODULE_INFO_LIST);
+ MODULE_INFO_LIST **last;
+
+ SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
+ SIM_ASSERT (STATE_MODULES (sd) == NULL);
+
+ last = &modules->info_list;
+ while (*last != NULL)
+ last = &((*last)->next);
l->fn = fn;
- l->next = STATE_UNINSTALL_LIST (sd);
- STATE_UNINSTALL_LIST (sd) = l;
+ l->next = NULL;
+ *last = l;
}
diff --git a/sim/common/sim-profile.c b/sim/common/sim-profile.c
index 796b945..f3f8a7e 100644
--- a/sim/common/sim-profile.c
+++ b/sim/common/sim-profile.c
@@ -829,9 +829,8 @@ profile_print_speed (sim_cpu *cpu)
Note that results are indented two spaces to distinguish them from
section titles. */
-void
-profile_print (SIM_DESC sd, int verbose,
- PROFILE_CALLBACK *misc, PROFILE_CPU_CALLBACK *misc_cpu)
+static void
+profile_info (SIM_DESC sd, int verbose)
{
int i,c;
int print_title_p = 0;
@@ -916,8 +915,8 @@ profile_print (SIM_DESC sd, int verbose,
#endif
/* Print cpu-specific data before the execution speed. */
- if (misc_cpu != NULL)
- (*misc_cpu) (cpu, verbose);
+ if (PROFILE_INFO_CPU_CALLBACK (data) != NULL)
+ PROFILE_INFO_CPU_CALLBACK (data) (cpu, verbose);
/* Always try to print execution time and speed. */
if (verbose
@@ -926,9 +925,9 @@ profile_print (SIM_DESC sd, int verbose,
}
/* Finally print non-cpu specific miscellaneous data. */
+ if (STATE_PROFILE_INFO_CALLBACK (sd))
+ STATE_PROFILE_INFO_CALLBACK (sd) (sd, verbose);
- if (misc != NULL)
- (*misc) (sd, verbose);
}
/* Install profiling support in the simulator. */
@@ -948,6 +947,7 @@ profile_install (SIM_DESC sd)
sim_module_add_init_fn (sd, profile_pc_init);
#endif
sim_module_add_uninstall_fn (sd, profile_uninstall);
+ sim_module_add_info_fn (sd, profile_info);
return SIM_RC_OK;
}
diff --git a/sim/common/sim-profile.h b/sim/common/sim-profile.h
new file mode 100644
index 0000000..12ccffb
--- /dev/null
+++ b/sim/common/sim-profile.h
@@ -0,0 +1,247 @@
+/* Profile header for simulators using common framework.
+ Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ Contributed by Cygnus Support.
+
+This file is part of GDB, the GNU debugger.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#ifndef SIM_PROFILE_H
+#define SIM_PROFILE_H
+
+#ifndef WITH_PROFILE
+Error, WITH_PROFILE not defined.
+#endif
+
+/* Maximum number of profilable entities. */
+#ifndef MAX_PROFILE_VALUES
+#define MAX_PROFILE_VALUES 8
+#endif
+
+/* Standard profilable entities. */
+#define PROFILE_INSN_IDX 0
+#define PROFILE_MEMORY_IDX 1
+#define PROFILE_MODEL_IDX 2
+#define PROFILE_SCACHE_IDX 3
+#define PROFILE_PC_IDX 4
+#define PROFILE_CORE_IDX 5
+#define PROFILE_NEXT_IDX 6 /* simulator specific profile bits begin here */
+
+/* Masks so WITH_PROFILE can have symbolic values. */
+#define PROFILE_insn 1
+#define PROFILE_memory 2
+#define PROFILE_model 4
+#define PROFILE_scache 8
+#define PROFILE_pc 16
+#define PROFILE_core 32
+
+/* Preprocessor macros to simplify tests of WITH_PROFILE. */
+#define WITH_PROFILE_INSN_P (WITH_PROFILE & PROFILE_insn)
+#define WITH_PROFILE_MEMORY_P (WITH_PROFILE & PROFILE_memory)
+#define WITH_PROFILE_MODEL_P (WITH_PROFILE & PROFILE_model)
+#define WITH_PROFILE_SCACHE_P (WITH_PROFILE & PROFILE_scache)
+#define WITH_PROFILE_PC_P (WITH_PROFILE & PROFILE_pc)
+#define WITH_PROFILE_CORE_P (WITH_PROFILE & PROFILE_core)
+
+/* If MAX_INSNS isn't defined, we can't do instruction profiling.
+ ??? It is intended that this is a temporary occurence. Normally
+ MAX_INSNS is defined. */
+#ifndef MAX_INSNS
+#undef WITH_PROFILE_INSN_P
+#define WITH_PROFILE_INSN_P 0
+#endif
+
+/* If MAX_MODES isn't defined, we can't do memory profiling.
+ ??? It is intended that this is a temporary occurence. Normally
+ MAX_MODES is defined. */
+#ifndef MAX_MODES
+#undef WITH_PROFILE_MEMORY_P
+#define WITH_PROFILE_MEMORY_P 0
+#endif
+
+/* Only build MODEL code when the target simulator has support for it */
+#ifndef SIM_HAVE_MODEL
+#undef WITH_PROFILE_MODEL_P
+#define WITH_PROFILE_MODEL_P 0
+#endif
+
+/* Profiling install handler. */
+MODULE_INSTALL_FN profile_install;
+
+/* Output format macros. */
+#ifndef PROFILE_HISTOGRAM_WIDTH
+#define PROFILE_HISTOGRAM_WIDTH 40
+#endif
+#ifndef PROFILE_LABEL_WIDTH
+#define PROFILE_LABEL_WIDTH 32
+#endif
+
+/* Callbacks for internal profile_info.
+ The callbacks may be NULL meaning there isn't one.
+ Note that results are indented two spaces to distinguish them from
+ section titles.
+ If non-NULL, PROFILE_CALLBACK is called to print extra non-cpu related data.
+ If non-NULL, PROFILE_CPU_CALLBACK is called to print extra cpu related data.
+ */
+
+typedef void (PROFILE_INFO_CALLBACK_FN) (SIM_DESC, int);
+struct _sim_cpu; /* forward reference */
+typedef void (PROFILE_INFO_CPU_CALLBACK_FN) (struct _sim_cpu *cpu, int verbose);
+
+
+/* Struct containing most profiling data.
+ It doesn't contain all profiling data because for example scache data
+ is kept with the rest of scache support. */
+
+typedef struct {
+ /* Boolean array of specified profiling flags. */
+ char profile_flags[MAX_PROFILE_VALUES];
+#define PROFILE_FLAGS(p) ((p)->profile_flags)
+
+ /* The total insn count is tracked separately.
+ It is always computed, regardless of insn profiling. */
+ unsigned long total_insn_count;
+#define PROFILE_TOTAL_INSN_COUNT(p) ((p)->total_insn_count)
+
+ /* Execution time in milliseconds. */
+ unsigned long exec_time;
+#define PROFILE_EXEC_TIME(p) ((p)->exec_time)
+
+#if WITH_PROFILE_INSN_P
+ unsigned int insn_count[MAX_INSNS];
+#define PROFILE_INSN_COUNT(p) ((p)->insn_count)
+#endif
+
+#if WITH_PROFILE_MEMORY_P
+ unsigned int read_count[MAX_MODES];
+#define PROFILE_READ_COUNT(p) ((p)->read_count)
+ unsigned int write_count[MAX_MODES];
+#define PROFILE_WRITE_COUNT(p) ((p)->write_count)
+#endif
+
+#if WITH_PROFILE_CORE_P
+ /* Count read/write/exec accesses separatly. */
+ unsigned int core_count[nr_sim_core_maps];
+#define PROFILE_CORE_COUNT(p) ((p)->core_count)
+#endif
+
+#if WITH_PROFILE_MODEL_P
+ /* Total cycle count (less stalls). */
+ unsigned long cycle_count;
+#define PROFILE_MODEL_CYCLE_COUNT(p) ((p)->cycle_count)
+ /* Stalls due to branches. */
+ unsigned long cti_stall_count;
+#define PROFILE_MODEL_CTI_STALL_COUNT(p) ((p)->cti_stall_count)
+ unsigned long load_stall_count;
+#define PROFILE_MODEL_LOAD_STALL_COUNT(p) ((p)->load_stall_count)
+ /* Taken and not-taken branches (and other cti's). */
+#define PROFILE_TOTAL_CYCLE_COUNT(p) \
+(PROFILE_MODEL_CYCLE_COUNT(p) \
+ + PROFILE_MODEL_CTI_STALL_COUNT(p) \
+ + PROFILE_MODEL_LOAD_STALL_COUNT(p))
+
+ unsigned long taken_count, untaken_count;
+#define PROFILE_MODEL_TAKEN_COUNT(p) ((p)->taken_count)
+#define PROFILE_MODEL_UNTAKEN_COUNT(p) ((p)->untaken_count)
+#endif
+
+#if WITH_PROFILE_PC_P
+ /* PC profiling attempts to determine function usage by sampling the PC
+ every so many instructions. */
+ unsigned int profile_pc_freq;
+#define PROFILE_PC_FREQ(p) ((p)->profile_pc_freq)
+ unsigned int profile_pc_nr_buckets;
+#define PROFILE_PC_NR_BUCKETS(p) ((p)->profile_pc_nr_buckets)
+ address_word profile_pc_start;
+#define PROFILE_PC_START(p) ((p)->profile_pc_start)
+ address_word profile_pc_end;
+#define PROFILE_PC_END(p) ((p)->profile_pc_end)
+ unsigned profile_pc_shift;
+#define PROFILE_PC_SHIFT(p) ((p)->profile_pc_shift)
+#define PROFILE_PC_BUCKET_SIZE(p) (PROFILE_PC_SHIFT (p) ? (1 << PROFILE_PC_SHIFT (p)) : 0)
+ unsigned *profile_pc_count;
+#define PROFILE_PC_COUNT(p) ((p)->profile_pc_count)
+ sim_event *profile_pc_event;
+#define PROFILE_PC_EVENT(p) ((p)->profile_pc_event)
+#endif
+
+ /* Profile output goes to this or stderr if NULL.
+ We can't store `stderr' here as stderr goes through a callback. */
+ FILE *profile_file;
+#define PROFILE_FILE(p) ((p)->profile_file)
+
+ /* When reporting a profile summary, hook to include per-processor
+ target specific profile information */
+ PROFILE_INFO_CPU_CALLBACK_FN *info_cpu_callback;
+#define PROFILE_INFO_CPU_CALLBACK(p) ((p)->info_cpu_callback)
+
+ /* When reporting a profile summary, hook to include common target
+ specific profile information */
+ PROFILE_INFO_CALLBACK_FN *info_callback;
+#define STATE_PROFILE_INFO_CALLBACK(sd) \
+(CPU_PROFILE_DATA (STATE_CPU (sd, 0))->info_callback)
+
+} PROFILE_DATA;
+
+/* Usage macros. */
+
+#define CPU_PROFILE_FLAGS(cpu) PROFILE_FLAGS (CPU_PROFILE_DATA (cpu))
+
+#if WITH_PROFILE_INSN_P
+#define PROFILE_COUNT_INSN(cpu, pc, insn_num) \
+do { \
+ if (CPU_PROFILE_FLAGS (cpu) [PROFILE_INSN_IDX]) \
+ ++ PROFILE_INSN_COUNT (CPU_PROFILE_DATA (cpu)) [insn_num]; \
+} while (0)
+#else
+#define PROFILE_COUNT_INSN(cpu, pc, insn_num)
+#endif /* ! insn */
+
+#if WITH_PROFILE_MEMORY_P
+#define PROFILE_COUNT_READ(cpu, addr, mode_num) \
+do { \
+ if (CPU_PROFILE_FLAGS (cpu) [PROFILE_MEMORY_IDX]) \
+ ++ PROFILE_READ_COUNT (CPU_PROFILE_DATA (cpu)) [mode_num]; \
+} while (0)
+#define PROFILE_COUNT_WRITE(cpu, addr, mode_num) \
+do { \
+ if (CPU_PROFILE_FLAGS (cpu) [PROFILE_MEMORY_IDX]) \
+ ++ PROFILE_WRITE_COUNT (CPU_PROFILE_DATA (cpu)) [mode_num]; \
+} while (0)
+#else
+#define PROFILE_COUNT_READ(cpu, addr, mode_num)
+#define PROFILE_COUNT_WRITE(cpu, addr, mode_num)
+#endif /* ! memory */
+
+#if WITH_PROFILE_CORE_P
+#define PROFILE_COUNT_CORE(cpu, addr, size, map) \
+do { \
+ if (CPU_PROFILE_FLAGS (cpu) [PROFILE_CORE_IDX]) \
+ PROFILE_CORE_COUNT (CPU_PROFILE_DATA (cpu)) [map] += 1; \
+} while (0)
+#else
+#define PROFILE_COUNT_CORE(cpu, addr, size, map)
+#endif /* ! core */
+
+#if WITH_PROFILE_MODEL_P
+/* Model profiling is a bit more complicated so we just provide a macro
+ to say whether to do it or not. */
+#define PROFILE_MODEL_P(cpu) \
+(CPU_PROFILE_FLAGS (cpu) [PROFILE_MODEL_IDX])
+#else
+#define PROFILE_MODEL_P(cpu) 0
+#endif /* ! model */
+
+#endif /* SIM_PROFILE_H */
diff --git a/sim/m32r/ChangeLog b/sim/m32r/ChangeLog
index 6958fc5..d40632e 100644
--- a/sim/m32r/ChangeLog
+++ b/sim/m32r/ChangeLog
@@ -1,3 +1,9 @@
+Thu Feb 26 18:38:35 1998 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * sim-if.c (sim_open): Initialize PROFILE_INFO_CPU_CALLBACK.
+
+ * sim-if.c (sim_info): Delete.
+
start-sanitize-m32rx
Fri Feb 27 10:14:29 1998 Doug Evans <devans@canuck.cygnus.com>
diff --git a/sim/m32r/Makefile.in b/sim/m32r/Makefile.in
index 1ad6bb4..add004b 100644
--- a/sim/m32r/Makefile.in
+++ b/sim/m32r/Makefile.in
@@ -20,14 +20,18 @@
## COMMON_PRE_CONFIG_FRAG
-M32R_OBJS = m32r.o decode.o extract.o sem.o model.o mloop.o
+M32R_OBJS = m32r.o cpu.o decode.o extract.o sem.o model.o mloop.o
# start-sanitize-m32rx
-M32RX_OBJS = m32rx.o decodex.o semx.o modelx.o mloopx.o
+M32RX_OBJS = m32rx.o cpux.o decodex.o semx.o modelx.o mloopx.o
# end-sanitize-m32rx
SIM_OBJS = \
$(SIM_NEW_COMMON_OBJS) \
- sim-hload.o sim-hrw.o sim-engine.o sim-model.o sim-reason.o \
+ sim-engine.o \
+ sim-hload.o \
+ sim-hrw.o \
+ sim-model.o \
+ sim-reason.o \
cgen-utils.o cgen-trace.o cgen-scache.o \
sim-if.o arch.o \
$(start-sanitize-m32rx) \
@@ -47,6 +51,9 @@ SIM_EXTRA_CFLAGS =
SIM_RUN_OBJS = nrun.o
SIM_EXTRA_CLEAN = m32r-clean
+# This selects the m32r newlib/libgloss syscall definitions.
+NL_TARGET = -DNL_TARGET_m32r
+
## COMMON_POST_CONFIG_FRAG
arch = m32r
@@ -81,10 +88,12 @@ mloop.c: $(srcdir)/../common/genmloop.sh mloop.in Makefile
| sed -e 's/@cpu@/m32r/' -e 's/@CPU@/M32R/' >mloop.c
mloop.o: mloop.c sem-switch.c $(INCLUDE_DEPS) $(OPS_INCLUDE_DEPS) cpu.h
+cpu.o: cpu.c $(INCLUDE_DEPS) $(OPS_INCLUDE_DEPS) cpu.h
decode.o: decode.c decode.h $(INCLUDE_DEPS) $(OPS_INCLUDE_DEPS) cpu-opc.h cpu.h
extract.o: extract.c decode.h $(INCLUDE_DEPS) $(OPS_INCLUDE_DEPS) cpu.h
$(CC) -c $(srcdir)/extract.c $(ALL_CFLAGS) -DSCACHE_P
sem.o: sem.c decode.h $(INCLUDE_DEPS) $(OPS_INCLUDE_DEPS) cpu.h
+ $(CC) -c $(srcdir)/sem.c $(ALL_CFLAGS) -DSCACHE_P
model.o: model.c $(INCLUDE_DEPS) cpu-opc.h cpu.h
#sem-cache.o: sem.c decode.h $(INCLUDE_DEPS) $(OPS_INCLUDE_DEPS) cpu.h
@@ -99,11 +108,12 @@ m32rx.o: m32rx.c $(INCLUDE_DEPS) $(OPS_INCLUDE_DEPS) cpux.h
mloopx.c: $(srcdir)/../common/genmloop.sh mloopx.in Makefile
rm -f mloopx.c
$(SHELL) $(srcdir)/../common/genmloop.sh $(SHELL) \
- -mono -no-scache -no-fast -no-parallel \
+ -mono -no-scache -no-fast -parallel \
m32r $(srcdir)/mloopx.in \
| sed -e 's/@cpu@/m32rx/' -e 's/@CPU@/M32RX/' >mloopx.c
mloopx.o: mloopx.c readx.c $(INCLUDE_DEPS) $(OPS_INCLUDE_DEPS) cpux.h
+cpux.o: cpux.c $(INCLUDE_DEPS) $(OPS_INCLUDE_DEPS) cpux.h
decodex.o: decodex.c decodex.h $(INCLUDE_DEPS) $(OPS_INCLUDE_DEPS) cpu-opc.h cpux.h
semx.o: semx.c decodex.h $(INCLUDE_DEPS) $(OPS_INCLUDE_DEPS) cpux.h
modelx.o: modelx.c $(INCLUDE_DEPS) cpu-opc.h cpux.h
diff --git a/sim/m32r/sim-if.c b/sim/m32r/sim-if.c
index cb11a27..2335f39 100644
--- a/sim/m32r/sim-if.c
+++ b/sim/m32r/sim-if.c
@@ -24,9 +24,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "libiberty.h"
#include "bfd.h"
#include "sim-core.h"
+#include "targ-vals.h"
static SIM_RC alloc_cpu (SIM_DESC, struct _bfd *, char **);
static void free_state (SIM_DESC);
+static void print_m32r_misc_cpu (SIM_CPU *cpu, int verbose);
/* Records simulator descriptor so utilities like m32r_dump_regs can be
called from gdb. */
@@ -155,10 +157,15 @@ sim_open (kind, callback, abfd, argv)
{
int i;
- /* Only needed for profiling, but the structure member is small. */
for (i = 0; i < MAX_NR_PROCESSORS; ++i)
- memset (& CPU_M32R_MISC_PROFILE (STATE_CPU (sd, i)), 0,
- sizeof (CPU_M32R_MISC_PROFILE (STATE_CPU (sd, i))));
+ {
+ /* Only needed for profiling, but the structure member is small. */
+ memset (& CPU_M32R_MISC_PROFILE (STATE_CPU (sd, i)), 0,
+ sizeof (CPU_M32R_MISC_PROFILE (STATE_CPU (sd, i))));
+ /* Hook in callback for reporting these stats */
+ PROFILE_INFO_CPU_CALLBACK (CPU_PROFILE_DATA (STATE_CPU (sd, i)))
+ = print_m32r_misc_cpu;
+ }
}
/* Store in a global so things like sparc32_dump_regs can be invoked
@@ -185,14 +192,12 @@ sim_create_inferior (sd, abfd, argv, envp)
{
SIM_CPU *current_cpu = STATE_CPU (sd, 0);
SIM_ADDR addr;
- SI taddr;
if (abfd != NULL)
addr = bfd_get_start_address (abfd);
else
addr = 0;
- taddr = endian_h2t_4 (addr);
- sim_store_register (sd, PC_REGNUM, (unsigned char *) &taddr, 4);
+ h_pc_set (current_cpu, addr);
#if 0
STATE_ARGV (sd) = sim_copy_argv (argv);
@@ -260,14 +265,6 @@ print_m32r_misc_cpu (SIM_CPU *cpu, int verbose)
}
}
-void
-sim_info (sd, verbose)
- SIM_DESC sd;
- int verbose;
-{
- profile_print (sd, STATE_VERBOSE_P (sd), NULL, print_m32r_misc_cpu);
-}
-
/* The contents of BUF are in target byte order. */
int
@@ -341,3 +338,153 @@ sim_engine_illegal_insn (current_cpu, pc)
sim_engine_halt (CPU_STATE (current_cpu), current_cpu, NULL, pc,
sim_stopped, SIM_SIGILL);
}
+
+/* Utility fns to access registers, without knowing the current mach.
+ FIXME: Machine generate? */
+
+USI
+h_pc_get (SIM_CPU *current_cpu)
+{
+ switch (STATE_ARCHITECTURE (CPU_STATE (current_cpu))->mach)
+ {
+ case bfd_mach_m32r :
+ return m32r_h_pc_get (current_cpu);
+/* start-sanitize-m32rx */
+#ifdef HAVE_CPU_M32RX
+ case bfd_mach_m32rx :
+ return m32rx_h_pc_get (current_cpu);
+#endif
+/* end-sanitize-m32rx */
+ default :
+ abort ();
+ }
+}
+
+void
+h_pc_set (SIM_CPU *current_cpu, USI newval)
+{
+ switch (STATE_ARCHITECTURE (CPU_STATE (current_cpu))->mach)
+ {
+ case bfd_mach_m32r :
+ m32r_h_pc_set (current_cpu, newval);
+ break;
+/* start-sanitize-m32rx */
+#ifdef HAVE_CPU_M32RX
+ case bfd_mach_m32rx :
+ m32rx_h_pc_set (current_cpu, newval);
+ break;
+#endif
+/* end-sanitize-m32rx */
+ default :
+ abort ();
+ }
+}
+
+SI
+h_gr_get (SIM_CPU *current_cpu, UINT regno)
+{
+ switch (STATE_ARCHITECTURE (CPU_STATE (current_cpu))->mach)
+ {
+ case bfd_mach_m32r :
+ return m32r_h_gr_get (current_cpu, regno);
+/* start-sanitize-m32rx */
+#ifdef HAVE_CPU_M32RX
+ case bfd_mach_m32rx :
+ return m32rx_h_gr_get (current_cpu, regno);
+#endif
+/* end-sanitize-m32rx */
+ default :
+ abort ();
+ }
+}
+
+void
+h_gr_set (SIM_CPU *current_cpu, UINT regno, SI newval)
+{
+ switch (STATE_ARCHITECTURE (CPU_STATE (current_cpu))->mach)
+ {
+ case bfd_mach_m32r :
+ m32r_h_gr_set (current_cpu, regno, newval);
+ break;
+/* start-sanitize-m32rx */
+#ifdef HAVE_CPU_M32RX
+ case bfd_mach_m32rx :
+ m32rx_h_gr_set (current_cpu, regno, newval);
+ break;
+#endif
+/* end-sanitize-m32rx */
+ default :
+ abort ();
+ }
+}
+
+/* Read/write functions for system call interface. */
+
+static int
+syscall_read_mem (host_callback *cb, struct cb_syscall *sc,
+ unsigned long taddr, char *buf, int bytes)
+{
+ SIM_DESC sd = (SIM_DESC) sc->p1;
+ SIM_CPU *cpu = (SIM_CPU *) sc->p2;
+
+ return sim_core_read_buffer (sd, cpu, sim_core_read_map, buf, taddr, bytes);
+}
+
+static int
+syscall_write_mem (host_callback *cb, struct cb_syscall *sc,
+ unsigned long taddr, const char *buf, int bytes)
+{
+ SIM_DESC sd = (SIM_DESC) sc->p1;
+ SIM_CPU *cpu = (SIM_CPU *) sc->p2;
+
+ return sim_core_write_buffer (sd, cpu, sim_core_write_map, buf, taddr, bytes);
+}
+
+/* Trap support. */
+
+void
+do_trap (SIM_CPU *current_cpu, int num)
+{
+ SIM_DESC sd = CPU_STATE (current_cpu);
+ host_callback *cb = STATE_CALLBACK (sd);
+
+ switch (num)
+ {
+ case 0 :
+ /* Trap 0 is used for system calls. */
+ {
+ CB_SYSCALL s;
+
+ CB_SYSCALL_INIT (&s);
+ s.func = h_gr_get (current_cpu, 0);
+ s.arg1 = h_gr_get (current_cpu, 1);
+ s.arg2 = h_gr_get (current_cpu, 2);
+ s.arg3 = h_gr_get (current_cpu, 3);
+
+ if (s.func == TARGET_SYS_exit)
+ {
+ sim_engine_halt (sd, current_cpu, NULL, h_pc_get (current_cpu),
+ sim_exited, s.arg1);
+ }
+
+ s.p1 = (PTR) sd;
+ s.p2 = (PTR) current_cpu;
+ s.read_mem = syscall_read_mem;
+ s.write_mem = syscall_write_mem;
+ cb_syscall (STATE_CALLBACK (sd), &s);
+ h_gr_set (current_cpu, 2, s.errcode);
+ h_gr_set (current_cpu, 0, s.result);
+ h_gr_set (current_cpu, 1, s.result2);
+ break;
+ }
+
+ case 1: /* breakpoint trap */
+ sim_engine_halt (sd, current_cpu, NULL, NULL_CIA,
+ sim_stopped, SIM_SIGTRAP);
+ break;
+
+ default :
+ /* Unless environment operating, ignore other traps. */
+ break;
+ }
+}
diff --git a/sim/mips/ChangeLog b/sim/mips/ChangeLog
index bfda50a..9b2a8e5 100644
--- a/sim/mips/ChangeLog
+++ b/sim/mips/ChangeLog
@@ -1,3 +1,11 @@
+Fri Feb 27 13:49:49 1998 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * sim-main.h (HIACCESS, LOACCESS): Always define.
+
+ * mdmx.igen (Maxi, Mini): Rename Max, Min.
+
+ * interp.c (sim_info): Delete.
+
Fri Feb 27 18:41:01 1998 Doug Evans <devans@canuck.cygnus.com>
* interp.c (DECLARE_OPTION_HANDLER): Use it.
diff --git a/sim/mips/interp.c b/sim/mips/interp.c
index ec9bd0c..5de00e3 100644
--- a/sim/mips/interp.c
+++ b/sim/mips/interp.c
@@ -781,43 +781,6 @@ sim_fetch_register (sd,rn,memory,length)
}
-void
-sim_info (sd,verbose)
- SIM_DESC sd;
- int verbose;
-{
- /* Accessed from the GDB "info files" command: */
- if (STATE_VERBOSE_P (sd) || verbose)
- {
-
- sim_io_printf (sd, "MIPS %d-bit %s endian simulator\n",
- WITH_TARGET_WORD_BITSIZE,
- (CURRENT_TARGET_BYTE_ORDER == BIG_ENDIAN ? "Big" : "Little"));
-
-#if !defined(FASTSIM)
- /* It would be a useful feature, if when performing multi-cycle
- simulations (rather than single-stepping) we keep the start and
- end times of the execution, so that we can give a performance
- figure for the simulator. */
-#endif /* !FASTSIM */
- sim_io_printf (sd, "Number of execution cycles = %ld\n",
- (long) sim_events_time (sd));
-
- /* print information pertaining to MIPS ISA and architecture being simulated */
- /* things that may be interesting */
- /* instructions executed - if available */
- /* cycles executed - if available */
- /* pipeline stalls - if available */
- /* virtual time taken */
- /* profiling size */
- /* profiling frequency */
- /* profile minpc */
- /* profile maxpc */
- }
- profile_print (sd, STATE_VERBOSE_P (sd), NULL, NULL);
-}
-
-
SIM_RC
sim_create_inferior (sd, abfd, argv,env)
SIM_DESC sd;
diff --git a/sim/mips/mdmx.igen b/sim/mips/mdmx.igen
index e10d7d2..5222863 100644
--- a/sim/mips/mdmx.igen
+++ b/sim/mips/mdmx.igen
@@ -1,3 +1,4 @@
+// -*- C -*-
// Media Instructions
// ------------------
@@ -539,7 +540,7 @@
// Vector Maximum.
-:function:64,f::signed:Max:int scale, signed l, signed r
+:function:64,f::signed:Maxi:int scale, signed l, signed r
*mdmx:
// start-sanitize-vr5400
*vr5400:
@@ -562,16 +563,16 @@
int scale = get_scale (SD_, SEL);
for (i = 0; i < (8 >> scale); i++)
store_vr (SD_, scale, VD, i,
- Max (SD_, scale,
- value_vr (SD_, scale, VS, i),
- select_vr (SD_, SEL, VT, i)));
+ Maxi (SD_, scale,
+ value_vr (SD_, scale, VS, i),
+ select_vr (SD_, SEL, VT, i)));
}
// Vector Minimum.
-:function:64,f::signed:Min:int scale, signed l, signed r
+:function:64,f::signed:Mini:int scale, signed l, signed r
*mdmx:
// start-sanitize-vr5400
*vr5400:
@@ -594,9 +595,9 @@
int scale = get_scale (SD_, SEL);
for (i = 0; i < (8 >> scale); i++)
store_vr (SD_, scale, VD, i,
- Min (SD_, scale,
- value_vr (SD_, scale, VS, i),
- select_vr (SD_, SEL, VT, i)));
+ Mini (SD_, scale,
+ value_vr (SD_, scale, VS, i),
+ select_vr (SD_, SEL, VT, i)));
}
diff --git a/sim/mips/sim-main.h b/sim/mips/sim-main.h
index 5dd7071..f9a9278 100644
--- a/sim/mips/sim-main.h
+++ b/sim/mips/sim-main.h
@@ -589,7 +589,6 @@ struct _sim_cpu {
#define LLBIT ((CPU)->llbit)
-#if 0
/* The HIACCESS and LOACCESS counts are used to ensure that
corruptions caused by using the HI or LO register to close to a
following operation are spotted. */
@@ -599,6 +598,7 @@ struct _sim_cpu {
#define HIACCESS ((CPU)->hiaccess)
#define LOACCESS ((CPU)->loaccess)
+#if 0
unsigned_word HLPC;
/* If either of the preceding two instructions have accessed the HI
or LO registers, then the values they see should be
diff --git a/sim/tic80/ChangeLog b/sim/tic80/ChangeLog
index cd494e5..4ab9129 100644
--- a/sim/tic80/ChangeLog
+++ b/sim/tic80/ChangeLog
@@ -1,3 +1,7 @@
+Thu Feb 26 19:08:37 1998 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * sim-calls.c (sim_info): Delete.
+
Tue Feb 17 14:35:05 1998 Michael Meissner <meissner@cygnus.com>
* misc.c (tic80_trace_cond_br): Take size/code arguments, and
diff --git a/sim/tic80/Makefile.in b/sim/tic80/Makefile.in
index c2ddcdb..45a1862 100644
--- a/sim/tic80/Makefile.in
+++ b/sim/tic80/Makefile.in
@@ -13,14 +13,14 @@
SIM_OBJS = \
$(SIM_NEW_COMMON_OBJS) \
support.o idecode.o semantics.o itable.o misc.o \
+ sim-engine.o \
sim-calls.o \
sim-hload.o \
sim-hrw.o \
- sim-engine.o \
- sim-run.o \
+ sim-reason.o \
sim-resume.o \
+ sim-run.o \
sim-stop.o \
- sim-reason.o
# List of extra dependencies.
# Generally this consists of simulator specific files included by sim-main.h.
diff --git a/sim/tic80/sim-calls.c b/sim/tic80/sim-calls.c
index b3130df..c60bd9b 100644
--- a/sim/tic80/sim-calls.c
+++ b/sim/tic80/sim-calls.c
@@ -168,12 +168,6 @@ sim_store_register (SIM_DESC sd, int regnr, unsigned char *buf, int length)
}
-void
-sim_info (SIM_DESC sd, int verbose)
-{
-}
-
-
SIM_RC
sim_create_inferior (SIM_DESC sd,
struct _bfd *abfd,
diff --git a/sim/v850/ChangeLog b/sim/v850/ChangeLog
index 3e6b935..357c593 100644
--- a/sim/v850/ChangeLog
+++ b/sim/v850/ChangeLog
@@ -1,3 +1,19 @@
+Thu Feb 26 19:09:47 1998 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * interp.c (sim_info): Delete.
+
+Wed Feb 18 10:47:32 1998 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * sim-main.h (TRACE_ALU_INPUT*): Delete. Moved to sim-trace.[hc].
+
+ * simops.c (trace_result): Call trace_generic instead of
+ trace_one_insn.
+ (trace_module): Change variable type to integer.
+ (trace_input): Initialize trace_module with TRACE_ALU_IDX.
+
+ * sim-main.h (trace_module): Change variable decl to integer type.
+ (TRACE_BRANCH*, TRACE_LD, TRACE_ST): Update.
+
Tue Feb 17 12:51:18 1998 Andrew Cagney <cagney@b1.cygnus.com>
* interp.c (sim_store_register, sim_fetch_register): Pass in
diff --git a/sim/v850/interp.c b/sim/v850/interp.c
index 3532011..d111590 100644
--- a/sim/v850/interp.c
+++ b/sim/v850/interp.c
@@ -1,7 +1,7 @@
-#include <signal.h>
#include "sim-main.h"
#include "sim-options.h"
#include "v850_sim.h"
+#include "sim-assert.h"
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
@@ -188,6 +188,8 @@ sim_open (kind, cb, abfd, argv)
SIM_DESC sd = sim_state_alloc (kind, cb);
int mach;
+ SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
+
/* for compatibility */
simulator = sd;
@@ -262,18 +264,16 @@ sim_open (kind, cb, abfd, argv)
case bfd_mach_v850:
/* start-sanitize-v850e */
case bfd_mach_v850e:
- /* end-sanitize-v850e */
STATE_CPU (sd, 0)->psw_mask = (PSW_NP | PSW_EP | PSW_ID | PSW_SAT
| PSW_CY | PSW_OV | PSW_S | PSW_Z);
break;
- /* start-sanitize-v850eq */
- case bfd_mach_v850eq:
+ case bfd_mach_v850ea:
PSW |= PSW_US;
STATE_CPU (sd, 0)->psw_mask = (PSW_US
| PSW_NP | PSW_EP | PSW_ID | PSW_SAT
| PSW_CY | PSW_OV | PSW_S | PSW_Z);
break;
- /* end-sanitize-v850eq */
+ /* end-sanitize-v850e */
}
return sd;
@@ -295,14 +295,6 @@ sim_stop (sd)
return 0;
}
-void
-sim_info (sd, verbose)
- SIM_DESC sd;
- int verbose;
-{
- profile_print (sd, STATE_VERBOSE_P (sd), NULL, NULL);
-}
-
SIM_RC
sim_create_inferior (sd, prog_bfd, argv, env)
SIM_DESC sd;
@@ -313,32 +305,36 @@ sim_create_inferior (sd, prog_bfd, argv, env)
memset (&State, 0, sizeof (State));
if (prog_bfd != NULL)
PC = bfd_get_start_address (prog_bfd);
- /* start-sanitize-v850eq */
- /* For v850eq, set PSW[US] by default */
+ /* start-sanitize-v850e */
+ /* For v850ea, set PSW[US] by default */
if (STATE_ARCHITECTURE (sd) != NULL
&& STATE_ARCHITECTURE (sd)->arch == bfd_arch_v850
- && STATE_ARCHITECTURE (sd)->mach == bfd_mach_v850eq)
+ && STATE_ARCHITECTURE (sd)->mach == bfd_mach_v850ea)
PSW |= PSW_US;
- /* end-sanitize-v850eq */
+ /* end-sanitize-v850e */
return SIM_RC_OK;
}
-void
-sim_fetch_register (sd, rn, memory)
+int
+sim_fetch_register (sd, rn, memory, length)
SIM_DESC sd;
int rn;
unsigned char *memory;
+ int length;
{
*(unsigned32*)memory = H2T_4 (State.regs[rn]);
+ return -1;
}
-void
-sim_store_register (sd, rn, memory)
+int
+sim_store_register (sd, rn, memory, length)
SIM_DESC sd;
int rn;
unsigned char *memory;
+ int length;
{
State.regs[rn] = T2H_4 (*(unsigned32*)memory);
+ return -1;
}
void