Check for out of range IPR values as well.
authorGabe Black <gblack@eecs.umich.edu>
Tue, 31 Oct 2006 23:19:45 +0000 (18:19 -0500)
committerGabe Black <gblack@eecs.umich.edu>
Tue, 31 Oct 2006 23:19:45 +0000 (18:19 -0500)
--HG--
extra : convert_revision : 9ca241bb71d8a1d022e54485383a88d2abece663

src/arch/alpha/isa/decoder.isa

index 550aa62a3bcd854e0ec0c980b797bee502ecda62..e4cf967670cb4a1c2e4ff982fee6e579924cb23f 100644 (file)
@@ -745,8 +745,10 @@ decode OPCODE default Unknown::unknown() {
         0: OpcdecFault::hw_mfpr();
         format HwMoveIPR {
             1: hw_mfpr({{
-                int miscRegIndex = IprToMiscRegIndex[ipr_index];
-                if(miscRegIndex < 0 || !IprIsReadable(miscRegIndex))
+                miscRegIndex >= NumInternalProcRegs)
+                int miscRegIndex = (ipr_index < NumInternalProcRegs) ?
+                        IprToMiscRegIndex[ipr_index] : -1;
+                if(miscRegIndex < 0 || !IprIsReadable(miscRegIndex) ||
                         fault = new UnimplementedOpcodeFault;
                 else
                     Ra = xc->readMiscRegWithEffect(miscRegIndex, fault);
@@ -758,7 +760,8 @@ decode OPCODE default Unknown::unknown() {
         0: OpcdecFault::hw_mtpr();
         format HwMoveIPR {
             1: hw_mtpr({{
-                int miscRegIndex = IprToMiscRegIndex[ipr_index];
+                int miscRegIndex = (ipr_index < NumInternalProcRegs) ?
+                        IprToMiscRegIndex[ipr_index] : -1;
                 if(miscRegIndex < 0 || !IprIsWritable(miscRegIndex))
                         fault = new UnimplementedOpcodeFault;
                 else