summaryrefslogtreecommitdiff
path: root/src/arch/x86/predecoder.cc
diff options
context:
space:
mode:
authorSteve Reinhardt <stever@eecs.umich.edu>2007-06-21 12:03:22 -0700
committerSteve Reinhardt <stever@eecs.umich.edu>2007-06-21 12:03:22 -0700
commiteff122797b5bc735c6d7c797be691c0fa02032e3 (patch)
tree1dd1cef3b2b4e044fece9a406cd0ce97d09a2da7 /src/arch/x86/predecoder.cc
parent83af0fdcf57175adf8077c51e9ba872dd2c04b76 (diff)
parent5195500cdf7dc99b5367f91387eef4e9f5b65bfe (diff)
downloadgem5-eff122797b5bc735c6d7c797be691c0fa02032e3.tar.xz
Merge vm1.(none):/home/stever/bk/newmem-head
into vm1.(none):/home/stever/bk/newmem-cache2 --HG-- extra : convert_revision : 9002940097a166c8442ae1adf41b974227968920
Diffstat (limited to 'src/arch/x86/predecoder.cc')
-rw-r--r--src/arch/x86/predecoder.cc18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/arch/x86/predecoder.cc b/src/arch/x86/predecoder.cc
index 3ed18aeb2..49f76699b 100644
--- a/src/arch/x86/predecoder.cc
+++ b/src/arch/x86/predecoder.cc
@@ -264,31 +264,30 @@ namespace X86ISA
Predecoder::State Predecoder::doModRMState(uint8_t nextByte)
{
State nextState = ErrorState;
- emi.modRM = nextByte;
+ ModRM modRM;
+ modRM = nextByte;
DPRINTF(Predecoder, "Found modrm byte %#x.\n", nextByte);
if (0) {//FIXME in 16 bit mode
//figure out 16 bit displacement size
- if(nextByte & 0xC7 == 0x06 ||
- nextByte & 0xC0 == 0x80)
+ if(modRM.mod == 0 && modRM.rm == 6 || modRM.mod == 2)
displacementSize = 2;
- else if(nextByte & 0xC0 == 0x40)
+ else if(modRM.mod == 1)
displacementSize = 1;
else
displacementSize = 0;
} else {
//figure out 32/64 bit displacement size
- if(nextByte & 0xC6 == 0x04 ||
- nextByte & 0xC0 == 0x80)
+ if(modRM.mod == 0 && (modRM.rm == 4 || modRM.rm == 5)
+ || modRM.mod == 2)
displacementSize = 4;
- else if(nextByte & 0xC0 == 0x40)
+ else if(modRM.mod == 1)
displacementSize = 1;
else
displacementSize = 0;
}
//If there's an SIB, get that next.
//There is no SIB in 16 bit mode.
- if(nextByte & 0x7 == 4 &&
- nextByte & 0xC0 != 0xC0) {
+ if(modRM.rm == 4 && modRM.mod != 3) {
// && in 32/64 bit mode)
nextState = SIBState;
} else if(displacementSize) {
@@ -301,6 +300,7 @@ namespace X86ISA
}
//The ModRM byte is consumed no matter what
consumeByte();
+ emi.modRM = modRM;
return nextState;
}