public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] sim: lm32: invert sim_cpu storage
@ 2022-12-21 5:09 Michael Frysinger
0 siblings, 0 replies; only message in thread
From: Michael Frysinger @ 2022-12-21 5:09 UTC (permalink / raw)
To: gdb-cvs
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=63c56923057bd8d6ef878df5bbd500717a8aed2d
commit 63c56923057bd8d6ef878df5bbd500717a8aed2d
Author: Mike Frysinger <vapier@gentoo.org>
Date: Tue Nov 1 18:49:48 2022 +0545
sim: lm32: invert sim_cpu storage
The cpu.h change is in generated cgen code, but that has been sent
upstream too, so the next regen should include it automatically.
Diff:
---
sim/lm32/cpu.h | 2 +-
sim/lm32/sim-if.c | 3 ++-
sim/lm32/sim-main.h | 14 ++++----------
3 files changed, 7 insertions(+), 12 deletions(-)
diff --git a/sim/lm32/cpu.h b/sim/lm32/cpu.h
index d025065f2ba..f179cfce30e 100644
--- a/sim/lm32/cpu.h
+++ b/sim/lm32/cpu.h
@@ -54,7 +54,7 @@ typedef struct {
#define GET_H_CSR(a1) CPU (h_csr)[a1]
#define SET_H_CSR(a1, x) (CPU (h_csr)[a1] = (x))
} hardware;
-#define CPU_CGEN_HW(cpu) (& (cpu)->cpu_data.hardware)
+#define CPU_CGEN_HW(cpu) (& LM32_SIM_CPU (cpu)->cpu_data.hardware)
} LM32BF_CPU_DATA;
/* Cover fns for register access. */
diff --git a/sim/lm32/sim-if.c b/sim/lm32/sim-if.c
index f6ff7129e2c..a2a33620bdb 100644
--- a/sim/lm32/sim-if.c
+++ b/sim/lm32/sim-if.c
@@ -101,7 +101,8 @@ sim_open (SIM_OPEN_KIND kind, host_callback *callback, struct bfd *abfd,
current_target_byte_order = BFD_ENDIAN_BIG;
/* The cpu data is kept in a separately allocated chunk of memory. */
- if (sim_cpu_alloc_all (sd, 1) != SIM_RC_OK)
+ if (sim_cpu_alloc_all_extra (sd, 1, sizeof (struct lm32_sim_cpu))
+ != SIM_RC_OK)
{
free_state (sd);
return 0;
diff --git a/sim/lm32/sim-main.h b/sim/lm32/sim-main.h
index 14da34c5519..17c817cb1f6 100644
--- a/sim/lm32/sim-main.h
+++ b/sim/lm32/sim-main.h
@@ -23,6 +23,8 @@
#ifndef SIM_MAIN_H
#define SIM_MAIN_H
+#define SIM_HAVE_COMMON_SIM_CPU
+
#define WITH_SCACHE_PBB 1
#include "symcat.h"
@@ -36,16 +38,8 @@
#include "lm32-sim.h"
#include "opcode/cgen.h"
\f
-/* The _sim_cpu struct. */
-
-struct _sim_cpu
+struct lm32_sim_cpu
{
- /* sim/common cpu base. */
- sim_cpu_base base;
-
- /* Static parts of cgen. */
- CGEN_CPU cgen_cpu;
-
/* CPU specific parts go here.
Note that in files that don't need to access these pieces WANT_CPU_FOO
won't be defined and thus these parts won't appear. This is ok in the
@@ -56,8 +50,8 @@ struct _sim_cpu
#if defined (WANT_CPU_LM32BF)
LM32BF_CPU_DATA cpu_data;
#endif
-
};
+#define LM32_SIM_CPU(cpu) ((struct lm32_sim_cpu *) CPU_ARCH_DATA (cpu))
\f
/* Misc. */
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-12-21 5:09 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-21 5:09 [binutils-gdb] sim: lm32: invert sim_cpu storage Michael Frysinger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).