summaryrefslogtreecommitdiff
path: root/src/arch/x86/emulenv.cc
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2007-07-19 15:15:47 -0700
committerGabe Black <gblack@eecs.umich.edu>2007-07-19 15:15:47 -0700
commitcfadef74d1d7ce47d0bd30a14a509a15a354849a (patch)
treedc6329821c2cf83843b4a3a03bbc26c619ea6a98 /src/arch/x86/emulenv.cc
parent09f056a1ef324b540818f1d85377fb09af44a0f1 (diff)
downloadgem5-cfadef74d1d7ce47d0bd30a14a509a15a354849a.tar.xz
x86 fixes
Make the emulation environment consider the rex prefix. Implement and hook in forms of j, jmp, cmp, syscall, movzx Added a format for an instruction to carry a call to the SE mode syscalls system Made memory instructions which refer to the rip do so directly Made the operand size overridable in the microassembly Made the "ext" field of register operations 16 bits to hold a sparse encoding of flags to set or conditions to predicate on Added an explicit "rax" operand for the syscall format Implemented syscall returns. --HG-- extra : convert_revision : ae84bd8c6a1d400906e17e8b8c4185f2ebd4c5f2
Diffstat (limited to 'src/arch/x86/emulenv.cc')
-rw-r--r--src/arch/x86/emulenv.cc12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/arch/x86/emulenv.cc b/src/arch/x86/emulenv.cc
index e3f703cff..3a54d7365 100644
--- a/src/arch/x86/emulenv.cc
+++ b/src/arch/x86/emulenv.cc
@@ -66,8 +66,8 @@ void EmulEnv::doModRM(const ExtMachInst & machInst)
//Use the SIB byte for addressing if the modrm byte calls for it.
if (machInst.modRM.rm == 4 && machInst.addrSize != 2) {
scale = 1 << machInst.sib.scale;
- index = machInst.sib.index;
- base = machInst.sib.base;
+ index = machInst.sib.index | (machInst.rex.x << 3);
+ base = machInst.sib.base | (machInst.rex.b << 3);
//In this special case, we don't use a base. The displacement also
//changes, but that's managed by the predecoder.
if (machInst.sib.base == INTREG_RBP && machInst.modRM.mod == 0)
@@ -80,11 +80,13 @@ void EmulEnv::doModRM(const ExtMachInst & machInst)
warn("I'm not really using 16 bit MODRM like I'm supposed to!\n");
} else {
scale = 0;
- base = machInst.modRM.rm;
+ base = machInst.modRM.rm | (machInst.rex.b << 3);
if (machInst.modRM.mod == 0 && machInst.modRM.rm == 5) {
base = NUM_INTREGS;
- if (machInst.mode.submode == SixtyFourBitMode)
- base = NUM_INTREGS+7;
+ //Since we need to use a different encoding of this
+ //instruction anyway, just ignore the base in those cases
+// if (machInst.mode.submode == SixtyFourBitMode)
+// base = NUM_INTREGS+7;
}
}
}