aboutsummaryrefslogtreecommitdiff
path: root/opcodes
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2008-11-27 10:47:23 +0000
committerAlan Modra <amodra@gmail.com>2008-11-27 10:47:23 +0000
commite1c93c699b7dceb3fc41fb039ff5fecea73677ba (patch)
tree0f94072675ccf2db2737f8ea26ac65ea7e8afda1 /opcodes
parentc332165e457a1cf322b43f2c775636f3037b225d (diff)
downloadfsf-binutils-gdb-e1c93c699b7dceb3fc41fb039ff5fecea73677ba.zip
fsf-binutils-gdb-e1c93c699b7dceb3fc41fb039ff5fecea73677ba.tar.gz
fsf-binutils-gdb-e1c93c699b7dceb3fc41fb039ff5fecea73677ba.tar.bz2
* ppc-opc.c (extract_sprg): Correct operand range check.
Diffstat (limited to 'opcodes')
-rw-r--r--opcodes/ChangeLog4
-rw-r--r--opcodes/ppc-opc.c8
2 files changed, 8 insertions, 4 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index f85b262..479eed9 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,7 @@
+2008-11-27 Alan Modra <amodra@bigpond.net.au>
+
+ * ppc-opc.c (extract_sprg): Correct operand range check.
+
2008-11-26 Andreas Schwab <schwab@suse.de>
* m68k-dis.c (NEXTBYTE, NEXTWORD, NEXTLONG, NEXTULONG, NEXTSINGLE)
diff --git a/opcodes/ppc-opc.c b/opcodes/ppc-opc.c
index 0faf528..7d05f5f 100644
--- a/opcodes/ppc-opc.c
+++ b/opcodes/ppc-opc.c
@@ -1281,10 +1281,10 @@ extract_sprg (unsigned long insn,
/* mfsprg can use 260..263 and 272..279. mtsprg only uses spr 272..279
If not BOOKE or 405, then both use only 272..275. */
- if (val <= 3
- || (val < 0x10 && (insn & 0x100) != 0)
- || (val - 0x10 > 3
- && (dialect & (PPC_OPCODE_BOOKE | PPC_OPCODE_403)) == 0))
+ if ((val - 0x10 > 3 && (dialect & (PPC_OPCODE_BOOKE | PPC_OPCODE_405)) == 0)
+ || (val - 0x10 > 7 && (insn & 0x100) != 0)
+ || val <= 3
+ || (val & 8) != 0)
*invalid = 1;
return val & 7;
}