From c2d60abf52fc81119970ab0617f9a979f1377685 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Tue, 2 Oct 2007 23:02:18 -0700 Subject: X86: Distinguish between the rep and repe prefixes. STOS and MOVS only accept the rep prefix which always loops until rcx becomes 0. The other string instructions accept repe (same encoding as rep) and repne which also check the condition code flags each iteration. --HG-- extra : convert_revision : 544149f640302070810fb53e53bfeb0e87160ffc --- src/arch/x86/isa/formats/string.isa | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'src/arch/x86/isa/formats') diff --git a/src/arch/x86/isa/formats/string.isa b/src/arch/x86/isa/formats/string.isa index cd182ff62..b1d3c4bbe 100644 --- a/src/arch/x86/isa/formats/string.isa +++ b/src/arch/x86/isa/formats/string.isa @@ -61,7 +61,7 @@ // ////////////////////////////////////////////////////////////////////////// -def format StringInst(*opTypeSet) {{ +def format StringTestInst(*opTypeSet) {{ allBlocks = OutputBlocks() regBlocks = specializeInst(Name, list(opTypeSet), EmulEnv()) @@ -86,3 +86,29 @@ def format StringInst(*opTypeSet) {{ (header_output, decoder_output, decode_block, exec_output) = allBlocks.makeList() }}; + +def format StringInst(*opTypeSet) {{ + allBlocks = OutputBlocks() + + regBlocks = specializeInst(Name, list(opTypeSet), EmulEnv()) + eBlocks = specializeInst(Name + "_E", list(opTypeSet), EmulEnv()) + + for blocks in (regBlocks, eBlocks): + allBlocks.header_output += blocks.header_output + allBlocks.decoder_output += blocks.decoder_output + allBlocks.exec_output += blocks.exec_output + + allBlocks.decode_block = ''' + if (LEGACY_REP) { + %s + } else if (LEGACY_REPNE) { + // The repne prefix is illegal + return new MicroFault(machInst, "illprefix", new InvalidOpcode); + } else { + %s + } + ''' % (eBlocks.decode_block, regBlocks.decode_block) + + (header_output, decoder_output, + decode_block, exec_output) = allBlocks.makeList() +}}; -- cgit v1.2.3