sim: cris/frv/h8300/iq2000/lm32/m32r/sh64: standardize cpu state

This sets up the sim_state structure and the cpu member to match what we
do in most other sims, and what the common code suggests.  This is a step
to unifying on the sim-cpu.o object.
This commit is contained in:
Mike Frysinger 2015-04-15 01:22:34 -04:00
parent 0ce398f106
commit f95f4ed2c4
15 changed files with 88 additions and 15 deletions

View File

@ -1,3 +1,8 @@
2015-04-15 Mike Frysinger <vapier@gentoo.org>
* sim-main.h (struct sim_state): Change cpu to an array of pointers.
(STATE_CPU): Handle WITH_SMP.
2015-04-13 Mike Frysinger <vapier@gentoo.org>
* configure: Regenerate.

View File

@ -225,8 +225,12 @@ struct _sim_cpu {
/* The sim_state struct. */
struct sim_state {
sim_cpu *cpu;
#define STATE_CPU(sd, n) (/*&*/ (sd)->cpu)
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
CGEN_STATE cgen_state;

View File

@ -1,3 +1,8 @@
2015-04-15 Mike Frysinger <vapier@gentoo.org>
* sim-main.h (struct sim_state): Change cpu to an array of pointers.
(STATE_CPU): Handle WITH_SMP.
2015-04-13 Mike Frysinger <vapier@gentoo.org>
* configure: Regenerate.

View File

@ -118,8 +118,12 @@ struct _sim_cpu {
/* The sim_state struct. */
struct sim_state {
sim_cpu *cpu;
#define STATE_CPU(sd, n) (/*&*/ (sd)->cpu)
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
CGEN_STATE cgen_state;

View File

@ -1,3 +1,10 @@
2015-04-15 Mike Frysinger <vapier@gentoo.org>
* compile.c: Include sim-options.h.
(sim_open): Call sim_cpu_alloc_all instead of sim_cpu_alloc.
* sim-main.h (struct sim_state): Change cpu to an array of pointers.
(STATE_CPU): Handle WITH_SMP.
2015-04-13 Mike Frysinger <vapier@gentoo.org>
* configure: Regenerate.

View File

@ -34,6 +34,7 @@
#include "gdb/sim-h8300.h"
#include "sys/stat.h"
#include "sys/types.h"
#include "sim-options.h"
#ifndef SIGTRAP
# define SIGTRAP 5
@ -4886,7 +4887,14 @@ sim_open (SIM_OPEN_KIND kind,
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);

View File

@ -138,7 +138,7 @@ struct _sim_cpu {
/* The sim_state struct. */
struct sim_state {
struct _sim_cpu *cpu;
sim_cpu *cpu[MAX_NR_PROCESSORS];
unsigned int sim_cache_size;
decoded_inst *sim_cache;
unsigned short *cache_idx;
@ -155,7 +155,11 @@ struct sim_state {
#define CIA_GET(CPU) (cpu_get_pc (CPU))
#define CIA_SET(CPU, VAL) (cpu_set_pc ((CPU), (VAL)))
#define STATE_CPU(SD, N) ((SD)->cpu) /* Single Processor. */
#if (WITH_SMP)
#define STATE_CPU(sd,n) ((sd)->cpu[n])
#else
#define STATE_CPU(sd,n) ((sd)->cpu[0])
#endif
#define cpu_set_pc(CPU, VAL) (((CPU)->pc) = (VAL))
#define cpu_get_pc(CPU) (((CPU)->pc))

View File

@ -1,3 +1,8 @@
2015-04-15 Mike Frysinger <vapier@gentoo.org>
* sim-main.h (struct sim_state): Change cpu to an array of pointers.
(STATE_CPU): Handle WITH_SMP.
2015-04-13 Mike Frysinger <vapier@gentoo.org>
* configure: Regenerate.

View File

@ -57,8 +57,12 @@ struct _sim_cpu {
/* The sim_state struct. */
struct sim_state {
sim_cpu *cpu;
#define STATE_CPU(sd, n) (/*&*/ (sd)->cpu)
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
CGEN_STATE cgen_state;

View File

@ -1,3 +1,8 @@
2015-04-15 Mike Frysinger <vapier@gentoo.org>
* sim-main.h (struct sim_state): Change cpu to an array of pointers.
(STATE_CPU): Handle WITH_SMP.
2015-04-13 Mike Frysinger <vapier@gentoo.org>
* configure: Regenerate.

View File

@ -83,8 +83,12 @@ struct _sim_cpu
struct sim_state
{
sim_cpu *cpu;
#define STATE_CPU(sd, n) (/*&*/ (sd)->cpu)
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
CGEN_STATE cgen_state;

View File

@ -1,3 +1,8 @@
2015-04-15 Mike Frysinger <vapier@gentoo.org>
* sim-main.h (struct sim_state): Change cpu to an array of pointers.
(STATE_CPU): Handle WITH_SMP.
2015-04-13 Mike Frysinger <vapier@gentoo.org>
* configure: Regenerate.

View File

@ -68,8 +68,12 @@ struct _sim_cpu {
/* The sim_state struct. */
struct sim_state {
sim_cpu *cpu;
#define STATE_CPU(sd, n) (/*&*/ (sd)->cpu)
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
CGEN_STATE cgen_state;

View File

@ -1,3 +1,8 @@
2015-04-15 Mike Frysinger <vapier@gentoo.org>
* sim-main.h (struct sim_state): Change cpu to an array of pointers.
(STATE_CPU): Handle WITH_SMP.
2015-04-13 Mike Frysinger <vapier@gentoo.org>
* configure: Regenerate.

View File

@ -53,8 +53,12 @@ struct _sim_cpu {
/* The sim_state struct. */
struct sim_state {
sim_cpu *cpu;
#define STATE_CPU(sd, n) (/*&*/ (sd)->cpu)
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
CGEN_STATE cgen_state;