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

commit 6adb1071134b5ca69d512dcfaf564774096d32dd
Author: Mike Frysinger <vapier@gentoo.org>
Date:   Fri Aug 12 23:43:27 2016 +0800

    sim: bfin: invert sim_cpu storage

Diff:
---
 sim/bfin/interp.c   |  5 ++---
 sim/bfin/sim-main.h | 10 +++-------
 2 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/sim/bfin/interp.c b/sim/bfin/interp.c
index f63690cfac4..f4071ce4739 100644
--- a/sim/bfin/interp.c
+++ b/sim/bfin/interp.c
@@ -643,8 +643,6 @@ free_state (SIM_DESC sd)
 static void
 bfin_initialize_cpu (SIM_DESC sd, SIM_CPU *cpu)
 {
-  memset (&cpu->state, 0, sizeof (cpu->state));
-
   PROFILE_TOTAL_INSN_COUNT (CPU_PROFILE_DATA (cpu)) = 0;
 
   bfin_model_cpu_init (sd, cpu);
@@ -674,7 +672,8 @@ sim_open (SIM_OPEN_KIND kind, host_callback *callback,
   current_target_byte_order = BFD_ENDIAN_LITTLE;
 
   /* 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 bfin_cpu_state))
+      != SIM_RC_OK)
     {
       free_state (sd);
       return 0;
diff --git a/sim/bfin/sim-main.h b/sim/bfin/sim-main.h
index 42dfd5408ee..48e54c8c8e1 100644
--- a/sim/bfin/sim-main.h
+++ b/sim/bfin/sim-main.h
@@ -21,6 +21,8 @@
 #ifndef _BFIN_MAIN_SIM_H_
 #define _BFIN_MAIN_SIM_H_
 
+#define SIM_HAVE_COMMON_SIM_CPU
+
 #include "sim-basics.h"
 #include "arch.h"
 #include "sim-base.h"
@@ -29,13 +31,7 @@
 
 #include "machs.h"
 
-struct _sim_cpu {
-  /* ... simulator specific members ... */
-  struct bfin_cpu_state state;
-  sim_cpu_base base;
-};
-#define BFIN_CPU_STATE ((cpu)->state)
-
+#define BFIN_CPU_STATE (*(struct bfin_cpu_state *) CPU_ARCH_DATA (cpu))
 #define STATE_BOARD_DATA(sd) ((struct bfin_board_data *) STATE_ARCH_DATA (sd))
 
 #include "sim-config.h"

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