summaryrefslogtreecommitdiff
path: root/src/arch/x86/predecoder.cc
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2007-06-20 15:02:50 +0000
committerGabe Black <gblack@eecs.umich.edu>2007-06-20 15:02:50 +0000
commita68ddf685c739220d09fdc44000dd217d0707f8e (patch)
tree5026458b55d8032a56b52bba3dc35a4281e540c7 /src/arch/x86/predecoder.cc
parentd2ccf5e50917701a4eab9f1848c8d524ccf0c7cc (diff)
downloadgem5-a68ddf685c739220d09fdc44000dd217d0707f8e.tar.xz
Make memory instructions work better, add more macroop implementations, add an lea microop, move EmulEnv into it's own .cc and .hh.
--HG-- extra : convert_revision : 1212b8463eab1c1dcba7182c487d1e9184cf9bea
Diffstat (limited to 'src/arch/x86/predecoder.cc')
-rw-r--r--src/arch/x86/predecoder.cc17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/arch/x86/predecoder.cc b/src/arch/x86/predecoder.cc
index 3ed18aeb2..bbbad7dd0 100644
--- a/src/arch/x86/predecoder.cc
+++ b/src/arch/x86/predecoder.cc
@@ -264,31 +264,29 @@ 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.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 +299,7 @@ namespace X86ISA
}
//The ModRM byte is consumed no matter what
consumeByte();
+ emi.modRM = modRM;
return nextState;
}