This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] sim: arm/cr16/d10v/h8300/microblaze/sh: fill out sim-cpu pc fetch/store helpers


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

commit 27b97b40bca216097d16d53fa9408a70cd281479
Author: Mike Frysinger <vapier@gentoo.org>
Date:   Fri Apr 17 02:16:10 2015 -0400

    sim: arm/cr16/d10v/h8300/microblaze/sh: fill out sim-cpu pc fetch/store helpers
    
    This makes the common sim-cpu logic work.

Diff:
---
 sim/arm/ChangeLog        |  6 ++++++
 sim/arm/wrapper.c        | 22 ++++++++++++++++++++++
 sim/cr16/ChangeLog       |  5 +++++
 sim/cr16/interp.c        | 21 +++++++++++++++++++++
 sim/d10v/ChangeLog       |  6 ++++++
 sim/d10v/interp.c        | 22 ++++++++++++++++++++++
 sim/h8300/ChangeLog      |  7 +++++++
 sim/h8300/compile.c      | 22 ++++++++++++++++++++++
 sim/h8300/sim-main.h     |  2 ++
 sim/microblaze/ChangeLog |  5 +++++
 sim/microblaze/interp.c  | 15 +++++++++++++++
 sim/sh/ChangeLog         |  5 +++++
 sim/sh/interp.c          | 21 +++++++++++++++++++++
 13 files changed, 159 insertions(+)

diff --git a/sim/arm/ChangeLog b/sim/arm/ChangeLog
index c98903d..01105f8 100644
--- a/sim/arm/ChangeLog
+++ b/sim/arm/ChangeLog
@@ -1,3 +1,9 @@
+2015-04-17  Mike Frysinger  <vapier@gentoo.org>
+
+	* wrapper.c (arm_pc_get, arm_pc_set): New functions.
+	(sim_open): Declare new local var i.  Call CPU_PC_FETCH &
+	CPU_PC_STORE for all cpus.
+
 2015-04-15  Mike Frysinger  <vapier@gentoo.org>
 
 	* Makefile.in (SIM_OBJS): Delete sim-cpu.o.
diff --git a/sim/arm/wrapper.c b/sim/arm/wrapper.c
index dd3cfe2..d69daa3 100644
--- a/sim/arm/wrapper.c
+++ b/sim/arm/wrapper.c
@@ -800,6 +800,18 @@ sim_target_parse_arg_array (char ** argv)
   sim_target_parse_command_line (i, argv);
 }
 
+static sim_cia
+arm_pc_get (sim_cpu *cpu)
+{
+  return PC;
+}
+
+static void
+arm_pc_set (sim_cpu *cpu, sim_cia pc)
+{
+  ARMul_SetPC (state, pc);
+}
+
 static void
 free_state (SIM_DESC sd)
 {
@@ -815,6 +827,7 @@ sim_open (SIM_OPEN_KIND kind,
 	  struct bfd *abfd,
 	  char **argv)
 {
+  int i;
   SIM_DESC sd = sim_state_alloc (kind, cb);
   SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
 
@@ -866,6 +879,15 @@ sim_open (SIM_OPEN_KIND kind,
       return 0;
     }
 
+  /* CPU specific initialization.  */
+  for (i = 0; i < MAX_NR_PROCESSORS; ++i)
+    {
+      SIM_CPU *cpu = STATE_CPU (sd, i);
+
+      CPU_PC_FETCH (cpu) = arm_pc_get;
+      CPU_PC_STORE (cpu) = arm_pc_set;
+    }
+
   sim_callback = cb;
 
   sim_target_parse_arg_array (argv);
diff --git a/sim/cr16/ChangeLog b/sim/cr16/ChangeLog
index 4aa6429..1a6cd14 100644
--- a/sim/cr16/ChangeLog
+++ b/sim/cr16/ChangeLog
@@ -1,3 +1,8 @@
+2015-04-17  Mike Frysinger  <vapier@gentoo.org>
+
+	* interp.c (cr16_pc_get, cr16_pc_set): New functions.
+	(sim_open): Call CPU_PC_FETCH & CPU_PC_STORE for all cpus.
+
 2015-04-15  Mike Frysinger  <vapier@gentoo.org>
 
 	* Makefile.in (SIM_OBJS): Delete sim-cpu.o.
diff --git a/sim/cr16/interp.c b/sim/cr16/interp.c
index 86fd280..6e31e1a 100644
--- a/sim/cr16/interp.c
+++ b/sim/cr16/interp.c
@@ -737,6 +737,18 @@ sim_read (SIM_DESC sd, SIM_ADDR addr, unsigned char *buffer, int size)
   return xfer_mem (sd, addr, buffer, size, 0);
 }
 
+static sim_cia
+cr16_pc_get (sim_cpu *cpu)
+{
+  return PC;
+}
+
+static void
+cr16_pc_set (sim_cpu *cpu, sim_cia pc)
+{
+  SET_PC (pc);
+}
+
 static void
 free_state (SIM_DESC sd)
 {
@@ -807,6 +819,15 @@ sim_open (SIM_OPEN_KIND kind, struct host_callback_struct *cb, struct bfd *abfd,
       return 0;
     }
 
+  /* CPU specific initialization.  */
+  for (i = 0; i < MAX_NR_PROCESSORS; ++i)
+    {
+      SIM_CPU *cpu = STATE_CPU (sd, i);
+
+      CPU_PC_FETCH (cpu) = cr16_pc_get;
+      CPU_PC_STORE (cpu) = cr16_pc_set;
+    }
+
   trace_sd = sd;
   cr16_callback = cb;
 
diff --git a/sim/d10v/ChangeLog b/sim/d10v/ChangeLog
index 4ce1df8..0cf06d7 100644
--- a/sim/d10v/ChangeLog
+++ b/sim/d10v/ChangeLog
@@ -1,3 +1,9 @@
+2015-04-17  Mike Frysinger  <vapier@gentoo.org>
+
+	* interp.c (d10v_pc_get, d10v_pc_set): New functions.
+	(sim_open): Declare new local var i.  Call CPU_PC_FETCH &
+	CPU_PC_STORE for all cpus.
+
 2015-04-15  Mike Frysinger  <vapier@gentoo.org>
 
 	* Makefile.in (SIM_OBJS): Delete sim-cpu.o.
diff --git a/sim/d10v/interp.c b/sim/d10v/interp.c
index 7fc0745..b975561 100644
--- a/sim/d10v/interp.c
+++ b/sim/d10v/interp.c
@@ -722,6 +722,18 @@ sim_read (SIM_DESC sd, SIM_ADDR addr, unsigned char *buffer, int size)
   return xfer_mem( addr, buffer, size, 0);
 }
 
+static sim_cia
+d10v_pc_get (sim_cpu *cpu)
+{
+  return PC;
+}
+
+static void
+d10v_pc_set (sim_cpu *cpu, sim_cia pc)
+{
+  SET_PC (pc);
+}
+
 static void
 free_state (SIM_DESC sd)
 {
@@ -740,6 +752,7 @@ sim_open (SIM_OPEN_KIND kind, host_callback *cb, struct bfd *abfd, char **argv)
   struct hash_entry *h;
   static int init_p = 0;
   char **p;
+  int i;
   SIM_DESC sd = sim_state_alloc (kind, cb);
   SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
 
@@ -791,6 +804,15 @@ sim_open (SIM_OPEN_KIND kind, host_callback *cb, struct bfd *abfd, char **argv)
       return 0;
     }
 
+  /* CPU specific initialization.  */
+  for (i = 0; i < MAX_NR_PROCESSORS; ++i)
+    {
+      SIM_CPU *cpu = STATE_CPU (sd, i);
+
+      CPU_PC_FETCH (cpu) = d10v_pc_get;
+      CPU_PC_STORE (cpu) = d10v_pc_set;
+    }
+
   trace_sd = sd;
   d10v_callback = cb;
   old_segment_mapping = 0;
diff --git a/sim/h8300/ChangeLog b/sim/h8300/ChangeLog
index eaf3088..f414847 100644
--- a/sim/h8300/ChangeLog
+++ b/sim/h8300/ChangeLog
@@ -1,3 +1,10 @@
+2015-04-17  Mike Frysinger  <vapier@gentoo.org>
+
+	* compile.c (h8300_pc_get, h8300_pc_set): New functions.
+	(sim_open): Declare new local var i.  Call CPU_PC_FETCH &
+	CPU_PC_STORE for all cpus.
+	* sim-main.h (SIM_CPU): Define.
+
 2015-04-15  Mike Frysinger  <vapier@gentoo.org>
 
 	* Makefile.in (SIM_OBJS): Delete sim-cpu.o.
diff --git a/sim/h8300/compile.c b/sim/h8300/compile.c
index e14c3ab..d084b5d 100644
--- a/sim/h8300/compile.c
+++ b/sim/h8300/compile.c
@@ -4865,6 +4865,18 @@ set_h8300h (unsigned long machine)
     h8300_normal_mode = 1;
 }
 
+static sim_cia
+h8300_pc_get (sim_cpu *cpu)
+{
+  return cpu->pc;
+}
+
+static void
+h8300_pc_set (sim_cpu *cpu, sim_cia pc)
+{
+  cpu->pc = pc;
+}
+
 /* Cover function of sim_state_free to free the cpu buffers as well.  */
 
 static void
@@ -4883,6 +4895,7 @@ sim_open (SIM_OPEN_KIND kind,
 	  struct bfd *abfd, 
 	  char **argv)
 {
+  int i;
   SIM_DESC sd;
   sim_cpu *cpu;
 
@@ -4947,6 +4960,15 @@ sim_open (SIM_OPEN_KIND kind,
       return 0;
     }
 
+  /* CPU specific initialization.  */
+  for (i = 0; i < MAX_NR_PROCESSORS; ++i)
+    {
+      SIM_CPU *cpu = STATE_CPU (sd, i);
+
+      CPU_PC_FETCH (cpu) = h8300_pc_get;
+      CPU_PC_STORE (cpu) = h8300_pc_set;
+    }
+
   /*  sim_hw_configure (sd); */
 
   /* FIXME: Much of the code in sim_load can be moved here.  */
diff --git a/sim/h8300/sim-main.h b/sim/h8300/sim-main.h
index 8b07505..e428d80 100644
--- a/sim/h8300/sim-main.h
+++ b/sim/h8300/sim-main.h
@@ -91,6 +91,8 @@ enum h8_typecodes {
 /* Define sim_cia.  */
 typedef unsigned32 sim_cia;
 
+typedef struct _sim_cpu SIM_CPU;
+
 #include "sim-base.h"
 
 /* Structure used to describe addressing */
diff --git a/sim/microblaze/ChangeLog b/sim/microblaze/ChangeLog
index 9fd188c..4223301 100644
--- a/sim/microblaze/ChangeLog
+++ b/sim/microblaze/ChangeLog
@@ -1,3 +1,8 @@
+2015-04-17  Mike Frysinger  <vapier@gentoo.org>
+
+	* interp.c (microblaze_pc_get, microblaze_pc_set): New functions.
+	(sim_open): Call CPU_PC_FETCH & CPU_PC_STORE for all cpus.
+
 2015-04-15  Mike Frysinger  <vapier@gentoo.org>
 
 	* Makefile.in (SIM_OBJS): Delete sim-cpu.o.
diff --git a/sim/microblaze/interp.c b/sim/microblaze/interp.c
index 9e95e1e..aa8634e 100644
--- a/sim/microblaze/interp.c
+++ b/sim/microblaze/interp.c
@@ -633,6 +633,18 @@ sim_info (SIM_DESC sd, int verbose)
 			     (CPU.cycles) ? CPU.cycles+2 : 0);
 }
 
+static sim_cia
+microblaze_pc_get (sim_cpu *cpu)
+{
+  return cpu->microblaze_cpu.spregs[0];
+}
+
+static void
+microblaze_pc_set (sim_cpu *cpu, sim_cia pc)
+{
+  cpu->microblaze_cpu.spregs[0] = pc;
+}
+
 static void
 free_state (SIM_DESC sd)
 {
@@ -706,6 +718,9 @@ sim_open (SIM_OPEN_KIND kind, host_callback *cb, struct bfd *abfd, char **argv)
       SIM_CPU *cpu = STATE_CPU (sd, i);
       int osize = sim_memory_size;
 
+      CPU_PC_FETCH (cpu) = microblaze_pc_get;
+      CPU_PC_STORE (cpu) = microblaze_pc_set;
+
       set_initial_gprs (cpu);
 
       /* Discard and reacquire memory -- start with a clean slate.  */
diff --git a/sim/sh/ChangeLog b/sim/sh/ChangeLog
index 9b5c69e..fc359ed 100644
--- a/sim/sh/ChangeLog
+++ b/sim/sh/ChangeLog
@@ -1,3 +1,8 @@
+2015-04-17  Mike Frysinger  <vapier@gentoo.org>
+
+	* interp.c (sh_pc_get, sh_pc_set): New functions.
+	(sim_open): Call CPU_PC_FETCH & CPU_PC_STORE for all cpus.
+
 2015-04-15  Mike Frysinger  <vapier@gentoo.org>
 
 	* Makefile.in (SIM_OBJS): Delete sim-cpu.o.
diff --git a/sim/sh/interp.c b/sim/sh/interp.c
index 13f6e65..2f02e69 100644
--- a/sim/sh/interp.c
+++ b/sim/sh/interp.c
@@ -2373,6 +2373,18 @@ sim_info (SIM_DESC sd, int verbose)
     }
 }
 
+static sim_cia
+sh_pc_get (sim_cpu *cpu)
+{
+  return saved_state.asregs.pc;
+}
+
+static void
+sh_pc_set (sim_cpu *cpu, sim_cia pc)
+{
+  saved_state.asregs.pc = pc;
+}
+
 static void
 free_state (SIM_DESC sd)
 {
@@ -2448,6 +2460,15 @@ sim_open (SIM_OPEN_KIND kind, host_callback *cb, struct bfd *abfd, char **argv)
       return 0;
     }
 
+  /* CPU specific initialization.  */
+  for (i = 0; i < MAX_NR_PROCESSORS; ++i)
+    {
+      SIM_CPU *cpu = STATE_CPU (sd, i);
+
+      CPU_PC_FETCH (cpu) = sh_pc_get;
+      CPU_PC_STORE (cpu) = sh_pc_set;
+    }
+
   for (p = argv + 1; *p != NULL; ++p)
     {
       if (isdigit (**p))


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]