summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2007-07-17 20:54:55 -0700
committerGabe Black <gblack@eecs.umich.edu>2007-07-17 20:54:55 -0700
commit85f32920fb2e4b4938cefcfc275c09abef20cf11 (patch)
tree1425527fb4a4968e5559e1f4b0eb589248e86190 /src
parente524240d689a6341a53865e0911ad04d440c6683 (diff)
downloadgem5-85f32920fb2e4b4938cefcfc275c09abef20cf11.tar.xz
Calculate the correct address size.
--HG-- extra : convert_revision : 6bd9d5a01ba6600781e3678e0403dca524fb2cba
Diffstat (limited to 'src')
-rw-r--r--src/arch/x86/predecoder.cc34
1 files changed, 31 insertions, 3 deletions
diff --git a/src/arch/x86/predecoder.cc b/src/arch/x86/predecoder.cc
index 49f76699b..6052d8392 100644
--- a/src/arch/x86/predecoder.cc
+++ b/src/arch/x86/predecoder.cc
@@ -235,14 +235,42 @@ namespace X86ISA
logOpSize = 1; // 16 bit operand size
}
+ //Set the actual op size
+ emi.opSize = 1 << logOpSize;
+
+ //Figure out the effective address size. This can be overriden to
+ //a fixed value at the decoder level.
+ int logAddrSize;
+ if(/*FIXME 64-bit mode*/1)
+ {
+ if(emi.legacy.addr)
+ logAddrSize = 2; // 32 bit address size
+ else
+ logAddrSize = 3; // 64 bit address size
+ }
+ else if(/*FIXME default 32*/1)
+ {
+ if(emi.legacy.addr)
+ logAddrSize = 1; // 16 bit address size
+ else
+ logAddrSize = 2; // 32 bit address size
+ }
+ else // 16 bit default operand size
+ {
+ if(emi.legacy.addr)
+ logAddrSize = 2; // 32 bit address size
+ else
+ logAddrSize = 1; // 16 bit address size
+ }
+
+ //Set the actual address size
+ emi.addrSize = 1 << logAddrSize;
+
//Figure out how big of an immediate we'll retreive based
//on the opcode.
int immType = ImmediateType[emi.opcode.num - 1][nextByte];
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]) {
nextState = ModRMState;