summaryrefslogtreecommitdiff
path: root/src/arch/x86/intregs.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/x86/intregs.hh')
-rw-r--r--src/arch/x86/intregs.hh6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/arch/x86/intregs.hh b/src/arch/x86/intregs.hh
index 6f252392e..627d7062f 100644
--- a/src/arch/x86/intregs.hh
+++ b/src/arch/x86/intregs.hh
@@ -60,6 +60,8 @@
#include "arch/x86/x86_traits.hh"
#include "base/bitunion.hh"
+#include "base/misc.hh"
+#include "sim/core.hh"
namespace X86ISA
{
@@ -187,7 +189,9 @@ namespace X86ISA
inline static IntRegIndex
INTREG_FOLDED(int index, int foldBit)
{
- return (IntRegIndex)(((index & 0x1C) == 4 ? foldBit : 0) | index);
+ if ((index & 0x1C) == 4 && foldBit)
+ index = (index - 4) | foldBit;
+ return (IntRegIndex)index;
}
};