From c087b60af34abb2b496d2308327071c45c1a9a04 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Wed, 5 Aug 2009 02:58:03 -0700 Subject: X86: Fix the sar carry flag. --- src/arch/x86/isa/microops/regop.isa | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/arch/x86/isa/microops/regop.isa') diff --git a/src/arch/x86/isa/microops/regop.isa b/src/arch/x86/isa/microops/regop.isa index 4d4079f5f..5461223a3 100644 --- a/src/arch/x86/isa/microops/regop.isa +++ b/src/arch/x86/isa/microops/regop.isa @@ -711,8 +711,12 @@ 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)) + uint8_t effectiveShift = + (shiftAmt <= dataSize * 8) ? shiftAmt : (dataSize * 8); + if ((ext & (CFBit | ECFBit)) && + bits(SrcReg1, effectiveShift - 1)) { ccFlagBits = ccFlagBits | (ext & (CFBit | ECFBit)); + } //Use the regular mechanisms to calculate the other flags. ccFlagBits = genFlags(ccFlagBits, ext & ~(CFBit | ECFBit | OFBit), DestReg, psrc1, op2); -- cgit v1.2.3