#include "gdb/sim-h8300.h"
#include "sys/stat.h"
#include "sys/types.h"
+#include "sim-options.h"
#ifndef SIGTRAP
# define SIGTRAP 5
return store_1 (sd, arg, n, 1);
}
-static union
-{
- short int i;
- struct
- {
- char low;
- char high;
- }
- u;
-} littleendian;
-
/* Flag to be set whenever a new SIM_DESC object is created. */
static int init_pointers_needed = 1;
{
int i;
- littleendian.i = 1;
-
if (h8300smode && !h8300_normal_mode)
memory_size = H8300S_MSIZE;
else if (h8300hmode && !h8300_normal_mode)
h8300_normal_mode = 1;
}
+static sim_cia
+h8300_pc_get (sim_cpu *cpu)
+{
+ return cpu->pc;
+}
+
+static void
+h8300_pc_set (sim_cpu *cpu, sim_cia pc)
+{
+ cpu->pc = pc;
+}
+
/* Cover function of sim_state_free to free the cpu buffers as well. */
static void
struct bfd *abfd,
char **argv)
{
+ int i;
SIM_DESC sd;
sim_cpu *cpu;
sd = sim_state_alloc (kind, callback);
- sd->cpu = sim_cpu_alloc (sd, 0);
+
+ /* The cpu data is kept in a separately allocated chunk of memory. */
+ if (sim_cpu_alloc_all (sd, 1, /*cgen_cpu_max_extra_bytes ()*/0) != SIM_RC_OK)
+ {
+ free_state (sd);
+ return 0;
+ }
+
cpu = STATE_CPU (sd, 0);
SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
sim_state_initialize (sd, cpu);
return 0;
}
+ /* CPU specific initialization. */
+ for (i = 0; i < MAX_NR_PROCESSORS; ++i)
+ {
+ SIM_CPU *cpu = STATE_CPU (sd, i);
+
+ CPU_PC_FETCH (cpu) = h8300_pc_get;
+ CPU_PC_STORE (cpu) = h8300_pc_set;
+ }
+
/* sim_hw_configure (sd); */
/* FIXME: Much of the code in sim_load can be moved here. */
return sd;
}
-void
-sim_close (SIM_DESC sd, int quitting)
-{
- /* Nothing to do. */
-}
-
/* Called by gdb to load a program into memory. */
SIM_RC