X86: When decoding a memory only inst, fault on reg encodings, don't assert.
This change makes the decoder figure out if an instruction that only supports memory is using a register encoding and decodes directly to "Unknown" which will behave appropriately. This prevents other parts of the instruction creation process from seeing the mismatch and asserting.
This commit is contained in:
parent
a7e27f9a82
commit
0554885eb9
1 changed files with 12 additions and 1 deletions
|
@ -95,6 +95,15 @@ let {{
|
||||||
return blocks
|
return blocks
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
let {{
|
||||||
|
def doBadInstDecode():
|
||||||
|
blocks = OutputBlocks()
|
||||||
|
blocks.decode_block = '''
|
||||||
|
return new Unknown(machInst);
|
||||||
|
'''
|
||||||
|
return blocks
|
||||||
|
}};
|
||||||
|
|
||||||
let {{
|
let {{
|
||||||
class OpType(object):
|
class OpType(object):
|
||||||
parser = re.compile(r"(?P<tag>[A-Z]+)(?P<size>[a-z]*)|(r(?P<reg>[A-Z0-9]+)(?P<rsize>[a-z]*))")
|
parser = re.compile(r"(?P<tag>[A-Z]+)(?P<size>[a-z]*)|(r(?P<reg>[A-Z0-9]+)(?P<rsize>[a-z]*))")
|
||||||
|
@ -146,7 +155,9 @@ let {{
|
||||||
# This refers to memory. The macroop constructor sets up modrm
|
# This refers to memory. The macroop constructor sets up modrm
|
||||||
# addressing. Non memory modrm settings should cause an error.
|
# addressing. Non memory modrm settings should cause an error.
|
||||||
env.doModRM = True
|
env.doModRM = True
|
||||||
return doRipRelativeDecode(Name, opTypes, env)
|
return doSplitDecode("MODRM_MOD",
|
||||||
|
{"3" : (doBadInstDecode,) },
|
||||||
|
(doRipRelativeDecode, Name, opTypes, env))
|
||||||
elif opType.tag == None or opType.size == None:
|
elif opType.tag == None or opType.size == None:
|
||||||
raise Exception, "Problem parsing operand tag: %s" % opType.tag
|
raise Exception, "Problem parsing operand tag: %s" % opType.tag
|
||||||
elif opType.tag == "C":
|
elif opType.tag == "C":
|
||||||
|
|
Loading…
Reference in a new issue