summaryrefslogtreecommitdiff
path: root/src/arch/x86
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/x86')
-rw-r--r--src/arch/x86/predecoder.cc22
-rw-r--r--src/arch/x86/predecoder.hh11
2 files changed, 15 insertions, 18 deletions
diff --git a/src/arch/x86/predecoder.cc b/src/arch/x86/predecoder.cc
index c99b0cfb0..5c98a1831 100644
--- a/src/arch/x86/predecoder.cc
+++ b/src/arch/x86/predecoder.cc
@@ -209,34 +209,38 @@ namespace X86ISA
//Figure out the effective operand size. This can be overriden to
//a fixed value at the decoder level.
+ int logOpSize;
if(/*FIXME long mode*/1)
{
- if(emi.rex && emi.rex.w)
- emi.opSize = 3; // 64 bit operand size
+ if(emi.rex.w)
+ logOpSize = 3; // 64 bit operand size
else if(emi.legacy.op)
- emi.opSize = 1; // 16 bit operand size
+ logOpSize = 1; // 16 bit operand size
else
- emi.opSize = 2; // 32 bit operand size
+ logOpSize = 2; // 32 bit operand size
}
else if(/*FIXME default 32*/1)
{
if(emi.legacy.op)
- emi.opSize = 1; // 16 bit operand size
+ logOpSize = 1; // 16 bit operand size
else
- emi.opSize = 2; // 32 bit operand size
+ logOpSize = 2; // 32 bit operand size
}
else // 16 bit default operand size
{
if(emi.legacy.op)
- emi.opSize = 2; // 32 bit operand size
+ logOpSize = 2; // 32 bit operand size
else
- emi.opSize = 1; // 16 bit operand size
+ logOpSize = 1; // 16 bit operand size
}
//Figure out how big of an immediate we'll retreive based
//on the opcode.
int immType = ImmediateType[emi.opcode.num - 1][nextByte];
- immediateSize = SizeTypeToSize[emi.opSize - 1][immType];
+ immediateSize = SizeTypeToSize[logOpSize - 1][immType];
+
+ //Set the actual op size
+ emi.opSize = 1 << logOpSize;
//Determine what to expect next
if (UsesModRM[emi.opcode.num - 1][nextByte]) {
diff --git a/src/arch/x86/predecoder.hh b/src/arch/x86/predecoder.hh
index 9b4d36d4a..0708875c1 100644
--- a/src/arch/x86/predecoder.hh
+++ b/src/arch/x86/predecoder.hh
@@ -192,9 +192,9 @@ namespace X86ISA
//Use this to give data to the predecoder. This should be used
//when there is control flow.
- void moreBytes(Addr currPC, Addr off, MachInst data)
+ void moreBytes(Addr pc, Addr fetchPC, Addr off, MachInst data)
{
- basePC = currPC;
+ basePC = fetchPC;
offset = off;
fetchChunk = data;
assert(off < sizeof(MachInst));
@@ -202,13 +202,6 @@ namespace X86ISA
process();
}
- //Use this to give data to the predecoder. This should be used
- //when instructions are executed in order.
- void moreBytes(MachInst machInst)
- {
- moreBytes(basePC + sizeof(machInst), 0, machInst);
- }
-
bool needMoreBytes()
{
return outOfBytes;