Make use of some of the REX prefix.

--HG--
extra : convert_revision : 948eceb59a1cd9b02ad9355dd5894af0bbec4e83
This commit is contained in:
Gabe Black 2007-06-12 16:47:10 +00:00
parent baf145e0f5
commit 0d8d3f988f

View file

@ -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)