diff options
| author | Theofilos Augoustis <37243696+taugoust@users.noreply.github.com> | 2025-11-19 16:18:39 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-19 16:18:39 +0100 |
| commit | 3717f96f2f61739768e5e311ac415e7df95911ff (patch) | |
| tree | 1f159e96397bec306cb9370542dcc54256bbbcd9 | |
| parent | 881537979a1c32cf1d7f4a50921861e0cc8468c2 (diff) | |
| parent | 0615ec2d08408abf51729c2cad0c161c2d2de998 (diff) | |
| download | focaccia-miasm-3717f96f2f61739768e5e311ac415e7df95911ff.tar.gz focaccia-miasm-3717f96f2f61739768e5e311ac415e7df95911ff.zip | |
Fix MOVQ instruction
| -rw-r--r-- | src/miasm/arch/x86/arch.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/miasm/arch/x86/arch.py b/src/miasm/arch/x86/arch.py index 591a682b..b6dd5a99 100644 --- a/src/miasm/arch/x86/arch.py +++ b/src/miasm/arch/x86/arch.py @@ -940,10 +940,11 @@ class mn_x86(cls_mn): return False else: self.rex_w.value = pre_dis_info['rex_w'] - self.rex_r.value = pre_dis_info['rex_r'] self.rex_b.value = pre_dis_info['rex_b'] self.rex_x.value = pre_dis_info['rex_x'] self.rex_p.value = pre_dis_info['rex_p'] + if not (hasattr(self, "ignore_rex_r")): + self.rex_r.value = pre_dis_info['rex_r'] self.vex.value = pre_dis_info['vex'] self.vex_l.value = pre_dis_info['vex_l'] @@ -956,6 +957,9 @@ class mn_x86(cls_mn): self.rex_x.value or self.rex_p.value): return False + if hasattr(self, 'no_rex_w') and self.rex_w.value: + return False + if self.vex.value == 0 and (hasattr(self, 'pref_0f') or hasattr(self, 'pref_0f38') or hasattr(self, 'pref_0f3a')): @@ -3391,6 +3395,9 @@ no_xmm_pref = bs(l=0, fname="no_xmm_pref") no_rex = bs(l=0, fname="no_rex") no_rep = bs(l=0, fname="no_rep") +no_rex_w = bs(l=0, fname="no_rex_w") + +ignore_rex_r = bs(l=0, fname="ignore_rex_r") sib_scale = bs(l=2, cls=(bs_cond_scale,), fname = "sib_scale") sib_index = bs(l=3, cls=(bs_cond_index,), fname = "sib_index") @@ -4017,13 +4024,16 @@ addop("movupd", [bs8(0x0f), bs8(0x10), pref_66] + rmmod(xmm_reg, rm_arg_xmm), [x addop("movupd", [bs8(0x0f), bs8(0x11), pref_66] + rmmod(xmm_reg, rm_arg_xmm), [rm_arg_xmm, xmm_reg]) -addop("movd", [bs8(0x0f), bs('011'), swapargs, bs('1110'), no_xmm_pref] + +addop("movd", [bs8(0x0f), bs('011'), swapargs, bs('1110'), no_xmm_pref, no_rex_w] + rmmod(mm_reg, rm_arg), [mm_reg, rm_arg]) addop("movd", [bs8(0x0f), bs('011'), swapargs, bs('1110'), pref_66, bs_opmode32] + rmmod(xmm_reg, rm_arg), [xmm_reg, rm_arg]) addop("movq", [bs8(0x0f), bs('011'), swapargs, bs('1110'), pref_66, bs_opmode64] + rmmod(xmm_reg, rm_arg), [xmm_reg, rm_arg]) +addop("movq", [bs8(0x0f), bs('011'), swapargs, bs('1110'), no_xmm_pref, bs_opmode64, ignore_rex_r] + + rmmod(mm_reg, rm_arg), [mm_reg, rm_arg]) + addop("movq", [bs8(0x0f), bs('011'), swapargs, bs('1111'), no_xmm_pref] + rmmod(mm_reg, rm_arg_mm_m64), [mm_reg, rm_arg_mm_m64]) |