From 0554885eb941d547eca3400566fb9636599c1b39 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Sat, 23 Apr 2011 15:02:29 -0700 Subject: 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. --- src/arch/x86/isa/specialize.isa | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/arch/x86/isa/specialize.isa') diff --git a/src/arch/x86/isa/specialize.isa b/src/arch/x86/isa/specialize.isa index 779abefc7..5a21c0944 100644 --- a/src/arch/x86/isa/specialize.isa +++ b/src/arch/x86/isa/specialize.isa @@ -95,6 +95,15 @@ let {{ return blocks }}; +let {{ + def doBadInstDecode(): + blocks = OutputBlocks() + blocks.decode_block = ''' + return new Unknown(machInst); + ''' + return blocks +}}; + let {{ class OpType(object): parser = re.compile(r"(?P[A-Z]+)(?P[a-z]*)|(r(?P[A-Z0-9]+)(?P[a-z]*))") @@ -146,7 +155,9 @@ let {{ # This refers to memory. The macroop constructor sets up modrm # addressing. Non memory modrm settings should cause an error. 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: raise Exception, "Problem parsing operand tag: %s" % opType.tag elif opType.tag == "C": -- cgit v1.2.3