SHA256
3
0
forked from pool/binutils
binutils/ppc-opc.diff

28 lines
1006 B
Diff

2008-11-27 Alan Modra <amodra@bigpond.net.au>
* ppc-opc.c (extract_sprg): Correct operand range check.
Index: opcodes/ppc-opc.c
===================================================================
RCS file: /cvs/src/src/opcodes/ppc-opc.c,v
retrieving revision 1.110
retrieving revision 1.111
diff -u -a -p -u -p -a -r1.110 -r1.111
--- opcodes/ppc-opc.c 14 Aug 2008 13:56:00 -0000 1.110
+++ opcodes/ppc-opc.c 27 Nov 2008 10:47:23 -0000 1.111
@@ -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;
}