OLD | NEW |
1 # Copyright (c) 2014 The Native Client Authors. All rights reserved. | 1 # Copyright (c) 2014 The Native Client Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Templates for grouping together similar proofs.""" | 5 """Templates for grouping together similar proofs.""" |
6 | 6 |
7 import proof_tools | 7 import proof_tools |
8 | 8 |
9 | 9 |
10 def LockedRegWithRegOrMem16bit(mnemonic_name, bitness): | 10 def LockedRegWithRegOrMem16bit(mnemonic_name, bitness): |
(...skipping 13 matching lines...) Expand all Loading... |
24 Returns: | 24 Returns: |
25 All possible disassembly sequences that follow the pattern. | 25 All possible disassembly sequences that follow the pattern. |
26 """ | 26 """ |
27 assert bitness in (32, 64) | 27 assert bitness in (32, 64) |
28 instr = proof_tools.MnemonicOp(mnemonic_name) | 28 instr = proof_tools.MnemonicOp(mnemonic_name) |
29 reg16 = proof_tools.GprOperands(bitness=bitness, operand_size=16) | 29 reg16 = proof_tools.GprOperands(bitness=bitness, operand_size=16) |
30 mem = proof_tools.AllMemoryOperands(bitness=bitness) | 30 mem = proof_tools.AllMemoryOperands(bitness=bitness) |
31 lock = proof_tools.LockPrefix() | 31 lock = proof_tools.LockPrefix() |
32 return (proof_tools.OpsProd(lock, instr, reg16, mem) | | 32 return (proof_tools.OpsProd(lock, instr, reg16, mem) | |
33 proof_tools.OpsProd(instr, reg16, reg16 | mem)) | 33 proof_tools.OpsProd(instr, reg16, reg16 | mem)) |
| 34 |
| 35 |
| 36 def XmmYmmOrMemory3operand(mnemonic_name, bitness): |
| 37 """Set of 3 operand xmm/ymm/memory ops (memory is a possible source operand). |
| 38 |
| 39 e.g. |
| 40 |
| 41 instr xmm1/mem, xmm2, xmm3 |
| 42 or |
| 43 instr ymm1/mem, ymm2, ymm3 |
| 44 |
| 45 Args: |
| 46 mnemonic_name: the mnemonic we are producing the pattern for. |
| 47 bitness: the bitness of the architecture (32 or 64) |
| 48 Returns: |
| 49 All possible disassembly sequences that follow the pattern. |
| 50 """ |
| 51 xmm = proof_tools.AllXMMOperands(bitness) |
| 52 ymm = proof_tools.AllYMMOperands(bitness) |
| 53 mem = proof_tools.AllMemoryOperands(bitness) |
| 54 mnemonic = proof_tools.MnemonicOp(mnemonic_name) |
| 55 |
| 56 return (proof_tools.OpsProd(mnemonic, (xmm | mem), xmm, xmm) | |
| 57 proof_tools.OpsProd(mnemonic, (ymm | mem), ymm, ymm)) |
OLD | NEW |