X86: Fix the carry flag for shr.
authorGabe Black <gblack@eecs.umich.edu>
Wed, 5 Aug 2009 09:56:49 +0000 (02:56 -0700)
committerGabe Black <gblack@eecs.umich.edu>
Wed, 5 Aug 2009 09:56:49 +0000 (02:56 -0700)
src/arch/x86/isa/microops/regop.isa

index ac380f34bc9a54cc7b5af679f10680f3584fe00a..e86e9f00a2adccfced90b7e9b5b36c22946b7e9f 100644 (file)
@@ -680,8 +680,11 @@ let {{
                 //worry about setting them.
                 ccFlagBits = ccFlagBits & ~(ext & (CFBit | ECFBit | OFBit));
                 //If some combination of the CF bits need to be set, set them.
-                if ((ext & (CFBit | ECFBit)) && bits(SrcReg1, shiftAmt - 1))
+                if ((ext & (CFBit | ECFBit)) && 
+                        shiftAmt <= dataSize * 8 &&
+                        bits(SrcReg1, shiftAmt - 1)) {
                     ccFlagBits = ccFlagBits | (ext & (CFBit | ECFBit));
+                }
                 //Figure out what the OF bit should be.
                 if ((ext & OFBit) && bits(SrcReg1, dataSize * 8 - 1))
                     ccFlagBits = ccFlagBits | OFBit;