aboutsummaryrefslogtreecommitdiff
path: root/sim/common
diff options
context:
space:
mode:
authorStan Shebs <shebs@codesourcery.com>1999-04-26 18:34:20 +0000
committerStan Shebs <shebs@codesourcery.com>1999-04-26 18:34:20 +0000
commit7a292a7adf506b866905b06b3024c0fd411c4583 (patch)
tree5b208bb48269b8a82d5c3a5f19c87b45a62a22f4 /sim/common
parent1996fae84682e8ddd146215dd2959ad1ec924c09 (diff)
downloadgdb-7a292a7adf506b866905b06b3024c0fd411c4583.zip
gdb-7a292a7adf506b866905b06b3024c0fd411c4583.tar.gz
gdb-7a292a7adf506b866905b06b3024c0fd411c4583.tar.bz2
import gdb-19990422 snapshot
Diffstat (limited to 'sim/common')
-rw-r--r--sim/common/ChangeLog53
-rw-r--r--sim/common/cgen-ops.h148
-rw-r--r--sim/common/cgen-run.c8
-rw-r--r--sim/common/cgen-trace.c8
-rw-r--r--sim/common/cgen-types.h8
-rw-r--r--sim/common/cgen-utils.c18
-rw-r--r--sim/common/nrun.c6
-rw-r--r--sim/common/run.c6
-rw-r--r--sim/common/sim-core.c15
-rw-r--r--sim/common/sim-core.h9
-rw-r--r--sim/common/sim-events.c21
-rw-r--r--sim/common/sim-io.c16
-rw-r--r--sim/common/sim-memopt.c7
-rw-r--r--sim/common/sim-model.h3
-rw-r--r--sim/common/sim-n-core.h4
15 files changed, 240 insertions, 90 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index bde0710..ed3c601 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,3 +1,56 @@
+Fri Apr 16 16:43:22 1999 Doug Evans <devans@charmed.cygnus.com>
+
+ * sim-core.c (device_error,device_io_read_buffer,
+ device_io_write_buffer): Delete decls.
+ * sim-core.h: Put them here.
+
+ * sim-core.c (sim_core_read_buffer): Pass sd to device_io_read_buffer.
+ (sim_core_write_buffer): Pass sd to device_io_write_buffer.
+ * sim-n-core.h (sim_core_read_aligned_N): Ditto.
+ (sim_core_write_aligned_N): Ditto.
+
+1999-04-14 Stephane Carrez <stcarrez@worldnet.fr>
+
+ * sim-memopt.c (sim_memory_uninstall): Don't look into
+ free()d memory.
+
+1999-04-14 Doug Evans <devans@casey.cygnus.com>
+
+ * cgen-utils.scm (virtual_insn_entries): Update attribute definition.
+
+1999-04-13 Doug Evans <devans@casey.cygnus.com>
+
+ * sim-core.c (sim_core_read_buffer): Handle NULL cpu when WITH_DEVICES.
+ (sim_core_write_buffer): Ditto.
+
+1999-04-02 Keith Seitz <keiths@cygnus.com>
+
+ * sim-io.c (sim_io_poll_quit): Only call the poll_quit callback
+ after the interval counter has expired.
+ (POLL_QUIT_INTERVAL): Define. Used to tweak the frequency of
+ poll_quit callbacks. May be overridden by Makefile.
+ (poll_quit_counter): New global.
+ * sim-events.c: Remove all mentions of ui_loop_hook. The
+ host callback "poll_quit" will serve the purpose.
+ * run.c: Add definition of ui_loop_hook when NEED_UI_LOOP_HOOK
+ is defined.
+ * nrun.c: Remove declaration of ui_loop_hook.
+
+Wed Mar 31 18:55:41 1999 Doug Evans <devans@canuck.cygnus.com>
+
+ * cgen-run.c (sim_resume): Don't tell main loop to run "forever"
+ if being used by gdb.
+
+1999-03-22 Doug Evans <devans@casey.cygnus.com>
+
+ * cgen-types.h (XF,TF): Tweak.
+ * cgen-ops.h: Redo inline support. Delete DI_FN_SUPPORT,
+ in cgen-types.h.
+ (SUBWORD*,JOIN*): Define.
+ * cgen-trace.c (sim_cgen_disassemble_insn): Update, base_insn_bitsize
+ moved into cpu descriptor.
+ * sim-model.h (MACH): New member `num'.
+
1999-02-09 Doug Evans <devans@casey.cygnus.com>
* Make-common.in (CGEN_READ_SCM): Renamed from CGEN_MAIN_SCM.
diff --git a/sim/common/cgen-ops.h b/sim/common/cgen-ops.h
index 1ec0e6c..6b89859 100644
--- a/sim/common/cgen-ops.h
+++ b/sim/common/cgen-ops.h
@@ -1,5 +1,5 @@
/* Semantics ops support for CGEN-based simulators.
- Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
Contributed by Cygnus Solutions.
This file is part of the GNU Simulators.
@@ -23,6 +23,13 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#ifndef CGEN_SEM_OPS_H
#define CGEN_SEM_OPS_H
+#if defined (__GNUC__) && ! defined (SEMOPS_DEFINE_INLINE)
+#define SEMOPS_DEFINE_INLINE
+#define SEMOPS_INLINE extern inline
+#else
+#define SEMOPS_INLINE
+#endif
+
/* Semantic operations.
At one point this file was machine generated. Maybe it will be again. */
@@ -357,6 +364,7 @@ extern DI EXTSIDI PARAMS ((SI));
#else
#define EXTSIDI(x) ((DI) (SI) (x))
#endif
+
#if defined (SF_FN_SUPPORT) || defined (DF_FN_SUPPORT)
extern DF EXTSFDF PARAMS ((SF));
#else
@@ -387,6 +395,7 @@ extern TF EXTXFTF PARAMS ((XF));
#else
#define EXTXFTF(x) ((TF) (XF) (x))
#endif
+
#define ZEXTBIQI(x) ((QI) (BI) (x))
#define ZEXTBIHI(x) ((HI) (BI) (x))
#define ZEXTBISI(x) ((SI) (BI) (x))
@@ -413,6 +422,7 @@ extern DI ZEXTSIDI PARAMS ((SI));
#else
#define ZEXTSIDI(x) ((DI) (USI) (x))
#endif
+
#define TRUNCQIBI(x) ((BI) (QI) (x))
#define TRUNCHIBI(x) ((BI) (HI) (x))
#define TRUNCHIQI(x) ((QI) (HI) (x))
@@ -439,6 +449,7 @@ extern SI TRUNCDISI PARAMS ((DI));
#else
#define TRUNCDISI(x) ((SI) (DI) (x))
#endif
+
#if defined (DF_FN_SUPPORT) || defined (SF_FN_SUPPORT)
extern SF TRUNCDFSF PARAMS ((DF));
#else
@@ -469,6 +480,7 @@ extern XF TRUNCTFXF PARAMS ((TF));
#else
#define TRUNCTFXF(x) ((XF) (TF) (x))
#endif
+
#if defined (SF_FN_SUPPORT)
extern SF FLOATQISF PARAMS ((QI));
#else
@@ -549,6 +561,7 @@ extern TF FLOATDITF PARAMS ((DI));
#else
#define FLOATDITF(x) ((TF) (DI) (x))
#endif
+
#if defined (SF_FN_SUPPORT)
extern SF UFLOATQISF PARAMS ((QI));
#else
@@ -629,6 +642,7 @@ extern TF UFLOATDITF PARAMS ((DI));
#else
#define UFLOATDITF(x) ((TF) (UDI) (x))
#endif
+
#if defined (SF_FN_SUPPORT)
extern BI FIXSFBI PARAMS ((SF));
#else
@@ -729,6 +743,7 @@ extern DI FIXTFDI PARAMS ((TF));
#else
#define FIXTFDI(x) ((DI) (TF) (x))
#endif
+
#if defined (SF_FN_SUPPORT)
extern QI UFIXSFQI PARAMS ((SF));
#else
@@ -810,15 +825,118 @@ extern DI UFIXTFDI PARAMS ((TF));
#define UFIXTFDI(x) ((UDI) (TF) (x))
#endif
-/* Semantic support utilities. */
-
-#ifdef __GNUC__
+/* Composing/decomposing the various types. */
#ifdef SEMOPS_DEFINE_INLINE
-#define SEMOPS_INLINE
+
+SEMOPS_INLINE SF
+SUBWORDSISF (SIM_CPU *cpu, SI in)
+{
+ union { SI in; SF out; } x;
+ x.in = in;
+ return x.out;
+}
+
+SEMOPS_INLINE SI
+SUBWORDSFSI (SIM_CPU *cpu, SF in)
+{
+ union { SF in; SI out; } x;
+ x.in = in;
+ return x.out;
+}
+
+SEMOPS_INLINE SI
+SUBWORDDISI (SIM_CPU *cpu, DI in, int word)
+{
+ /* ??? endianness issues undecided */
+ if (CURRENT_TARGET_BYTE_ORDER == BIG_ENDIAN)
+ {
+ if (word == 0)
+ return (UDI) in >> 32;
+ else
+ return in;
+ }
+ else
+ {
+ if (word == 1)
+ return (UDI) in >> 32;
+ else
+ return in;
+ }
+}
+
+SEMOPS_INLINE SI
+SUBWORDDFSI (SIM_CPU *cpu, DF in, int word)
+{
+ /* ??? endianness issues undecided */
+ union { DF in; SI out[2]; } x;
+ x.in = in;
+ if (CURRENT_TARGET_BYTE_ORDER == BIG_ENDIAN)
+ return x.out[word];
+ else
+ return x.out[!word];
+}
+
+SEMOPS_INLINE SI
+SUBWORDTFSI (SIM_CPU *cpu, TF in, int word)
+{
+ /* ??? endianness issues undecided */
+ union { TF in; SI out[4]; } x;
+ x.in = in;
+ if (CURRENT_TARGET_BYTE_ORDER == BIG_ENDIAN)
+ return x.out[word];
+ else
+ return x.out[word ^ 3];
+}
+
+SEMOPS_INLINE DI
+JOINSIDI (SIM_CPU *cpu, SI x0, SI x1)
+{
+ if (CURRENT_TARGET_BYTE_ORDER == BIG_ENDIAN)
+ return MAKEDI (x0, x1);
+ else
+ return MAKEDI (x1, x0);
+}
+
+SEMOPS_INLINE DF
+JOINSIDF (SIM_CPU *cpu, SI x0, SI x1)
+{
+ union { SI in[2]; DF out; } x;
+ if (CURRENT_TARGET_BYTE_ORDER == BIG_ENDIAN)
+ x.in[0] = x0, x.in[1] = x1;
+ else
+ x.in[1] = x0, x.in[0] = x1;
+ return x.out;
+}
+
+SEMOPS_INLINE TF
+JOINSITF (SIM_CPU *cpu, SI x0, SI x1, SI x2, SI x3)
+{
+ union { SI in[4]; TF out; } x;
+ if (CURRENT_TARGET_BYTE_ORDER == BIG_ENDIAN)
+ x.in[0] = x0, x.in[1] = x1, x.in[2] = x2, x.in[3] = x3;
+ else
+ x.in[3] = x0, x.in[2] = x1, x.in[1] = x2, x.in[0] = x3;
+ return x.out;
+}
+
#else
-#define SEMOPS_INLINE extern inline
-#endif
+
+SF SUBWORDSISF (SIM_CPU *, SI);
+SI SUBWORDSFSI (SIM_CPU *, SF);
+SI SUBWORDDISI (SIM_CPU *, DI, int);
+SI SUBWORDDFSI (SIM_CPU *, DF, int);
+SI SUBWORDTFSI (SIM_CPU *, TF, int);
+
+DI JOINSIDI (SIM_CPU *, SI, SI);
+DF JOINSIDF (SIM_CPU *, SI, SI);
+TF JOINSITF (SIM_CPU *, SI, SI, SI, SI);
+
+#endif /* SUBWORD,JOIN */
+
+/* Semantic support utilities. */
+
+#ifdef SEMOPS_DEFINE_INLINE
SEMOPS_INLINE SI
ADDCSI (SI a, SI b, BI c)
@@ -877,21 +995,5 @@ UBI SUBCFSI (SI, SI, BI);
UBI SUBOFSI (SI, SI, BI);
#endif
-
-/* DI mode support if "long long" doesn't exist.
- At one point CGEN supported K&R C compilers, and ANSI C compilers without
- "long long". One can argue the various merits of keeping this in or
- throwing it out. I went to the trouble of adding it so for the time being
- I'm leaving it in. */
-
-#ifdef DI_FN_SUPPORT
-
-DI make_struct_di (SI, SI);
-/* FIXME: needed? */
-DI CONVHIDI (HI);
-DI CONVSIDI (SI);
-SI CONVDISI (DI);
-
-#endif /* DI_FN_SUPPORT */
#endif /* CGEN_SEM_OPS_H */
diff --git a/sim/common/cgen-run.c b/sim/common/cgen-run.c
index 07ee191..031bc1c 100644
--- a/sim/common/cgen-run.c
+++ b/sim/common/cgen-run.c
@@ -93,9 +93,13 @@ sim_resume (SIM_DESC sd, int step, int siggnal)
way to identify this case. */
int max_insns = (step
? 1
- : (nr_cpus == 1 /*&& wip:no-events*/)
+ : (nr_cpus == 1
+ /*&& wip:no-events*/
+ /* Don't do this if running under gdb, need to
+ poll ui for events. */
+ && STATE_OPEN_KIND (sd) == SIM_OPEN_STANDALONE)
? 0
- : 4); /*FIXME: magic number*/
+ : 8); /*FIXME: magic number*/
int fast_p = STATE_RUN_FAST_P (sd);
sim_events_preprocess (sd, last_cpu_nr >= nr_cpus, next_cpu_nr >= nr_cpus);
diff --git a/sim/common/cgen-trace.c b/sim/common/cgen-trace.c
index 9b7d1fa..db852d5 100644
--- a/sim/common/cgen-trace.c
+++ b/sim/common/cgen-trace.c
@@ -380,12 +380,12 @@ sim_cgen_disassemble_insn (SIM_CPU *cpu, const CGEN_INSN *insn,
length = sim_core_read_buffer (sd, cpu, read_map, &insn_buf, pc,
insn_length);
- switch (min (CGEN_BASE_INSN_SIZE, insn_length))
+ switch (min (cd->base_insn_bitsize, insn_bit_length))
{
case 0 : return; /* fake insn, typically "compile" (aka "invalid") */
- case 1 : insn_value = insn_buf.bytes[0]; break;
- case 2 : insn_value = T2H_2 (insn_buf.shorts[0]); break;
- case 4 : insn_value = T2H_4 (insn_buf.words[0]); break;
+ case 8 : insn_value = insn_buf.bytes[0]; break;
+ case 16 : insn_value = T2H_2 (insn_buf.shorts[0]); break;
+ case 32 : insn_value = T2H_4 (insn_buf.words[0]); break;
default: abort ();
}
diff --git a/sim/common/cgen-types.h b/sim/common/cgen-types.h
index e57e601..28c7205 100644
--- a/sim/common/cgen-types.h
+++ b/sim/common/cgen-types.h
@@ -100,10 +100,10 @@ extern DI make_struct_di (SI, SI);
/* FIXME: Need to provide libraries if these aren't appropriate for target,
or user's needs. */
-typedef float SF;
-typedef double DF;
-typedef double XF; /* FIXME: configure, provide library */
-typedef double TF; /* FIXME: configure, provide library */
+typedef float SF; /* FIXME: struct */
+typedef double DF; /* FIXME: struct */
+typedef struct { SI parts[3]; } XF; /* FIXME: configure, provide library */
+typedef struct { SI parts[4]; } TF; /* FIXME: configure, provide library */
/* These are used to record extracted raw data from an instruction, among other
things. It must be a host data type, and not a target one. */
diff --git a/sim/common/cgen-utils.c b/sim/common/cgen-utils.c
index 2faff5c..b1c9f02 100644
--- a/sim/common/cgen-utils.c
+++ b/sim/common/cgen-utils.c
@@ -59,28 +59,22 @@ const char *mode_names[] = {
static const CGEN_IBASE virtual_insn_entries[] =
{
{
- VIRTUAL_INSN_X_INVALID, "--invalid--", NULL, 0,
- { CGEN_INSN_NBOOL_ATTRS, V, { 0 } }
+ VIRTUAL_INSN_X_INVALID, "--invalid--", NULL, 0, { V, { 0 } }
},
{
- VIRTUAL_INSN_X_BEFORE, "--before--", NULL, 0,
- { CGEN_INSN_NBOOL_ATTRS, V, { 0 } }
+ VIRTUAL_INSN_X_BEFORE, "--before--", NULL, 0, { V, { 0 } }
},
{
- VIRTUAL_INSN_X_AFTER, "--after--", NULL, 0,
- { CGEN_INSN_NBOOL_ATTRS, V, { 0 } }
+ VIRTUAL_INSN_X_AFTER, "--after--", NULL, 0, { V, { 0 } }
},
{
- VIRTUAL_INSN_X_BEGIN, "--begin--", NULL, 0,
- { CGEN_INSN_NBOOL_ATTRS, V, { 0 } }
+ VIRTUAL_INSN_X_BEGIN, "--begin--", NULL, 0, { V, { 0 } }
},
{
- VIRTUAL_INSN_X_CHAIN, "--chain--", NULL, 0,
- { CGEN_INSN_NBOOL_ATTRS, V, { 0 } }
+ VIRTUAL_INSN_X_CHAIN, "--chain--", NULL, 0, { V, { 0 } }
},
{
- VIRTUAL_INSN_X_CTI_CHAIN, "--cti-chain--", NULL, 0,
- { CGEN_INSN_NBOOL_ATTRS, V, { 0 } }
+ VIRTUAL_INSN_X_CTI_CHAIN, "--cti-chain--", NULL, 0, { V, { 0 } }
}
};
diff --git a/sim/common/nrun.c b/sim/common/nrun.c
index 42be33e..2f13b1f 100644
--- a/sim/common/nrun.c
+++ b/sim/common/nrun.c
@@ -206,9 +206,3 @@ usage ()
fprintf (stderr, "Run `%s --help' for full list of options.\n", myname);
exit (1);
}
-
-
-#ifdef __CYGWIN32__
-/* no-op GUI update hook for standalone sim */
-void (*ui_loop_hook) PARAMS ((int)) = NULL;
-#endif
diff --git a/sim/common/run.c b/sim/common/run.c
index 2a701bc..72d7509 100644
--- a/sim/common/run.c
+++ b/sim/common/run.c
@@ -56,12 +56,16 @@ extern host_callback default_callback;
static char *myname;
-
/* NOTE: sim_size() and sim_trace() are going away */
extern int sim_trace PARAMS ((SIM_DESC sd));
extern int getopt ();
+#ifdef NEED_UI_LOOP_HOOK
+/* Gdb foolery. This is only needed for gdb using a gui. */
+int (*ui_loop_hook) PARAMS ((int signo));
+#endif
+
static SIM_DESC sd;
static RETSIGTYPE
diff --git a/sim/common/sim-core.c b/sim/common/sim-core.c
index 36627a2..f7579c4 100644
--- a/sim/common/sim-core.c
+++ b/sim/common/sim-core.c
@@ -29,13 +29,6 @@
#include "sim-hw.h"
#endif
-#if (WITH_DEVICES)
-/* TODO: create sim/common/device.h */
-void device_error (device *me, char* message, ...);
-int device_io_read_buffer(device *me, void *dest, int space, address_word addr, unsigned nr_bytes, sim_cpu *processor, sim_cia cia);
-int device_io_write_buffer(device *me, const void *source, int space, address_word addr, unsigned nr_bytes, sim_cpu *processor, sim_cia cia);
-#endif
-
/* "core" module install handler.
This is called via sim_module_install to install the "core"
@@ -534,6 +527,7 @@ sim_core_read_buffer (SIM_DESC sd,
if (mapping->device != NULL)
{
int nr_bytes = len - count;
+ sim_cia cia = cpu ? CIA_GET (cpu) : NULL_CIA;
if (raddr + nr_bytes - 1> mapping->bound)
nr_bytes = mapping->bound - raddr + 1;
if (device_io_read_buffer (mapping->device,
@@ -541,8 +535,9 @@ sim_core_read_buffer (SIM_DESC sd,
mapping->space,
raddr,
nr_bytes,
+ sd,
cpu,
- CIA_GET (cpu)) != nr_bytes)
+ cia) != nr_bytes)
break;
count += nr_bytes;
continue;
@@ -599,6 +594,7 @@ sim_core_write_buffer (SIM_DESC sd,
&& mapping->device != NULL)
{
int nr_bytes = len - count;
+ sim_cia cia = cpu ? CIA_GET (cpu) : NULL_CIA;
if (raddr + nr_bytes - 1 > mapping->bound)
nr_bytes = mapping->bound - raddr + 1;
if (device_io_write_buffer (mapping->device,
@@ -606,8 +602,9 @@ sim_core_write_buffer (SIM_DESC sd,
mapping->space,
raddr,
nr_bytes,
+ sd,
cpu,
- CIA_GET(cpu)) != nr_bytes)
+ cia) != nr_bytes)
break;
count += nr_bytes;
continue;
diff --git a/sim/common/sim-core.h b/sim/common/sim-core.h
index 7bf15a3..182569e 100644
--- a/sim/common/sim-core.h
+++ b/sim/common/sim-core.h
@@ -340,4 +340,13 @@ DECLARE_SIM_CORE_READ_N(misaligned,7,8)
#undef DECLARE_SIM_CORE_READ_N
+#if (WITH_DEVICES)
+/* TODO: create sim/common/device.h */
+/* These are defined with each particular cpu. */
+void device_error (device *me, char* message, ...);
+int device_io_read_buffer(device *me, void *dest, int space, address_word addr, unsigned nr_bytes, SIM_DESC sd, sim_cpu *processor, sim_cia cia);
+int device_io_write_buffer(device *me, const void *source, int space, address_word addr, unsigned nr_bytes, SIM_DESC sd, sim_cpu *processor, sim_cia cia);
+#endif
+
+
#endif
diff --git a/sim/common/sim-events.c b/sim/common/sim-events.c
index 4b7d9b4..fc21164 100644
--- a/sim/common/sim-events.c
+++ b/sim/common/sim-events.c
@@ -39,15 +39,6 @@
#include <signal.h> /* For SIGPROCMASK et.al. */
-#if __CYGWIN32__
-/* The ui_loop_hook is called to keep the GUI alive while the simulator
- is running. The counter is to make sure we do not wake it too often.
-*/
-
-extern void (*ui_loop_hook) PARAMS ((int));
-static unsigned int ui_loop_hook_counter = 0;
-#endif
-
typedef enum {
watch_invalid,
@@ -1171,18 +1162,6 @@ sim_events_process (SIM_DESC sd)
/* this round of processing complete */
events->nr_ticks_to_process = 0;
-
-#if __CYGWIN32__
- /* Now call the ui_loop_hook to give the gui a chance to
- process events. */
-
- if (ui_loop_hook != NULL)
- {
- /* attempt to limit calls to 1-10 per second */
- if (! (ui_loop_hook_counter++ & 0xf))
- (*ui_loop_hook) (-2); /* magic */
- }
-#endif
}
#endif
diff --git a/sim/common/sim-io.c b/sim/common/sim-io.c
index f3d2f67..26f4445 100644
--- a/sim/common/sim-io.c
+++ b/sim/common/sim-io.c
@@ -33,6 +33,13 @@
#include <unistd.h>
#endif
+/* Define the rate at which the simulator should poll the host
+ for a quit. */
+#ifndef POLL_QUIT_INTERVAL
+#define POLL_QUIT_INTERVAL 0x10
+#endif
+
+static int poll_quit_count = POLL_QUIT_INTERVAL;
/* See the file include/callbacks.h for a description */
@@ -304,9 +311,12 @@ sim_io_error(SIM_DESC sd,
void
sim_io_poll_quit(SIM_DESC sd)
{
- if (STATE_CALLBACK (sd)->poll_quit != NULL)
- if (STATE_CALLBACK (sd)->poll_quit (STATE_CALLBACK (sd)))
- sim_stop (sd);
+ if (STATE_CALLBACK (sd)->poll_quit != NULL && poll_quit_count-- < 0)
+ {
+ poll_quit_count = POLL_QUIT_INTERVAL;
+ if (STATE_CALLBACK (sd)->poll_quit (STATE_CALLBACK (sd)))
+ sim_stop (sd);
+ }
}
diff --git a/sim/common/sim-memopt.c b/sim/common/sim-memopt.c
index be52a66..6e12a45 100644
--- a/sim/common/sim-memopt.c
+++ b/sim/common/sim-memopt.c
@@ -449,6 +449,10 @@ sim_memory_uninstall (SIM_DESC sd)
/* delete it and its aliases */
alias = *entry;
+
+ /* next victim */
+ *entry = (*entry)->next;
+
while (alias != NULL)
{
sim_memopt *dead = alias;
@@ -456,9 +460,6 @@ sim_memory_uninstall (SIM_DESC sd)
sim_core_detach (sd, NULL, dead->level, dead->space, dead->addr);
zfree (dead);
}
-
- /* next victim */
- *entry = (*entry)->next;
}
}
diff --git a/sim/common/sim-model.h b/sim/common/sim-model.h
index 6f7769a..5272815 100644
--- a/sim/common/sim-model.h
+++ b/sim/common/sim-model.h
@@ -79,6 +79,9 @@ typedef struct {
/* This is the argument to bfd_scan_arch. */
const char *bfd_name;
#define MACH_BFD_NAME(m) ((m)->bfd_name)
+ enum mach_attr num;
+#define MACH_NUM(m) ((m)->num)
+
int word_bitsize;
#define MACH_WORD_BITSIZE(m) ((m)->word_bitsize)
int addr_bitsize;
diff --git a/sim/common/sim-n-core.h b/sim/common/sim-n-core.h
index 46eca03..7a04a9f 100644
--- a/sim/common/sim-n-core.h
+++ b/sim/common/sim-n-core.h
@@ -167,7 +167,7 @@ sim_core_read_aligned_N(sim_cpu *cpu,
if (WITH_CALLBACK_MEMORY && mapping->device != NULL)
{
unsigned_M data;
- if (device_io_read_buffer (mapping->device, &data, mapping->space, addr, N, cpu, cia) != N)
+ if (device_io_read_buffer (mapping->device, &data, mapping->space, addr, N, CPU_STATE (cpu), cpu, cia) != N)
device_error (mapping->device, "internal error - %s - io_read_buffer should not fail",
XSTRING (sim_core_read_aligned_N));
val = T2H_M (data);
@@ -298,7 +298,7 @@ sim_core_write_aligned_N(sim_cpu *cpu,
if (WITH_CALLBACK_MEMORY && mapping->device != NULL)
{
unsigned_M data = H2T_M (val);
- if (device_io_write_buffer (mapping->device, &data, mapping->space, addr, N, cpu, cia) != N)
+ if (device_io_write_buffer (mapping->device, &data, mapping->space, addr, N, CPU_STATE (cpu), cpu, cia) != N)
device_error (mapping->device, "internal error - %s - io_write_buffer should not fail",
XSTRING (sim_core_write_aligned_N));
break;