]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
sim: cris: do not pass cpu when writing memory during init
authorMike Frysinger <vapier@gentoo.org>
Sat, 26 Dec 2015 13:13:38 +0000 (08:13 -0500)
committerMike Frysinger <vapier@gentoo.org>
Sat, 26 Dec 2015 13:26:28 +0000 (08:26 -0500)
The point of passing down the cpu to core reads/writes is to signal which
cpu is making the access.  For system accesses (such as internal memory
initialization), passing the cpu down doesn't make sense, and in the case
of early init like cris, can cause crashes.  Since the cpu isn't fully set
up at this point, if the core code tries to access some fields (like the
PC reg), it'll crash.  While cris shouldn't be doing this setup here (it
should be in the inferior stage), we'll deal with that later.

sim/cris/ChangeLog
sim/cris/sim-if.c

index e7f4cc61d7d3a8b7c27f43f8263a6780fa27f2c1..82cffd34e23f761f2c59d58aa265896941761e34 100644 (file)
@@ -1,3 +1,8 @@
+2015-12-26  Mike Frysinger  <vapier@gentoo.org>
+
+       * sim-if.c (sim_open): Delete cpu variable.  Pass NULL/NULL_CIA to
+       sim_core_write_buffer.
+
 2015-12-26  Mike Frysinger  <vapier@gentoo.org>
 
        * sim-if.c (sim_create_inferior): Delete old comment and set up
index 97307f811b79cb3ea5494135bbed9a09e507dd50..72c0540770ecae9edaa204a4f9d35828fdbbea42 100644 (file)
@@ -845,8 +845,6 @@ sim_open (SIM_OPEN_KIND kind, host_callback *callback, struct bfd *abfd,
       int i;
       char **prog_argv = STATE_PROG_ARGV (sd);
       int my_argc = 0;
-      /* All CPU:s have the same memory map, apparently.  */
-      SIM_CPU *cpu = STATE_CPU (sd, 0);
       USI csp;
       bfd_byte buf[4];
 
@@ -910,7 +908,7 @@ sim_open (SIM_OPEN_KIND kind, host_callback *callback, struct bfd *abfd,
      USI data_ = data;                                                 \
      USI addr_ = addr;                                                 \
      bfd_putl32 (data_, buf);                                          \
-     if (sim_core_write_buffer (sd, cpu, 0, buf, addr_, 4) != 4)       \
+     if (sim_core_write_buffer (sd, NULL, NULL_CIA, buf, addr_, 4) != 4)\
        goto abandon_chip;                                              \
    }                                                                   \
  while (0)
@@ -922,7 +920,8 @@ sim_open (SIM_OPEN_KIND kind, host_callback *callback, struct bfd *abfd,
        {
          size_t strln = strlen (prog_argv[i]) + 1;
 
-         if (sim_core_write_buffer (sd, cpu, 0, prog_argv[i], epp, strln)
+         if (sim_core_write_buffer (sd, NULL, NULL_CIA, prog_argv[i], epp,
+                                    strln)
              != strln)
          goto abandon_chip;
 
@@ -937,7 +936,8 @@ sim_open (SIM_OPEN_KIND kind, host_callback *callback, struct bfd *abfd,
        {
          unsigned int strln = strlen (my_environ[i]) + 1;
 
-         if (sim_core_write_buffer (sd, cpu, 0, my_environ[i], epp, strln)
+         if (sim_core_write_buffer (sd, NULL, NULL_CIA, my_environ[i], epp,
+                                    strln)
              != strln)
            goto abandon_chip;