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):
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.
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)