summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2007-04-03 14:56:24 +0000
committerGabe Black <gblack@eecs.umich.edu>2007-04-03 14:56:24 +0000
commit0ce6936e7d5373593f5a468529d30035db62b601 (patch)
tree0a60ed45acbd6ef57f117f773f4cff39d4355b3b
parentac191ecc787222b4d045698b7f75a4cbeaaef50b (diff)
downloadgem5-0ce6936e7d5373593f5a468529d30035db62b601.tar.xz
Zero out ModRM if the byte isn't there, and fix some displacement size stuff.
--HG-- extra : convert_revision : f43abf33a223a665b30098c63011fb162200d5e6
-rw-r--r--src/arch/x86/predecoder.cc17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/arch/x86/predecoder.cc b/src/arch/x86/predecoder.cc
index fbed4fe41..80971e7cf 100644
--- a/src/arch/x86/predecoder.cc
+++ b/src/arch/x86/predecoder.cc
@@ -212,11 +212,16 @@ namespace X86ISA
//Determine what to expect next
if (UsesModRM[emi.opcode.num - 1][nextByte]) {
nextState = ModRMState;
- } else if(immediateSize) {
- nextState = ImmediateState;
} else {
- emiIsReady = true;
- nextState = PrefixState;
+ //If there's no modRM byte, set it to 0 so we can detect
+ //that later.
+ emi.modRM = 0;
+ if(immediateSize) {
+ nextState = ImmediateState;
+ } else {
+ emiIsReady = true;
+ nextState = PrefixState;
+ }
}
}
return nextState;
@@ -241,11 +246,11 @@ namespace X86ISA
displacementSize = 0;
} else {
//figure out 32/64 bit displacement size
- if(nextByte & 0xC7 == 0x05 ||
+ if(nextByte & 0xC6 == 0x04 ||
nextByte & 0xC0 == 0x80)
displacementSize = 4;
else if(nextByte & 0xC0 == 0x40)
- displacementSize = 2;
+ displacementSize = 1;
else
displacementSize = 0;
}