/* Simulator pseudo baseclass.
- Copyright 1997, 1998, 2003, 2007, 2008, 2009, 2010
- Free Software Foundation, Inc.
+ Copyright 1997-2015 Free Software Foundation, Inc.
Contributed by Cygnus Support.
information), include ``sim-base.h'':
#include "sim-basics.h"
- typedef address_word sim_cia;
/-* If `sim_cia' is not an integral value (e.g. a struct), define
CIA_ADDR to return the integral value. *-/
+ /-* typedef struct {...} sim_cia; *-/
/-* #define CIA_ADDR(cia) (...) *-/
#include "sim-base.h"
-
+
finally, two data types `struct _sim_cpu' and `struct sim_state'
are defined:
};
struct sim_state {
- sim_cpu cpu[MAX_NR_PROCESSORS];
- #if (WITH_SMP)
- #define STATE_CPU(sd,n) (&(sd)->cpu[n])
- #else
- #define STATE_CPU(sd,n) (&(sd)->cpu[0])
- #endif
+ sim_cpu *cpu[MAX_NR_PROCESSORS];
... simulator specific members ...
sim_state_base base;
};
(e.g. for delay slot handling). */
#ifndef CIA_ADDR
#define CIA_ADDR(cia) (cia)
+typedef address_word sim_cia;
#endif
#ifndef INVALID_INSTRUCTION_ADDRESS
#define INVALID_INSTRUCTION_ADDRESS ((address_word)0 - 1)
#endif
+/* TODO: Probably should just delete SIM_CPU. */
+typedef struct _sim_cpu SIM_CPU;
typedef struct _sim_cpu sim_cpu;
#include "sim-module.h"
#endif
+/* We require all sims to dynamically allocate cpus. See comment up top about
+ struct sim_state. */
+#if (WITH_SMP)
+# define STATE_CPU(sd, n) ((sd)->cpu[n])
+#else
+# define STATE_CPU(sd, n) ((sd)->cpu[0])
+#endif
+
+
typedef struct {
/* Simulator's argv[0]. */
} sim_state_base;
/* Functions for allocating/freeing a sim_state. */
-SIM_DESC sim_state_alloc PARAMS ((SIM_OPEN_KIND kind, host_callback *callback));
-void sim_state_free PARAMS ((SIM_DESC));
+SIM_DESC sim_state_alloc (SIM_OPEN_KIND kind, host_callback *callback);
+void sim_state_free (SIM_DESC);
#endif /* SIM_BASE_H */