]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Small improvements to the ARM simulator to cope with illegal binaries.
authorNick Clifton <nickc@redhat.com>
Thu, 14 Jul 2016 09:38:07 +0000 (10:38 +0100)
committerNick Clifton <nickc@redhat.com>
Thu, 14 Jul 2016 09:38:07 +0000 (10:38 +0100)
* armemu.c (Multiply64): Only issue error messages about invalid
arguments if debugging is enabled.
* armos.c (ARMul_OSHandleSWI): Ignore invalid flags.

sim/arm/ChangeLog
sim/arm/armemu.c
sim/arm/armos.c

index cae6f528d903837b836046c99d232072dfb23b7a..2ce94292420c0fc87d48607c3960d53e8b57dfd7 100644 (file)
@@ -1,3 +1,9 @@
+2016-07-14  Nick Clifton  <nickc@redhat.com>
+
+       * armemu.c (Multiply64): Only issue error messages about invalid
+       arguments if debugging is enabled.
+       * armos.c (ARMul_OSHandleSWI): Ignore invalid flags.
+
 2016-01-10  Mike Frysinger  <vapier@gentoo.org>
 
        * config.in, configure: Regenerate.
index 5fde3fd259578eb6a2060fc5a7668ceb85ae0d8a..76f398b3d7172ac492c23536ed4102ebf77ccde0 100644 (file)
@@ -5950,10 +5950,10 @@ Multiply64 (ARMul_State * state, ARMword instr, int msigned, int scc)
        ;
       else
 #endif
-       if (nRdHi == nRm || nRdLo == nRm)
+       /* BAD code can trigger this result.  So only complain if debugging.  */
+       if (state->Debug && (nRdHi == nRm || nRdLo == nRm))
          fprintf (stderr, "sim: MULTIPLY64 - INVALID ARGUMENTS: %d %d %d\n",
                   nRdHi, nRdLo, nRm);
-
       if (msigned)
        {
          /* Compute sign of result and adjust operands if necessary.  */
@@ -5998,7 +5998,7 @@ Multiply64 (ARMul_State * state, ARMword instr, int msigned, int scc)
       state->Reg[nRdLo] = RdLo;
       state->Reg[nRdHi] = RdHi;
     }
-  else
+  else if (state->Debug)
     fprintf (stderr, "sim: MULTIPLY64 - INVALID ARGUMENTS\n");
 
   if (scc)
index c49036f1224246e257e339818efd0539b6b7e9d3..ea3d22979ac8d001ddcab507000fd610bdd0e95b 100644 (file)
@@ -260,7 +260,10 @@ SWIopen (ARMul_State * state, ARMword name, ARMword SWIflags)
     return;
 
   /* Now we need to decode the Demon open mode.  */
-  flags = translate_open_mode[SWIflags];
+  if (SWIflags >= sizeof (translate_open_mode) / sizeof (translate_open_mode[0]))
+    flags = 0;
+  else
+    flags = translate_open_mode[SWIflags];
 
   /* Filename ":tt" is special: it denotes stdin/out.  */
   if (strcmp (buf, ":tt") == 0)