public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] sim: moxie: invert sim_cpu storage
@ 2022-12-21  5:07 Michael Frysinger
  0 siblings, 0 replies; only message in thread
From: Michael Frysinger @ 2022-12-21  5:07 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=778ef9bcbb268228bf6ad0171cf9f539979208c8

commit 778ef9bcbb268228bf6ad0171cf9f539979208c8
Author: Mike Frysinger <vapier@gentoo.org>
Date:   Sat Aug 13 00:37:34 2016 +0800

    sim: moxie: invert sim_cpu storage

Diff:
---
 sim/moxie/interp.c   |  9 +++++----
 sim/moxie/sim-main.h | 18 ++++++++----------
 2 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/sim/moxie/interp.c b/sim/moxie/interp.c
index fec79aa2862..ea0a559a057 100644
--- a/sim/moxie/interp.c
+++ b/sim/moxie/interp.c
@@ -127,7 +127,7 @@ struct moxie_regset
 #define CC_GTU 1<<3
 #define CC_LTU 1<<4
 
-/* TODO: This should be moved to sim-main.h:_sim_cpu.  */
+/* TODO: This should be moved to sim-main.h:moxie_sim_cpu.  */
 union
 {
   struct moxie_regset asregs;
@@ -1173,13 +1173,13 @@ moxie_reg_fetch (SIM_CPU *scpu, int rn, void *memory, int length)
 static sim_cia
 moxie_pc_get (sim_cpu *cpu)
 {
-  return cpu->registers[PCIDX];
+  return MOXIE_SIM_CPU (cpu)->registers[PCIDX];
 }
 
 static void
 moxie_pc_set (sim_cpu *cpu, sim_cia pc)
 {
-  cpu->registers[PCIDX] = pc;
+  MOXIE_SIM_CPU (cpu)->registers[PCIDX] = pc;
 }
 
 static void
@@ -1203,7 +1203,8 @@ sim_open (SIM_OPEN_KIND kind, host_callback *cb,
   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 moxie_sim_cpu))
+      != SIM_RC_OK)
     {
       free_state (sd);
       return 0;
diff --git a/sim/moxie/sim-main.h b/sim/moxie/sim-main.h
index 9e4b1d4f8bc..7db12e01498 100644
--- a/sim/moxie/sim-main.h
+++ b/sim/moxie/sim-main.h
@@ -20,23 +20,21 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 #ifndef SIM_MAIN_H
 #define SIM_MAIN_H
 
+#define SIM_HAVE_COMMON_SIM_CPU
+
 #include "sim-basics.h"
 #include "sim-base.h"
 #include "bfd.h"
 
 #define PCIDX 17
 
-struct _sim_cpu {
-
-  /* The following are internal simulator state variables: */
-
-/* To keep this default simulator simple, and fast, we use a direct
-   vector of registers. The internal simulator engine then uses
-   manifests to access the correct slot. */
-
+struct moxie_sim_cpu {
+  /* To keep this default simulator simple, and fast, we use a direct
+     vector of registers. The internal simulator engine then uses
+     manifests to access the correct slot. */
   unsigned_word registers[19];
-
-  sim_cpu_base base;
 };
 
+#define MOXIE_SIM_CPU(cpu) ((struct moxie_sim_cpu *) CPU_ARCH_DATA (cpu))
+
 #endif

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-12-21  5:07 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:07 [binutils-gdb] sim: moxie: 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).