sim: watchpoints: change sizeof_pc to sizeof(sim_cia)
authorMike Frysinger <vapier@gentoo.org>
Mon, 23 Mar 2015 04:30:52 +0000 (00:30 -0400)
committerMike Frysinger <vapier@gentoo.org>
Sat, 30 Jan 2021 15:14:21 +0000 (10:14 -0500)
Existing ports already have sizeof_pc set to the same size as sim_cia,
so simply make that part of the core code.  We already assume this in
places by way of sim_pc_{get,set}, and this is how it's documented in
the sim-base.h API.

There is code to allow sims to pick different register word sizes from
address sizes, but most ports use the defaults for both (32-bits), and
the few that support multiple register sizes never change the address
size (so address defaults to register).  I can't think of any machine
where the register hardware size would be larger than the address word
size either.  We have ABIs that behave that way (e.g. x32), but the
hardware is still equivalent register sized.

23 files changed:
sim/ChangeLog
sim/README-HACKING
sim/avr/ChangeLog
sim/avr/interp.c
sim/bfin/ChangeLog
sim/bfin/interp.c
sim/common/ChangeLog
sim/common/sim-watch.c
sim/common/sim-watch.h
sim/frv/ChangeLog
sim/frv/sim-if.c
sim/iq2000/ChangeLog
sim/iq2000/sim-if.c
sim/m32r/ChangeLog
sim/m32r/sim-if.c
sim/mips/ChangeLog
sim/mips/interp.c
sim/mn10300/ChangeLog
sim/mn10300/interp.c
sim/moxie/ChangeLog
sim/moxie/interp.c
sim/v850/ChangeLog
sim/v850/interp.c

index b42b82479062ca490c7a9eea420948228f1fbad8..5e1ebca21ee5fbf488649811fb0766bef1dd2e67 100644 (file)
@@ -1,3 +1,7 @@
+2021-01-30  Mike Frysinger  <vapier@gentoo.org>
+
+       * README-HACKING: Delete reference to sizeof_pc.
+
 2021-01-29  Mike Frysinger  <vapier@gentoo.org>
 
        * MAINTAINERS (Global Maintainers): Move myself back.
index 583a559d2b0cb59624e53a53a2abee7db8107a8a..9953f99fc81d0534a4caaa43b25b28ec497dd8c6 100644 (file)
@@ -267,10 +267,8 @@ And in your insn fetcher:
   PROFILE_COUNT_CORE (cpu, target_addr, size_in_bytes, map_exec);
 
 To use the PC profiling code, you simply have to tell the system where to find
-your simulator's PC and its size.  So in your sim_open() function:
+your simulator's PC.  So in your sim_open() function:
   STATE_WATCHPOINTS (sd)->pc = address_of_cpu0_pc;
-  STATE_WATCHPOINTS (sd)->sizeof_pc = number_of_bytes_for_pc_storage;
-In a typical 32bit system, the sizeof_pc will be 4 bytes.
 
 To profile branches, in every location where a branch insn is executed, call
 one of the related helpers:
index 0f837b255248679a3a6c4b5afaaae8955d25f5fc..2854ff87eaf7b15f59950541677abefa58db2645 100644 (file)
@@ -1,3 +1,7 @@
+2021-01-30  Mike Frysinger  <vapier@gentoo.org>
+
+       * interp.c (sim_open): Delete STATE_WATCHPOINTS (sd)->sizeof_pc.
+
 2021-01-11  Mike Frysinger  <vapier@gentoo.org>
 
        * config.in, configure: Regenerate.
index 3aff8816187e8cbcb285fcba10b421582cbeca17..ba89eb532d9bf0d0d9485d57f63358575320d811 100644 (file)
@@ -1694,7 +1694,6 @@ sim_open (SIM_OPEN_KIND kind, host_callback *cb,
     /* XXX: Only first core gets profiled ?  */
     SIM_CPU *cpu = STATE_CPU (sd, 0);
     STATE_WATCHPOINTS (sd)->pc = &cpu->pc;
-    STATE_WATCHPOINTS (sd)->sizeof_pc = sizeof (cpu->pc);
   }
 
   if (sim_pre_argv_init (sd, argv[0]) != SIM_RC_OK)
index 36acbdc40af10435c15be4efaa3c5aa500eddf11..70910b2c60964371d7c73de489311624f201db57 100644 (file)
@@ -1,3 +1,7 @@
+2021-01-30  Mike Frysinger  <vapier@gentoo.org>
+
+       * interp.c (sim_open): Delete STATE_WATCHPOINTS (sd)->sizeof_pc.
+
 2021-01-11  Mike Frysinger  <vapier@gentoo.org>
 
        * config.in, configure: Regenerate.
index e26a8221b20a220be2ddf40e1b327cf221d335f4..ef23de3ede76534217466e60230e4cd0cde7c4b1 100644 (file)
@@ -733,7 +733,6 @@ sim_open (SIM_OPEN_KIND kind, host_callback *callback,
     /* XXX: Only first core gets profiled ?  */
     SIM_CPU *cpu = STATE_CPU (sd, 0);
     STATE_WATCHPOINTS (sd)->pc = &PCREG;
-    STATE_WATCHPOINTS (sd)->sizeof_pc = sizeof (PCREG);
   }
 
   if (sim_pre_argv_init (sd, argv[0]) != SIM_RC_OK)
index dbf030d502f6c6aaa7b3c25b70216721b2431908..c7d64392882ee8e0eb311dde34441d2fcfc978dc 100644 (file)
@@ -1,3 +1,9 @@
+2021-01-30  Mike Frysinger  <vapier@gentoo.org>
+
+       * sim-watch.c (schedule_watchpoint): Change sizeof_pc to sizeof
+       sim_cia.
+       * sim-watch.h (struct _sim_watchpoints): Delete sizeof_pc.
+
 2021-01-30  Mike Frysinger  <vapier@gentoo.org>
 
        * sim-profile.c (profile_pc_init): Change 1 in shifts to 1ULL.
index 6d177298597103cd4140f86660e9656a3b13acb1..9ccd472465a81233efbe813edf5f0605c7330593 100644 (file)
@@ -172,7 +172,7 @@ schedule_watchpoint (SIM_DESC sd,
     case pc_watchpoint:
       point->event = sim_events_watch_sim (sd,
                                           watch->pc,
-                                          watch->sizeof_pc,
+                                          sizeof (sim_cia),
                                           HOST_BYTE_ORDER,
                                           point->is_within,
                                           point->arg0, point->arg1,
@@ -377,8 +377,8 @@ static const OPTION watchpoint_options[] =
 static const char *default_interrupt_names[] = { "int", 0, };
 
 /* This default handler is "good enough" for targets that just want to trap into
-   gdb when watchpoints are hit, and have only configured STATE_WATCHPOINTS pc &
-   sizeof_pc fields.  */
+   gdb when watchpoints are hit, and have only configured the STATE_WATCHPOINTS
+   pc field.  */
 static void
 default_interrupt_handler (SIM_DESC sd, void *data)
 {
index 1fd66fc1bf58a950d35c1314b3ca1ecf565f0585..52a8d12795dc1d974bc322f95eb366f80c9e0d9e 100644 (file)
@@ -50,7 +50,6 @@ typedef struct _sim_watchpoints {
   /* FIXME: In the future this shall be generalized so that any of the
      N processors M registers can be watched */
   void *pc;
-  int sizeof_pc;
 
   /* Pointer to the handler for interrupt watchpoints */
   /* FIXME: can this be done better? */
index 5fa03620f9175b4f4a9def197dfeafc14ea25e8a..83770c3067aa0afcce2688ba20dc933a4fe61655 100644 (file)
@@ -1,3 +1,7 @@
+2021-01-30  Mike Frysinger  <vapier@gentoo.org>
+
+       * sim-if.c (sim_open): Delete STATE_WATCHPOINTS (sd)->sizeof_pc.
+
 2021-01-11  Mike Frysinger  <vapier@gentoo.org>
 
        * configure.ac: Call SIM_AC_OPTION_WARNINGS.
index 636890bd2cbcdd9dcc4602a85da3e6d69ff8fedf..bea84002cd3a919b5e73fc2cd018093a23957f1f 100644 (file)
@@ -66,7 +66,6 @@ sim_open (kind, callback, abfd, argv)
   {
     SIM_CPU *current_cpu = STATE_CPU (sd, 0);
     STATE_WATCHPOINTS (sd)->pc = &(PC);
-    STATE_WATCHPOINTS (sd)->sizeof_pc = sizeof (PC);
   }
 #endif
 
index f609759169c5a5c5062fc05a576cce54e40c89f2..79e49390575e0415234cefd2929c2a2e5c44fd35 100644 (file)
@@ -1,3 +1,7 @@
+2021-01-30  Mike Frysinger  <vapier@gentoo.org>
+
+       * sim-if.c (sim_open): Delete STATE_WATCHPOINTS (sd)->sizeof_pc.
+
 2021-01-11  Mike Frysinger  <vapier@gentoo.org>
 
        * configure.ac: Call SIM_AC_OPTION_WARNINGS.
index 07169402c99d44d4132173d254eac6498b6fd2fe..de90e731c1a62306a8713783dfb464f50a2571d8 100644 (file)
@@ -72,7 +72,6 @@ sim_open (kind, callback, abfd, argv)
   {
     SIM_CPU *current_cpu = STATE_CPU (sd, 0);
     STATE_WATCHPOINTS (sd)->pc = &(PC);
-    STATE_WATCHPOINTS (sd)->sizeof_pc = sizeof (PC);
   }
 #endif
 
index 551e12b7bcc126a9e0c681cc241b24f1d59c0310..73e00643416dff633270cff8361658dbf651c209 100644 (file)
@@ -1,3 +1,7 @@
+2021-01-30  Mike Frysinger  <vapier@gentoo.org>
+
+       * sim-if.c (sim_open): Delete STATE_WATCHPOINTS (sd)->sizeof_pc.
+
 2021-01-11  Mike Frysinger  <vapier@gentoo.org>
 
        * configure.ac: Call SIM_AC_OPTION_WARNINGS.
index 08003b50fd6f46f98d2f964a0a97837249eb2745..2d2f5e47cb4c0490bf050308cea9234d182ee282 100644 (file)
@@ -66,7 +66,6 @@ sim_open (kind, callback, abfd, argv)
   {
     SIM_CPU *current_cpu = STATE_CPU (sd, 0);
     STATE_WATCHPOINTS (sd)->pc = &(PC);
-    STATE_WATCHPOINTS (sd)->sizeof_pc = sizeof (PC);
   }
 #endif
 
index 94827d5df31ea2a7cfe076568694a4ce986de4cf..068d3067e38ef7292ba2d6dced7c1fa9f4b303c5 100644 (file)
@@ -1,3 +1,7 @@
+2021-01-30  Mike Frysinger  <vapier@gentoo.org>
+
+       * interp.c (sim_open): Delete STATE_WATCHPOINTS (sd)->sizeof_pc.
+
 2021-01-11  Mike Frysinger  <vapier@gentoo.org>
 
        * config.in, configure: Regenerate.
index 49e5f716757408424b1840c0dbf18491b13e4051..852f362eb40d6891eb69d19f53d58899d88dacb5 100644 (file)
@@ -356,7 +356,6 @@ sim_open (SIM_OPEN_KIND kind, host_callback *cb,
 
   /* FIXME: watchpoints code shouldn't need this */
   STATE_WATCHPOINTS (sd)->pc = &(PC);
-  STATE_WATCHPOINTS (sd)->sizeof_pc = sizeof (PC);
   STATE_WATCHPOINTS (sd)->interrupt_handler = interrupt_event;
 
   /* Initialize the mechanism for doing insn profiling.  */
index 3932e81d8c690010c4a394da72d271f7cc100d67..45fdcad8500b877336c8bf0848f05329c7b8352c 100644 (file)
@@ -1,3 +1,7 @@
+2021-01-30  Mike Frysinger  <vapier@gentoo.org>
+
+       * interp.c (sim_open): Delete STATE_WATCHPOINTS (sd)->sizeof_pc.
+
 2021-01-11  Mike Frysinger  <vapier@gentoo.org>
 
        * config.in, configure: Regenerate.
index 418f3f00a394838183758b3e353070bca224dfac..c41797a855bf1f52a7f46204408b027e6885d802 100644 (file)
@@ -103,7 +103,6 @@ sim_open (SIM_OPEN_KIND kind,
      moment, only support watchpoints causing a breakpoint (gdb
      halt). */
   STATE_WATCHPOINTS (sd)->pc = &(PC);
-  STATE_WATCHPOINTS (sd)->sizeof_pc = sizeof (PC);
   STATE_WATCHPOINTS (sd)->interrupt_handler = NULL;
   STATE_WATCHPOINTS (sd)->interrupt_names = NULL;
 
index c01b323fe16f8d43191d36f5556c3e06007c9371..4a10ac365bad629bda172b008561b817c6ad01e8 100644 (file)
@@ -1,3 +1,7 @@
+2021-01-30  Mike Frysinger  <vapier@gentoo.org>
+
+       * interp.c (sim_open): Delete STATE_WATCHPOINTS (sd)->sizeof_pc.
+
 2021-01-11  Mike Frysinger  <vapier@gentoo.org>
 
        * config.in, configure: Regenerate.
index f895af6f1bb459d2068a6b0a78cc27aaaa4727f9..c5f9ed6416038c853a9a1d88c8236ac929d4bedc 100644 (file)
@@ -1204,7 +1204,6 @@ sim_open (SIM_OPEN_KIND kind, host_callback *cb,
     }
 
   STATE_WATCHPOINTS (sd)->pc = &cpu.asregs.regs[PC_REGNO];
-  STATE_WATCHPOINTS (sd)->sizeof_pc = sizeof (word);
 
   if (sim_pre_argv_init (sd, argv[0]) != SIM_RC_OK)
     {
index 4f2ccc7cfc5ba3fc4a79e99cdccbb0bed655bb50..b99ca24dcfbc6a5c6422d6f39bf108e446789cbb 100644 (file)
@@ -1,3 +1,7 @@
+2021-01-30  Mike Frysinger  <vapier@gentoo.org>
+
+       * interp.c (sim_open): Delete STATE_WATCHPOINTS (sd)->sizeof_pc.
+
 2021-01-11  Mike Frysinger  <vapier@gentoo.org>
 
        * config.in, configure: Regenerate.
index 10d8a67a6fb937e8689032975b7cb8ddffc4f745..24d7ddc297d389e4d4ff2c6a488d05c0d801e1e9 100644 (file)
@@ -203,7 +203,6 @@ sim_open (SIM_OPEN_KIND    kind,
 
   /* FIXME: should be better way of setting up interrupts */
   STATE_WATCHPOINTS (sd)->pc = &(PC);
-  STATE_WATCHPOINTS (sd)->sizeof_pc = sizeof (PC);
   STATE_WATCHPOINTS (sd)->interrupt_handler = do_interrupt;
   STATE_WATCHPOINTS (sd)->interrupt_names = interrupt_names;
 
This page took 0.056663 seconds and 4 git commands to generate.