public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] sim: microblaze: 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=9dfc46c3d955622a0c37361034313139ba7f0200

commit 9dfc46c3d955622a0c37361034313139ba7f0200
Author: Mike Frysinger <vapier@gentoo.org>
Date:   Sat Aug 13 10:10:49 2016 +0800

    sim: microblaze: invert sim_cpu storage

Diff:
---
 sim/microblaze/interp.c     | 7 ++++---
 sim/microblaze/microblaze.h | 2 +-
 sim/microblaze/sim-main.h   | 7 +++----
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/sim/microblaze/interp.c b/sim/microblaze/interp.c
index ad0812ea41d..3d7fde0af3e 100644
--- a/sim/microblaze/interp.c
+++ b/sim/microblaze/interp.c
@@ -382,13 +382,13 @@ sim_info (SIM_DESC sd, int verbose)
 static sim_cia
 microblaze_pc_get (sim_cpu *cpu)
 {
-  return cpu->microblaze_cpu.spregs[0];
+  return MICROBLAZE_SIM_CPU (cpu)->spregs[0];
 }
 
 static void
 microblaze_pc_set (sim_cpu *cpu, sim_cia pc)
 {
-  cpu->microblaze_cpu.spregs[0] = pc;
+  MICROBLAZE_SIM_CPU (cpu)->spregs[0] = pc;
 }
 
 static void
@@ -409,7 +409,8 @@ sim_open (SIM_OPEN_KIND kind, host_callback *cb,
   SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
 
   /* 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 microblaze_regset))
+      != SIM_RC_OK)
     {
       free_state (sd);
       return 0;
diff --git a/sim/microblaze/microblaze.h b/sim/microblaze/microblaze.h
index e871b91af09..6b1d25bede9 100644
--- a/sim/microblaze/microblaze.h
+++ b/sim/microblaze/microblaze.h
@@ -24,7 +24,7 @@
 #define GET_RA	((inst & RA_MASK) >> RA_LOW)
 #define GET_RB	((inst & RB_MASK) >> RB_LOW)
 
-#define CPU     cpu->microblaze_cpu
+#define CPU     (*MICROBLAZE_SIM_CPU (cpu))
 
 #define RD      CPU.regs[rd]
 #define RA      CPU.regs[ra]
diff --git a/sim/microblaze/sim-main.h b/sim/microblaze/sim-main.h
index 650ba20e85b..df85a6f1e23 100644
--- a/sim/microblaze/sim-main.h
+++ b/sim/microblaze/sim-main.h
@@ -18,6 +18,8 @@
 #ifndef MICROBLAZE_SIM_MAIN
 #define MICROBLAZE_SIM_MAIN
 
+#define SIM_HAVE_COMMON_SIM_CPU
+
 #include "microblaze.h"
 #include "sim-basics.h"
 #include "sim-base.h"
@@ -43,9 +45,6 @@
   signed_2	imm_high;
 };
 
-struct _sim_cpu {
-  struct microblaze_regset microblaze_cpu;
-  sim_cpu_base base;
-};
+#define MICROBLAZE_SIM_CPU(cpu) ((struct microblaze_regset *) CPU_ARCH_DATA (cpu))
 
 #endif /* MICROBLAZE_SIM_MAIN */

^ 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: microblaze: 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).