sim: device_error: punt
authorMike Frysinger <vapier@gentoo.org>
Fri, 25 Dec 2015 07:13:18 +0000 (02:13 -0500)
committerMike Frysinger <vapier@gentoo.org>
Fri, 25 Dec 2015 07:18:16 +0000 (02:18 -0500)
Only four targets implement this function, and three of them do nothing.
The 4th merely calls abort.  Since calls to this function are followed
by calls to sim_hw_abort or sim_io_error, this is largely useless.  In
the two places where we don't, replace the call with sim_engine_abort.
We want to kill off the WITH_DEVICES logic in favor of WITH_HW, so this
is a good first step.

12 files changed:
sim/bfin/ChangeLog
sim/bfin/devices.c
sim/common/ChangeLog
sim/common/sim-core.c
sim/common/sim-core.h
sim/common/sim-n-core.h
sim/cris/ChangeLog
sim/cris/devices.c
sim/frv/ChangeLog
sim/frv/devices.c
sim/m32r/ChangeLog
sim/m32r/devices.c

index 1deb4ea235c311e61b1f7cee1ae76989aecbcc90..427cdd80746394aefdd29dab5fd5247f65991435 100644 (file)
@@ -1,3 +1,7 @@
+2015-12-25  Mike Frysinger  <vapier@gentoo.org>
+
+       * devices.c (device_error): Delete.
+
 2015-12-24  Mike Frysinger  <vapier@gentoo.org>
 
        * tconfig.h (SIM_HANDLES_LMA): Delete.
index e25bd217c59de34dd52c62a1ed0cb14cc9f2f96a..7dab5f19697ee5772179c0eb652c0908a0c9bc15 100644 (file)
@@ -149,14 +149,6 @@ device_io_write_buffer (device *me, const void *source, int space,
     return 0;
 }
 
-void device_error (device *me, const char *message, ...)
-{
-  /* Don't bother doing anything here -- any place in common code that
-     calls device_error() follows it with sim_hw_abort().  Since the
-     device isn't bound to the system yet, we can't call any common
-     hardware error funcs on it or we'll hit a NULL pointer.  */
-}
-
 unsigned int dv_get_bus_num (struct hw *me)
 {
   const hw_unit *unit = hw_unit_address (me);
index 0a6cb159a61eaa6a45bb0c3846fe879bb2750118..52931d889de5294ec91108fff119ef40cb7f35d3 100644 (file)
@@ -1,3 +1,13 @@
+2015-12-25  Mike Frysinger  <vapier@gentoo.org>
+
+       * sim-core.c (device_error): Delete.
+       (sim_core_map_attach): Delete calls to device_error.
+       (sim_core_attach): Likewise.
+       * sim-core.h (device_error): Delete.
+       * sim-n-core.h (sim_core_read_aligned_N): Change device_error call
+       to sim_engine_abort.
+       (sim_core_write_aligned_N): Likewise.
+
 2015-12-25  Mike Frysinger  <vapier@gentoo.org>
 
        * sim-config.h (WITH_CALLBACK_MEMORY): Delete.
index a5e3cdbb280a1baefdd3e5bb8df631be26f88253..26fabd56e55cdfa0f806b7e82da23cfb07d6d424 100644 (file)
@@ -28,7 +28,6 @@
 
 #if (WITH_HW)
 #include "sim-hw.h"
-#define device_error(client, ...) device_error ((device *)(client), __VA_ARGS__)
 #define device_io_read_buffer(client, ...) device_io_read_buffer ((device *)(client), __VA_ARGS__)
 #define device_io_write_buffer(client, ...) device_io_write_buffer ((device *)(client), __VA_ARGS__)
 #endif
@@ -194,9 +193,6 @@ sim_core_map_attach (SIM_DESC sd,
   /* actually do occasionally get a zero size map */
   if (nr_bytes == 0)
     {
-#if (WITH_DEVICES)
-      device_error (client, "called on sim_core_map_attach with size zero");
-#endif
 #if (WITH_HW)
       sim_hw_abort (sd, client, "called on sim_core_map_attach with size zero");
 #endif
@@ -223,17 +219,6 @@ sim_core_map_attach (SIM_DESC sd,
   if (next_mapping != NULL && next_mapping->level == level
       && next_mapping->base < (addr + (nr_bytes - 1)))
     {
-#if (WITH_DEVICES)
-      device_error (client, "memory map %d:0x%lx..0x%lx (%ld bytes) overlaps %d:0x%lx..0x%lx (%ld bytes)",
-                   space,
-                   (long) addr,
-                   (long) (addr + nr_bytes - 1),
-                   (long) nr_bytes,
-                   next_mapping->space,
-                   (long) next_mapping->base,
-                   (long) next_mapping->bound,
-                   (long) next_mapping->nr_bytes);
-#endif
 #if WITH_HW
       sim_hw_abort (sd, client, "memory map %d:0x%lx..0x%lx (%ld bytes) overlaps %d:0x%lx..0x%lx (%ld bytes)",
                    space,
@@ -297,9 +282,6 @@ sim_core_attach (SIM_DESC sd,
 
   if (client != NULL && modulo != 0)
     {
-#if (WITH_DEVICES)
-      device_error (client, "sim_core_attach - internal error - modulo and callback memory conflict");
-#endif
 #if (WITH_HW)
       sim_hw_abort (sd, client, "sim_core_attach - internal error - modulo and callback memory conflict");
 #endif
@@ -318,9 +300,6 @@ sim_core_attach (SIM_DESC sd,
        }
       if (mask != sizeof (unsigned64) - 1)
        {
-#if (WITH_DEVICES)
-         device_error (client, "sim_core_attach - internal error - modulo %lx not power of two", (long) modulo);
-#endif
 #if (WITH_HW)
          sim_hw_abort (sd, client, "sim_core_attach - internal error - modulo %lx not power of two", (long) modulo);
 #endif
@@ -331,9 +310,6 @@ sim_core_attach (SIM_DESC sd,
   /* verify consistency between device and buffer */
   if (client != NULL && optional_buffer != NULL)
     {
-#if (WITH_DEVICES)
-      device_error (client, "sim_core_attach - internal error - conflicting buffer and attach arguments");
-#endif
 #if (WITH_HW)
       sim_hw_abort (sd, client, "sim_core_attach - internal error - conflicting buffer and attach arguments");
 #endif
index a60e60af2cba1e4f6143b5ac9aff9ca1b5b80261..bf982325bc112573f3eed0f98970be9aa7f8241a 100644 (file)
@@ -351,7 +351,6 @@ DECLARE_SIM_CORE_READ_N(misaligned,7,8)
 #if (WITH_DEVICES)
 /* TODO: create sim/common/device.h */
 /* These are defined with each particular cpu.  */
-void device_error (device *me, const char *message, ...) __attribute__((format (printf, 2, 3)));
 int device_io_read_buffer(device *me, void *dest, int space, address_word addr, unsigned nr_bytes, SIM_DESC sd, sim_cpu *processor, sim_cia cia);
 int device_io_write_buffer(device *me, const void *source, int space, address_word addr, unsigned nr_bytes, SIM_DESC sd, sim_cpu *processor, sim_cia cia);
 #endif
index f57e8f842131ab229479a13607f8c1ea5123fca1..3393f19c252f057d9776b7750d4f6ce3cbeb0f1b 100644 (file)
@@ -169,8 +169,9 @@ sim_core_read_aligned_N(sim_cpu *cpu,
        {
          unsigned_M data;
          if (device_io_read_buffer (mapping->device, &data, mapping->space, addr, N, CPU_STATE (cpu), cpu, cia) != N)
-           device_error (mapping->device, "internal error - %s - io_read_buffer should not fail",
-                         XSTRING (sim_core_read_aligned_N));
+           sim_engine_abort (CPU_STATE (cpu), cpu, cia,
+                             "internal error - %s - io_read_buffer should not fail",
+                             XSTRING (sim_core_read_aligned_N));
          val = T2H_M (data);
          break;
        }
@@ -300,8 +301,9 @@ sim_core_write_aligned_N(sim_cpu *cpu,
        {
          unsigned_M data = H2T_M (val);
          if (device_io_write_buffer (mapping->device, &data, mapping->space, addr, N, CPU_STATE (cpu), cpu, cia) != N)
-           device_error (mapping->device, "internal error - %s - io_write_buffer should not fail",
-                         XSTRING (sim_core_write_aligned_N));
+           sim_engine_abort (CPU_STATE (cpu), cpu, cia,
+                             "internal error - %s - io_write_buffer should not fail",
+                             XSTRING (sim_core_read_aligned_N));
          break;
        }
 #endif
index 7b7618c0cbd4e6e7787b47645c54d70711948b8f..dbc2d0996417cc36d3beaf2076748bd10539140f 100644 (file)
@@ -1,3 +1,7 @@
+2015-12-25  Mike Frysinger  <vapier@gentoo.org>
+
+       * devices.c (device_error): Delete.
+
 2015-12-24  Mike Frysinger  <vapier@gentoo.org>
 
        * tconfig.h (SIM_HANDLES_LMA): Delete.
index a7fa051349b2d707098f9dd4854915fdc90c8801..56cdfedf260d8d4b499f31f9cf80f13113197f67 100644 (file)
@@ -31,14 +31,6 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Placeholder definition.  */
 struct _device { char dummy; } cris_devices;
 
-void
-device_error (device *me ATTRIBUTE_UNUSED,
-             const char *message ATTRIBUTE_UNUSED,
-             ...)
-{
-  abort ();
-}
-
 int
 device_io_read_buffer (device *me ATTRIBUTE_UNUSED,
                       void *source ATTRIBUTE_UNUSED,
index 4f0dd8f310b15564de3a12cc22ce6c8b7af6a856..c7a601e7160362bfbca32abd8423dc295d484278 100644 (file)
@@ -1,3 +1,7 @@
+2015-12-25  Mike Frysinger  <vapier@gentoo.org>
+
+       * devices.c (device_error): Delete.
+
 2015-12-24  Mike Frysinger  <vapier@gentoo.org>
 
        * tconfig.h (SIM_HANDLES_LMA): Delete.
index e417963130efcaa203c3470a0b0e32f1f4598372..176f3709b887e851b5eb9873a648e5b3f94ad5a9 100644 (file)
@@ -54,5 +54,3 @@ device_io_write_buffer (device *me, const void *source, int space,
 
   return nr_bytes;
 }
-
-void device_error (device *me, const char *message, ...) {}
index f81e61bd8f8eebd7e97148620d62ab313606f30b..7a33412ce0bab85ae3f75c76ea0689f457e2e1fe 100644 (file)
@@ -1,3 +1,7 @@
+2015-12-25  Mike Frysinger  <vapier@gentoo.org>
+
+       * devices.c (device_error): Delete.
+
 2015-12-24  Mike Frysinger  <vapier@gentoo.org>
 
        * tconfig.h (SIM_HANDLES_LMA): Delete.
index a308a08dace033451cd91d32066f6ef3670938b3..62a9b6f40871d05c5606df388f79e88fd72b0dea 100644 (file)
@@ -99,8 +99,3 @@ device_io_write_buffer (device *me, const void *source, int space,
 
   return nr_bytes;
 }
-
-void
-device_error (device *me, const char *message, ...)
-{
-}
This page took 0.032128 seconds and 4 git commands to generate.