+2021-05-17 Mike Frysinger <vapier@gentoo.org>
+
+ * sim-main.h (SIM_HAVE_COMMON_SIM_STATE): Define.
+ (struct sim_state): Delete.
+
2021-05-16 Mike Frysinger <vapier@gentoo.org>
* cpustate.c: Include defs.h.
#ifndef _SIM_MAIN_H
#define _SIM_MAIN_H
+#define SIM_HAVE_COMMON_SIM_STATE
+
#include "sim-basics.h"
#include "sim-types.h"
#include "sim-base.h"
AARCH64_MAX_REGNO = 67
} aarch64_regno;
-/* The simulator state structure used to hold all global variables. */
-struct sim_state
-{
- sim_cpu * cpu[MAX_NR_PROCESSORS];
- sim_state_base base;
-};
-
#endif /* _SIM_MAIN_H */
+2021-05-17 Mike Frysinger <vapier@gentoo.org>
+
+ * sim-main.h (SIM_HAVE_COMMON_SIM_STATE): Define.
+ (struct sim_state): Delete.
+
2021-05-16 Mike Frysinger <vapier@gentoo.org>
* armcopro.c, armemu.c, arminit.c, armsupp.c, armvirt.c, iwmmxt.c,
#ifndef SIM_MAIN_H
#define SIM_MAIN_H
+#define SIM_HAVE_COMMON_SIM_STATE
+
#include "sim-basics.h"
#include "sim-base.h"
#include "bfd.h"
sim_cpu_base base;
};
-struct sim_state {
-
- sim_cpu *cpu[MAX_NR_PROCESSORS];
-
- sim_state_base base;
-};
-
#endif
+2021-05-17 Mike Frysinger <vapier@gentoo.org>
+
+ * sim-base.h (struct sim_state): Update comment.
+ (struct sim_state): Define.
+ (STATE_ARCH_DATA): Likewise.
+ (sim_state_alloc): New define.
+ (sim_state_alloc_extra): Renamed & add 3rd arg.
+ * sim-utils.c (sim_state_alloc): Likewise.
+ (sim_state_alloc_extra): Set arch data.
+
2021-05-16 Mike Frysinger <vapier@gentoo.org>
* callback.c: Replace config.h include with defs.h.
sim_cpu_base base;
};
- struct sim_state {
- sim_cpu *cpu[MAX_NR_PROCESSORS];
- ... simulator specific members ...
- sim_state_base base;
- };
-
- Note that `base' appears last. This makes `base.magic' appear last
- in the entire struct and helps catch miscompilation errors. */
+ If your sim needs to allocate sim-wide state, use STATE_ARCH_DATA. */
#ifndef SIM_BASE_H
#define STATE_MAGIC(sd) ((sd)->base.magic)
} sim_state_base;
+#ifdef SIM_HAVE_COMMON_SIM_STATE
+/* TODO: Merge sim_state & sim_state_base. */
+struct sim_state {
+ /* All the cpus for this instance. */
+ sim_cpu *cpu[MAX_NR_PROCESSORS];
+
+ /* All the common state. */
+ sim_state_base base;
+
+ /* Pointer for sim target to store arbitrary state data. Normally the
+ target should define a struct and use it here. */
+ void *arch_data;
+#define STATE_ARCH_DATA(sd) ((sd)->arch_data)
+};
+#endif
+
/* Functions for allocating/freeing a sim_state. */
-SIM_DESC sim_state_alloc (SIM_OPEN_KIND kind, host_callback *callback);
+SIM_DESC sim_state_alloc_extra (SIM_OPEN_KIND kind, host_callback *callback,
+ size_t extra_bytes);
+#define sim_state_alloc(kind, callback) sim_state_alloc_extra(kind, callback, 0)
+
void sim_state_free (SIM_DESC);
#ifdef __cplusplus
/* Allocate a sim_state struct. */
SIM_DESC
-sim_state_alloc (SIM_OPEN_KIND kind,
- host_callback *callback)
+sim_state_alloc_extra (SIM_OPEN_KIND kind, host_callback *callback,
+ size_t extra_bytes)
{
SIM_DESC sd = ZALLOC (struct sim_state);
STATE_CALLBACK (sd) = callback;
STATE_OPEN_KIND (sd) = kind;
+#ifdef SIM_HAVE_COMMON_SIM_STATE
+ if (extra_bytes)
+ STATE_ARCH_DATA (sd) = zalloc (extra_bytes);
+#endif
+
#if 0
{
int cpu_nr;
+2021-05-17 Mike Frysinger <vapier@gentoo.org>
+
+ * sim-main.h (SIM_HAVE_COMMON_SIM_STATE): Define.
+ (struct sim_state): Delete.
+
2021-05-16 Mike Frysinger <vapier@gentoo.org>
* cr16_sim.h: Delete config.h include.
#ifndef SIM_MAIN_H
#define SIM_MAIN_H
+#define SIM_HAVE_COMMON_SIM_STATE
+
#include "sim-basics.h"
typedef long int word;
sim_cpu_base base;
};
-struct sim_state {
-
- sim_cpu *cpu[MAX_NR_PROCESSORS];
-
- sim_state_base base;
-};
-
#endif
+2021-05-17 Mike Frysinger <vapier@gentoo.org>
+
+ * sim-main.h (SIM_HAVE_COMMON_SIM_STATE): Define.
+ (struct sim_state): Delete.
+
2021-05-16 Mike Frysinger <vapier@gentoo.org>
* d10v_sim.h, gencode.c: Delete config.h include.
#ifndef SIM_MAIN_H
#define SIM_MAIN_H
+#define SIM_HAVE_COMMON_SIM_STATE
+
#include "sim-basics.h"
typedef long int word;
sim_cpu_base base;
};
-struct sim_state {
-
- sim_cpu *cpu[MAX_NR_PROCESSORS];
-
- sim_state_base base;
-};
-
#endif
+2021-05-17 Mike Frysinger <vapier@gentoo.org>
+
+ * sim-main.h (SIM_HAVE_COMMON_SIM_STATE): Define.
+ (struct sim_state): Delete.
+
2021-05-16 Mike Frysinger <vapier@gentoo.org>
* interp.c, sim-main.c: Replace config.h include with defs.h.
#ifndef SIM_MAIN_H
#define SIM_MAIN_H
+#define SIM_HAVE_COMMON_SIM_STATE
+
#include "sim-basics.h"
#include "sim-base.h"
sim_cpu_base base;
};
-struct sim_state {
- sim_cpu *cpu[MAX_NR_PROCESSORS];
-
- /* ... simulator specific members ... */
- sim_state_base base;
-};
-
extern void step_once (SIM_CPU *);
extern void initialize_cpu (SIM_DESC, SIM_CPU *);
+2021-05-17 Mike Frysinger <vapier@gentoo.org>
+
+ * sim-main.h (SIM_HAVE_COMMON_SIM_STATE): Define.
+ (struct sim_state): Delete.
+
2021-05-16 Mike Frysinger <vapier@gentoo.org>
* interp.c: Replace config.h include with defs.h.
#ifndef SIM_MAIN_H
#define SIM_MAIN_H
+#define SIM_HAVE_COMMON_SIM_STATE
+
#include "sim-basics.h"
#include "sim-base.h"
#include "bfd.h"
sim_cpu_base base;
};
-struct sim_state {
-
- sim_cpu *cpu[MAX_NR_PROCESSORS];
-
- sim_state_base base;
-};
-
#endif
+2021-05-17 Mike Frysinger <vapier@gentoo.org>
+
+ * sim-main.h (SIM_HAVE_COMMON_SIM_STATE): Define.
+ (struct sim_state): Delete.
+
2021-05-16 Mike Frysinger <vapier@gentoo.org>
* dv-m68hc11.c, dv-m68hc11eepr.c, dv-m68hc11sio.c, dv-m68hc11spi.c,
#ifndef _SIM_MAIN_H
#define _SIM_MAIN_H
+#define SIM_HAVE_COMMON_SIM_STATE
+
#include "sim-basics.h"
#include "sim-signal.h"
#include "sim-base.h"
extern void m68hc11cpu_set_port (struct hw *me, sim_cpu *cpu,
unsigned addr, uint8 val);
-/* The current state of the processor; registers, memory, etc. */
-
-struct sim_state {
- sim_cpu *cpu[MAX_NR_PROCESSORS];
- sim_state_base base;
-};
-
extern void sim_board_reset (SIM_DESC sd);
#define PRINT_TIME 0x01
+2021-05-17 Mike Frysinger <vapier@gentoo.org>
+
+ * sim-main.h (SIM_HAVE_COMMON_SIM_STATE): Define.
+ (struct sim_state): Delete.
+
2021-05-16 Mike Frysinger <vapier@gentoo.org>
* interp.c: Replace config.h include with defs.h.
#ifndef SIM_MAIN_H
#define SIM_MAIN_H
+#define SIM_HAVE_COMMON_SIM_STATE
+
#include "sim-basics.h"
typedef long int word;
sim_cpu_base base;
};
-struct sim_state {
-
- sim_cpu *cpu[MAX_NR_PROCESSORS];
-
- sim_state_base base;
-};
-
#endif
+2021-05-17 Mike Frysinger <vapier@gentoo.org>
+
+ * sim-main.h (SIM_HAVE_COMMON_SIM_STATE): Define.
+ (struct sim_state): Delete.
+
2021-05-16 Mike Frysinger <vapier@gentoo.org>
* interp.c: Replace config.h include with defs.h.
#ifndef MICROBLAZE_SIM_MAIN
#define MICROBLAZE_SIM_MAIN
+#define SIM_HAVE_COMMON_SIM_STATE
+
#include "microblaze.h"
#include "sim-basics.h"
#include "sim-base.h"
sim_cpu_base base;
};
-struct sim_state {
-
- sim_cpu *cpu[MAX_NR_PROCESSORS];
-
- sim_state_base base;
-};
-
#endif /* MICROBLAZE_SIM_MAIN */
+2021-05-17 Mike Frysinger <vapier@gentoo.org>
+
+ * sim-main.h (SIM_HAVE_COMMON_SIM_STATE): Define.
+ (struct sim_state): Delete.
+
2021-05-16 Mike Frysinger <vapier@gentoo.org>
* dv-mn103cpu.c, dv-mn103int.c, dv-mn103iop.c, dv-mn103ser.c,
#ifndef SIM_MAIN_H
#define SIM_MAIN_H
+#define SIM_HAVE_COMMON_SIM_STATE
+
#define SIM_ENGINE_HALT_HOOK(SD,LAST_CPU,CIA) 0 /* disable this hook */
#include "sim-basics.h"
sim_cpu_base base;
};
-
-struct sim_state {
-
- /* the processors proper */
- sim_cpu *cpu[MAX_NR_PROCESSORS];
-
- /* The base class. */
- sim_state_base base;
-
-};
-
/* For compatibility, until all functions converted to passing
SIM_DESC as an argument */
extern SIM_DESC simulator;
+2021-05-17 Mike Frysinger <vapier@gentoo.org>
+
+ * sim-main.h (SIM_HAVE_COMMON_SIM_STATE): Define.
+ (struct sim_state): Delete.
+
2021-05-16 Mike Frysinger <vapier@gentoo.org>
* interp.c: Replace config.h include with defs.h.
#ifndef SIM_MAIN_H
#define SIM_MAIN_H
+#define SIM_HAVE_COMMON_SIM_STATE
+
#include "sim-basics.h"
#include "sim-base.h"
#include "bfd.h"
sim_cpu_base base;
};
-struct sim_state {
-
- sim_cpu *cpu[MAX_NR_PROCESSORS];
-
- sim_state_base base;
-};
-
#endif
+2021-05-17 Mike Frysinger <vapier@gentoo.org>
+
+ * sim-main.h (SIM_HAVE_COMMON_SIM_STATE): Define.
+ (struct sim_state): Delete.
+
2021-05-16 Mike Frysinger <vapier@gentoo.org>
* msp430-sim.c: Replace config.h include with defs.h.
#ifndef _MSP430_MAIN_SIM_H_
#define _MSP430_MAIN_SIM_H_
+#define SIM_HAVE_COMMON_SIM_STATE
+
#include "sim-basics.h"
#include "sim-signal.h"
#include "msp430-sim.h"
sim_cpu_base base;
};
-struct sim_state
-{
- sim_cpu *cpu[MAX_NR_PROCESSORS];
-
- /* Simulator specific members. */
- sim_state_base base;
-};
-
#define MSP430_CPU(sd) (STATE_CPU ((sd), 0))
#define MSP430_CPU_STATE(sd) (MSP430_CPU ((sd)->state))
+2021-05-17 Mike Frysinger <vapier@gentoo.org>
+
+ * sim-main.h (SIM_HAVE_COMMON_SIM_STATE): Define.
+ (struct sim_state): Delete.
+
2021-05-16 Mike Frysinger <vapier@gentoo.org>
* interp.c: Replace config.h include with defs.h.
#ifndef PRU_SIM_MAIN
#define PRU_SIM_MAIN
+#define SIM_HAVE_COMMON_SIM_STATE
+
#include <stdint.h>
#include <stddef.h>
#include "pru.h"
sim_cpu_base base;
};
-struct sim_state {
- sim_cpu *cpu[MAX_NR_PROCESSORS];
-
- sim_state_base base;
-};
#endif /* PRU_SIM_MAIN */
+2021-05-17 Mike Frysinger <vapier@gentoo.org>
+
+ * sim-main.h (SIM_HAVE_COMMON_SIM_STATE): Define.
+ (struct sim_state): Delete.
+
2021-05-16 Mike Frysinger <vapier@gentoo.org>
* interp.c: Replace config.h include with defs.h.
#ifndef SIM_MAIN_H
#define SIM_MAIN_H
+#define SIM_HAVE_COMMON_SIM_STATE
+
#include "sim-basics.h"
#include "sim-base.h"
sim_cpu_base base;
};
-struct sim_state {
-
- sim_cpu *cpu[MAX_NR_PROCESSORS];
-
- sim_state_base base;
-};
-
#endif
+2021-05-17 Mike Frysinger <vapier@gentoo.org>
+
+ * sim-main.h (SIM_HAVE_COMMON_SIM_STATE): Define.
+ (struct sim_state): Delete.
+
2021-05-16 Mike Frysinger <vapier@gentoo.org>
* interp.c, simops.c: Include defs.h.
#ifndef SIM_MAIN_H
#define SIM_MAIN_H
+#define SIM_HAVE_COMMON_SIM_STATE
+
/* The v850 has 32bit words, numbered 31 (MSB) to 0 (LSB) */
#define WITH_TARGET_WORD_MSB 31
sim_cpu_base base;
};
-struct sim_state {
- sim_cpu *cpu[MAX_NR_PROCESSORS];
-#if 0
- SIM_ADDR rom_size;
- SIM_ADDR low_end;
- SIM_ADDR high_start;
- SIM_ADDR high_base;
- void *mem;
-#endif
- sim_state_base base;
-};
-
/* For compatibility, until all functions converted to passing
SIM_DESC as an argument */
extern SIM_DESC simulator;