diff options
| author | Christian Krinitsin <mail@krinitsin.com> | 2025-11-03 15:26:52 +0100 |
|---|---|---|
| committer | Christian Krinitsin <mail@krinitsin.com> | 2025-11-03 15:26:52 +0100 |
| commit | 0615ec2d08408abf51729c2cad0c161c2d2de998 (patch) | |
| tree | 65bc45e4d951797fe1040b1716dbbe63bc5704f7 /src | |
| parent | 716d6678a024a2e2db37e2409d1a38bbc865fac2 (diff) | |
| download | focaccia-miasm-ck/x86-movq.tar.gz focaccia-miasm-ck/x86-movq.zip | |
Fix MOVQ instruction ck/x86-movq
Ignore set vex.r bit for 0x0f7e opcode
Diffstat (limited to 'src')
| -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 8f96d32e..1c81443b 100644 --- a/src/miasm/arch/x86/arch.py +++ b/src/miasm/arch/x86/arch.py @@ -932,10 +932,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'] @@ -948,6 +949,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')): @@ -3370,6 +3374,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") @@ -3993,13 +4000,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]) |