about summary refs log tree commit diff stats
path: root/miasm2/arch/x86/sem.py
diff options
context:
space:
mode:
authorVladislav HrĨka <41523109+nofiv@users.noreply.github.com>2019-02-07 22:43:43 +0100
committerserpilliere <serpilliere@users.noreply.github.com>2019-02-07 22:43:43 +0100
commit4c8a61e8baa33cee185ff2b086c7b3094f99824e (patch)
treed7bc7d94031a5b5dde5bf0c3fa1bba696dc8b54a /miasm2/arch/x86/sem.py
parent5cfdeb7ab8d889232044bb93f2505cfb23c4f92f (diff)
downloadmiasm-4c8a61e8baa33cee185ff2b086c7b3094f99824e.tar.gz
miasm-4c8a61e8baa33cee185ff2b086c7b3094f99824e.zip
Support for REP instruction prefix (#956)
* Added function find_path_by_successors

The function find_path_by_successors does the same as function find_path, but it searches the paths from src to dst, not vice versa like find_path, which might be more efficient in some cases.

* Added support for REP instruction prefix

Added support for REP instruction prefix

* Added support for REP instruction prefix

Added support for REP instruction prefix

* Added support for REP prefix

According to https://c9x.me/x86/html/file_module_x86_id_279.html 0xF3AD is REP LODSD and not REPE LODSD

* Added REP instruction prefix support fix

Added REP instruction prefix support fix

* Added REP instruction prefix support fix

Added REP instruction prefix support and REPNZ, REPZ aliases

* Fix of adding REP instruction prefix

Fixing https://github.com/cea-sec/miasm/pull/956#discussion_r253361754. I also put https://github.com/nofiv/miasm/edit/master/miasm2/arch/x86/arch.py#diff-f7dd74dede0a04f194dff140d0976b98L739 behind the loop since it seems to be serving similar purpose.

* Fix of the added REP intruction prefix

Fixing https://github.com/cea-sec/miasm/pull/956#discussion_r253361339

* Discard changes

Creating another PR for this

* Update arch.py
Diffstat (limited to '')
-rw-r--r--miasm2/arch/x86/sem.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/miasm2/arch/x86/sem.py b/miasm2/arch/x86/sem.py
index aa3da43d..794af2be 100644
--- a/miasm2/arch/x86/sem.py
+++ b/miasm2/arch/x86/sem.py
@@ -5679,9 +5679,9 @@ class ir_x86_16(IntermediateRepresentation):
         # end condition
         if zf_val is None:
             c_cond = cond_dec
-        elif instr.additional_info.g1.value & 2:  # REPNE
+        elif instr.additional_info.g1.value & 2:  # REPNE and REPNZ
             c_cond = cond_dec | zf
-        elif instr.additional_info.g1.value & 4:  # REP
+        elif instr.additional_info.g1.value & 12:  # REPE, REP and REPZ
             c_cond = cond_dec | (zf ^ m2_expr.ExprInt(1, 1))
 
         # gen while