]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - sim/rx/reg.c
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / sim / rx / reg.c
index f635b6dc555b271baf6534c0a84b1218fce17975..1bc652d8ce3d0d48ed0364f7198780551676b7e1 100644 (file)
@@ -1,6 +1,6 @@
 /* reg.c --- register set model for RX simulator.
 
-   Copyright (C) 2005, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+   Copyright (C) 2005-2024 Free Software Foundation, Inc.
    Contributed by Red Hat, Inc.
 
    This file is part of the GNU simulators.
@@ -18,6 +18,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -67,6 +69,11 @@ init_regs (void)
 {
   memset (&regs, 0, sizeof (regs));
   memset (&oldregs, 0, sizeof (oldregs));
+
+#ifdef CYCLE_ACCURATE
+  regs.rt = -1;
+  oldregs.rt = -1;
+#endif
 }
 
 static unsigned int
@@ -143,7 +150,7 @@ get_reg64 (int id)
 static int highest_sp = 0, lowest_sp = 0xffffff;
 
 void
-stack_heap_stats ()
+stack_heap_stats (void)
 {
   if (heapbottom < heaptop)
     printf ("heap:  %08x - %08x (%d bytes)\n", heapbottom, heaptop,
@@ -247,7 +254,7 @@ put_reg (int id, unsigned int v)
       }
 
     default:
-      if (id >= 1 || id <= 15)
+      if (id >= 1 && id <= 15)
        regs.r[id] = v;
       else
        abort ();
@@ -503,7 +510,7 @@ fpsw2str(int rpsw)
 #define TRC(f,n) \
   if (oldregs.f != regs.f) \
     { \
-      if (tag) { printf (tag); tag = 0; } \
+      if (tag) { printf ("%s", tag); tag = 0; }  \
       printf("  %s %08x:%08x", n, \
             (unsigned int)oldregs.f, \
             (unsigned int)regs.f); \
@@ -525,7 +532,7 @@ trace_register_changes (void)
   TRC (r_isp, "isp");
   if (oldregs.r_psw != regs.r_psw)
     {
-      if (tag) { printf (tag); tag = 0; }
+      if (tag) { printf ("%s", tag); tag = 0; }
       printf("  psw %s:", psw2str(oldregs.r_psw));
       printf("%s", psw2str(regs.r_psw));
       oldregs.r_psw = regs.r_psw;
@@ -533,7 +540,7 @@ trace_register_changes (void)
 
   if (oldregs.r_fpsw != regs.r_fpsw)
     {
-      if (tag) { printf (tag); tag = 0; }
+      if (tag) { printf ("%s", tag); tag = 0; }
       printf("  fpsw %s:", fpsw2str(oldregs.r_fpsw));
       printf("%s", fpsw2str(regs.r_fpsw));
       oldregs.r_fpsw = regs.r_fpsw;
@@ -541,9 +548,9 @@ trace_register_changes (void)
 
   if (oldregs.r_acc != regs.r_acc)
     {
-      if (tag) { printf (tag); tag = 0; }
-      printf("  acc %016llx:", oldregs.r_acc);
-      printf("%016llx", regs.r_acc);
+      if (tag) { printf ("%s", tag); tag = 0; }
+      printf("  acc %016" PRIx64 ":", oldregs.r_acc);
+      printf("%016" PRIx64, regs.r_acc);
       oldregs.r_acc = regs.r_acc;
     }