* Commit: ARM SIM
@ 2016-07-14 10:41 Nick Clifton
0 siblings, 0 replies; only message in thread
From: Nick Clifton @ 2016-07-14 10:41 UTC (permalink / raw)
To: gdb-patches
Hi Guys,
I have been testing the ARM simulator against various illegal binaries
and I have come across a couple of small problems. The first is that
the sim will complain about illegal arguments to the 64-bit multiply
instructions (good), but it will complain even if the user does not
want to see the complaints (bad). So I have added code to restrict
the error messages to when debugging is enabled.
The second fix is to the SWIopen() function, which used to assume that
the flags provided in register r1 were always valid. This patch adds
code to check the flags, and ignore invalid ones.
Cheers
Nick
sim/arm/ChangeLog
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.
diff --git a/sim/arm/armemu.c b/sim/arm/armemu.c
index 5fde3fd..76f398b 100644
--- a/sim/arm/armemu.c
+++ b/sim/arm/armemu.c
@@ -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)
diff --git a/sim/arm/armos.c b/sim/arm/armos.c
index c49036f..ea3d229 100644
--- a/sim/arm/armos.c
+++ b/sim/arm/armos.c
@@ -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)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-07-14 10:41 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-14 10:41 Commit: ARM SIM Nick Clifton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).