diff options
author | Gabe Black <gblack@eecs.umich.edu> | 2007-10-02 23:02:18 -0700 |
---|---|---|
committer | Gabe Black <gblack@eecs.umich.edu> | 2007-10-02 23:02:18 -0700 |
commit | c2d60abf52fc81119970ab0617f9a979f1377685 (patch) | |
tree | 3178cee596202e84daa8811dc11f29d03ca6e7ad /src/arch/x86/isa/formats | |
parent | 504f90f76350ce14debfbfa837423144b0abdbe4 (diff) | |
download | gem5-c2d60abf52fc81119970ab0617f9a979f1377685.tar.xz |
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
Diffstat (limited to 'src/arch/x86/isa/formats')
-rw-r--r-- | src/arch/x86/isa/formats/string.isa | 28 |
1 files changed, 27 insertions, 1 deletions
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() +}}; |