about summary refs log tree commit diff stats
path: root/miasm2
diff options
context:
space:
mode:
Diffstat (limited to 'miasm2')
-rw-r--r--miasm2/arch/x86/sem.py11
-rw-r--r--miasm2/jitter/jitload.py4
2 files changed, 6 insertions, 9 deletions
diff --git a/miasm2/arch/x86/sem.py b/miasm2/arch/x86/sem.py
index 46302de3..781b3321 100644
--- a/miasm2/arch/x86/sem.py
+++ b/miasm2/arch/x86/sem.py
@@ -3377,17 +3377,14 @@ class ir_x86_16(ir):
             if e.dst == zf:
                 zf_val = e.src
 
+        cond_dec = ExprCond(c_reg - ExprInt_from(c_reg, 1), ExprInt1(0), ExprInt1(1))
         # end condition
         if zf_val is None:
-            c_cond = ExprCond(c_reg, ExprInt1(0), ExprInt1(1))
+            c_cond = cond_dec
         elif instr.additional_info.g1.value & 2:  # REPNE
-            # c_cond = ExprCond(c_reg, ExprInt1(0), ExprInt1(1)) | (zf_val)
-            c_cond = ExprCond(c_reg, ExprInt1(0), ExprInt1(1)) | (zf)
+            c_cond = cond_dec | zf
         elif instr.additional_info.g1.value & 4:  # REP
-            # c_cond = ExprCond(c_reg, ExprInt1(0), ExprInt1(1)) |
-            # (zf_val^ExprInt32(1))
-            c_cond = ExprCond(
-                c_reg, ExprInt1(0), ExprInt1(1)) | (zf ^ ExprInt1(1))
+            c_cond = cond_dec | (zf ^ ExprInt1(1))
 
         # gen while
         lbl_do = ExprId(self.gen_label(), instr.mode)
diff --git a/miasm2/jitter/jitload.py b/miasm2/jitter/jitload.py
index 285c41dd..6ff9f0f8 100644
--- a/miasm2/jitter/jitload.py
+++ b/miasm2/jitter/jitload.py
@@ -348,8 +348,8 @@ def vm_load_pe(vm, fname, align_s=True, load_hdr=True,
 
     if aligned:
         if load_hdr:
-            hdr_len = max(0x200, e.NThdr.sectionalignment)
-            min_len = min(e.SHList[0].addr, hdr_len)
+            hdr_len = max(0x200, e.NThdr.sizeofheaders)
+            min_len = min(e.SHList[0].addr, 0x1000)#e.NThdr.sizeofheaders)
             pe_hdr = e.content[:hdr_len]
             pe_hdr = pe_hdr + min_len * "\x00"
             pe_hdr = pe_hdr[:min_len]