changeset 833e487aa8f7 in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=833e487aa8f7
description:
X86: Respect segment override prefixes even when there's no ModRM byte.
diffstat:
3 files changed, 16 insertions(+), 4 deletions(-)
src/arch/x86/emulenv.cc | 8 ++++++++
src/arch/x86/emulenv.hh | 1 +
src/arch/x86/isa/macroop.isa | 11 +++++++----
diffs (75 lines):
diff -r 71f8d7c12619 -r 833e487aa8f7 src/arch/x86/emulenv.cc
--- a/src/arch/x86/emulenv.cc Fri Feb 27 09:23:50 2009 -0800
+++ b/src/arch/x86/emulenv.cc Fri Feb 27 09:23:58 2009 -0800
@@ -105,3 +105,11 @@
}
}
+void EmulEnv::setSeg(const ExtMachInst & machInst)
+{
+ seg = SEGMENT_REG_DS;
+ //Handle any segment override that might have been in the instruction
+ int segFromInst = machInst.legacy.seg;
+ if (segFromInst)
+ seg = (SegmentRegIndex)(segFromInst - 1);
+}
diff -r 71f8d7c12619 -r 833e487aa8f7 src/arch/x86/emulenv.hh
--- a/src/arch/x86/emulenv.hh Fri Feb 27 09:23:50 2009 -0800
+++ b/src/arch/x86/emulenv.hh Fri Feb 27 09:23:58 2009 -0800
@@ -86,6 +86,7 @@
{;}
void doModRM(const ExtMachInst & machInst);
+ void setSeg(const ExtMachInst & machInst);
};
};
diff -r 71f8d7c12619 -r 833e487aa8f7 src/arch/x86/isa/macroop.isa
--- a/src/arch/x86/isa/macroop.isa Fri Feb 27 09:23:50 2009 -0800
+++ b/src/arch/x86/isa/macroop.isa Fri Feb 27 09:23:58 2009 -0800
@@ -135,7 +135,7 @@
%(adjust_env)s;
%(adjust_imm)s;
%(adjust_disp)s;
- %(do_modrm)s;
+ %(init_env)s;
%(constructor)s;
const char *macrocodeBlock = "%(class_name)s";
//alloc_microops is the code that sets up the microops
@@ -166,7 +166,7 @@
}
self.declared = False
self.adjust_env = ""
- self.doModRM = ""
+ self.init_env = ""
self.adjust_imm = '''
uint64_t adjustedImm = IMMEDIATE;
//This is to pacify gcc in case the immediate isn't used.
@@ -228,7 +228,7 @@
"adjust_disp" : self.adjust_disp,
"disassembly" : env.disassembly,
"regSize" : regSize,
- "do_modrm" : self.doModRM})
+ "init_env" : self.initEnv})
return MacroConstructor.subst(iop) + \
MacroDisassembly.subst(iop);
}};
@@ -304,6 +304,7 @@
let {{
doModRMString = "env.doModRM(machInst);\n"
+ noModRMString = "env.setSeg(machInst);\n"
def genMacroop(Name, env):
blocks = OutputBlocks()
if not macroopDict.has_key(Name):
@@ -311,7 +312,9 @@
macroop = macroopDict[Name]
if not macroop.declared:
if env.doModRM:
- macroop.doModRM = doModRMString
+ macroop.initEnv = doModRMString
+ else:
+ macroop.initEnv = noModRMString
blocks.header_output = macroop.getDeclaration()
blocks.decoder_output = macroop.getDefinition(env)
macroop.declared = True
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev