arch-x86: A bug in rcr instruction of x86 solved.

A bug found in rotate carry right (rcr) instruction of x86 architecture
(src/arch/x86/isa/microops/regop.isa:891)

If realShiftAmt is dataSize * 8, bits function raises an assertion error
because the range is (dataSize * 8, dataSize * 8 - 1), which is invalid.

Jira Issue: https://gem5.atlassian.net/browse/GEM5-1265

Change-Id: Ida59c56eb042f374c69d4a4d1380f7f770bb911b
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/62213
Tested-by: kokoro <noreply+kokoro@google.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
This commit is contained in:
yiwkd2
2022-08-09 06:48:56 -04:00
committed by Youngin Kim
parent 25d2a8366a
commit 1dd30723c4

View File

@@ -898,8 +898,9 @@ let {{
uint64_t top = flags.cf << (dataSize * 8 - realShiftAmt);
if (realShiftAmt > 1)
top |= PSrcReg1 << (dataSize * 8 - realShiftAmt + 1);
uint64_t bottom =
bits(PSrcReg1, dataSize * 8 - 1, realShiftAmt);
uint64_t bottom = 0;
if (realShiftAmt != dataSize * 8)
bottom = bits(PSrcReg1, dataSize * 8 - 1, realShiftAmt);
DestReg = merge(DestReg, dest, top | bottom, dataSize);
} else
DestReg = merge(DestReg, dest, DestReg, dataSize);