summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/arch/x86/isa/specialize.isa9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/arch/x86/isa/specialize.isa b/src/arch/x86/isa/specialize.isa
index 3b4e09daa..fe3730b77 100644
--- a/src/arch/x86/isa/specialize.isa
+++ b/src/arch/x86/isa/specialize.isa
@@ -95,6 +95,9 @@ let {{
self.size = match.group("size")
self.rsize = match.group("rsize")
+ ModRMRegIndex = "(MODRM_REG | (REX_R << 3))"
+ ModRMRMIndex = "(MODRM_RM | (REX_B << 3))"
+
# This function specializes the given piece of code to use a particular
# set of argument types described by "opTypes".
def specializeInst(Name, opTypes, env):
@@ -121,14 +124,14 @@ let {{
raise Exception, "Problem parsing operand tag: %s" % opType.tag
elif opType.tag in ("C", "D", "G", "P", "S", "T", "V"):
# Use the "reg" field of the ModRM byte to select the register
- env.addReg("(uint8_t)MODRM_REG")
+ env.addReg(ModRMRegIndex)
elif opType.tag in ("E", "Q", "W"):
# This might refer to memory or to a register. We need to
# divide it up farther.
regTypes = copy.copy(opTypes)
regTypes.pop(0)
regEnv = copy.copy(env)
- regEnv.addReg("(uint8_t)MODRM_RM")
+ regEnv.addReg(ModRMRMIndex)
# This needs to refer to memory, but we'll fill in the details
# later. It needs to take into account unaligned memory
# addresses.
@@ -149,7 +152,7 @@ let {{
elif opType.tag in ("PR", "R", "VR"):
# There should probably be a check here to verify that mod
# is equal to 11b
- env.addReg("(uint8_t)MODRM_RM")
+ env.addReg(ModRMRMIndex)
else:
raise Exception, "Unrecognized tag %s." % opType.tag
opTypes.pop(0)