From 4e1b8c49f96a9435bfc45b0d110cdbf64558f365 Mon Sep 17 00:00:00 2001 From: Ammar <11852302+abenkhadra@users.noreply.github.com> Date: Tue, 18 Dec 2018 16:22:30 +0100 Subject: [PATCH] x86: correct access mode for cmp instruction (#1309) cmp instruction does not modify its operands. Currently, cmp variants that accept a memory operand have CS_AC_WRITE access mode set. This commit removes CS_AC_WRITE mode from cmp variants that have it. --- arch/X86/X86MappingInsnOp.inc | 18 +++++++++--------- arch/X86/X86MappingInsnOp_reduce.inc | 24 ++++++++++++------------ 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/arch/X86/X86MappingInsnOp.inc b/arch/X86/X86MappingInsnOp.inc index d4ed1fd87..defb370fb 100644 --- a/arch/X86/X86MappingInsnOp.inc +++ b/arch/X86/X86MappingInsnOp.inc @@ -1691,15 +1691,15 @@ }, { /* X86_CMP16mi, X86_INS_CMP: cmp{w} $dst, $src */ X86_EFLAGS_MODIFY_OF | X86_EFLAGS_MODIFY_SF | X86_EFLAGS_MODIFY_ZF | X86_EFLAGS_MODIFY_AF | X86_EFLAGS_MODIFY_PF | X86_EFLAGS_MODIFY_CF, - { CS_AC_READ | CS_AC_WRITE, CS_AC_IGNORE, 0 } + { CS_AC_READ, CS_AC_IGNORE, 0 } }, { /* X86_CMP16mi8, X86_INS_CMP: cmp{w} $dst, $src */ X86_EFLAGS_MODIFY_OF | X86_EFLAGS_MODIFY_SF | X86_EFLAGS_MODIFY_ZF | X86_EFLAGS_MODIFY_AF | X86_EFLAGS_MODIFY_PF | X86_EFLAGS_MODIFY_CF, - { CS_AC_READ | CS_AC_WRITE, CS_AC_IGNORE, 0 } + { CS_AC_READ, CS_AC_IGNORE, 0 } }, { /* X86_CMP16mr, X86_INS_CMP: cmp{w} $dst, $src */ X86_EFLAGS_MODIFY_OF | X86_EFLAGS_MODIFY_SF | X86_EFLAGS_MODIFY_ZF | X86_EFLAGS_MODIFY_AF | X86_EFLAGS_MODIFY_PF | X86_EFLAGS_MODIFY_CF, - { CS_AC_READ | CS_AC_WRITE, CS_AC_READ, 0 } + { CS_AC_READ, CS_AC_READ, 0 } }, { /* X86_CMP16ri, X86_INS_CMP: cmp{w} $src1, $src2 */ X86_EFLAGS_MODIFY_OF | X86_EFLAGS_MODIFY_SF | X86_EFLAGS_MODIFY_ZF | X86_EFLAGS_MODIFY_AF | X86_EFLAGS_MODIFY_PF | X86_EFLAGS_MODIFY_CF, @@ -1727,15 +1727,15 @@ }, { /* X86_CMP32mi, X86_INS_CMP: cmp{l} $dst, $src */ X86_EFLAGS_MODIFY_OF | X86_EFLAGS_MODIFY_SF | X86_EFLAGS_MODIFY_ZF | X86_EFLAGS_MODIFY_AF | X86_EFLAGS_MODIFY_PF | X86_EFLAGS_MODIFY_CF, - { CS_AC_READ | CS_AC_WRITE, CS_AC_IGNORE, 0 } + { CS_AC_READ, CS_AC_IGNORE, 0 } }, { /* X86_CMP32mi8, X86_INS_CMP: cmp{l} $dst, $src */ X86_EFLAGS_MODIFY_OF | X86_EFLAGS_MODIFY_SF | X86_EFLAGS_MODIFY_ZF | X86_EFLAGS_MODIFY_AF | X86_EFLAGS_MODIFY_PF | X86_EFLAGS_MODIFY_CF, - { CS_AC_READ | CS_AC_WRITE, CS_AC_IGNORE, 0 } + { CS_AC_READ, CS_AC_IGNORE, 0 } }, { /* X86_CMP32mr, X86_INS_CMP: cmp{l} $dst, $src */ X86_EFLAGS_MODIFY_OF | X86_EFLAGS_MODIFY_SF | X86_EFLAGS_MODIFY_ZF | X86_EFLAGS_MODIFY_AF | X86_EFLAGS_MODIFY_PF | X86_EFLAGS_MODIFY_CF, - { CS_AC_READ | CS_AC_WRITE, CS_AC_READ, 0 } + { CS_AC_READ, CS_AC_READ, 0 } }, { /* X86_CMP32ri, X86_INS_CMP: cmp{l} $src1, $src2 */ X86_EFLAGS_MODIFY_OF | X86_EFLAGS_MODIFY_SF | X86_EFLAGS_MODIFY_ZF | X86_EFLAGS_MODIFY_AF | X86_EFLAGS_MODIFY_PF | X86_EFLAGS_MODIFY_CF, @@ -1763,15 +1763,15 @@ }, { /* X86_CMP64mi32, X86_INS_CMP: cmp{q} $dst, $src */ X86_EFLAGS_MODIFY_OF | X86_EFLAGS_MODIFY_SF | X86_EFLAGS_MODIFY_ZF | X86_EFLAGS_MODIFY_AF | X86_EFLAGS_MODIFY_PF | X86_EFLAGS_MODIFY_CF, - { CS_AC_READ | CS_AC_WRITE, CS_AC_IGNORE, 0 } + { CS_AC_READ, CS_AC_IGNORE, 0 } }, { /* X86_CMP64mi8, X86_INS_CMP: cmp{q} $dst, $src */ X86_EFLAGS_MODIFY_OF | X86_EFLAGS_MODIFY_SF | X86_EFLAGS_MODIFY_ZF | X86_EFLAGS_MODIFY_AF | X86_EFLAGS_MODIFY_PF | X86_EFLAGS_MODIFY_CF, - { CS_AC_READ | CS_AC_WRITE, CS_AC_IGNORE, 0 } + { CS_AC_READ, CS_AC_IGNORE, 0 } }, { /* X86_CMP64mr, X86_INS_CMP: cmp{q} $dst, $src */ X86_EFLAGS_MODIFY_OF | X86_EFLAGS_MODIFY_SF | X86_EFLAGS_MODIFY_ZF | X86_EFLAGS_MODIFY_AF | X86_EFLAGS_MODIFY_PF | X86_EFLAGS_MODIFY_CF, - { CS_AC_READ | CS_AC_WRITE, CS_AC_READ, 0 } + { CS_AC_READ, CS_AC_READ, 0 } }, { /* X86_CMP64ri32, X86_INS_CMP: cmp{q} $src1, $src2 */ X86_EFLAGS_MODIFY_OF | X86_EFLAGS_MODIFY_SF | X86_EFLAGS_MODIFY_ZF | X86_EFLAGS_MODIFY_AF | X86_EFLAGS_MODIFY_PF | X86_EFLAGS_MODIFY_CF, diff --git a/arch/X86/X86MappingInsnOp_reduce.inc b/arch/X86/X86MappingInsnOp_reduce.inc index 311a9ffa7..5b48b254f 100644 --- a/arch/X86/X86MappingInsnOp_reduce.inc +++ b/arch/X86/X86MappingInsnOp_reduce.inc @@ -1443,15 +1443,15 @@ }, { /* X86_CMP16mi, X86_INS_CMP: cmp{w} $dst, $src */ X86_EFLAGS_MODIFY_OF | X86_EFLAGS_MODIFY_SF | X86_EFLAGS_MODIFY_ZF | X86_EFLAGS_MODIFY_AF | X86_EFLAGS_MODIFY_PF | X86_EFLAGS_MODIFY_CF, - { CS_AC_READ | CS_AC_WRITE, CS_AC_IGNORE, 0 } + { CS_AC_READ, CS_AC_IGNORE, 0 } }, { /* X86_CMP16mi8, X86_INS_CMP: cmp{w} $dst, $src */ X86_EFLAGS_MODIFY_OF | X86_EFLAGS_MODIFY_SF | X86_EFLAGS_MODIFY_ZF | X86_EFLAGS_MODIFY_AF | X86_EFLAGS_MODIFY_PF | X86_EFLAGS_MODIFY_CF, - { CS_AC_READ | CS_AC_WRITE, CS_AC_IGNORE, 0 } + { CS_AC_READ, CS_AC_IGNORE, 0 } }, { /* X86_CMP16mr, X86_INS_CMP: cmp{w} $dst, $src */ X86_EFLAGS_MODIFY_OF | X86_EFLAGS_MODIFY_SF | X86_EFLAGS_MODIFY_ZF | X86_EFLAGS_MODIFY_AF | X86_EFLAGS_MODIFY_PF | X86_EFLAGS_MODIFY_CF, - { CS_AC_READ | CS_AC_WRITE, CS_AC_READ, 0 } + { CS_AC_READ, CS_AC_READ, 0 } }, { /* X86_CMP16ri, X86_INS_CMP: cmp{w} $src1, $src2 */ X86_EFLAGS_MODIFY_OF | X86_EFLAGS_MODIFY_SF | X86_EFLAGS_MODIFY_ZF | X86_EFLAGS_MODIFY_AF | X86_EFLAGS_MODIFY_PF | X86_EFLAGS_MODIFY_CF, @@ -1479,15 +1479,15 @@ }, { /* X86_CMP32mi, X86_INS_CMP: cmp{l} $dst, $src */ X86_EFLAGS_MODIFY_OF | X86_EFLAGS_MODIFY_SF | X86_EFLAGS_MODIFY_ZF | X86_EFLAGS_MODIFY_AF | X86_EFLAGS_MODIFY_PF | X86_EFLAGS_MODIFY_CF, - { CS_AC_READ | CS_AC_WRITE, CS_AC_IGNORE, 0 } + { CS_AC_READ, CS_AC_IGNORE, 0 } }, { /* X86_CMP32mi8, X86_INS_CMP: cmp{l} $dst, $src */ X86_EFLAGS_MODIFY_OF | X86_EFLAGS_MODIFY_SF | X86_EFLAGS_MODIFY_ZF | X86_EFLAGS_MODIFY_AF | X86_EFLAGS_MODIFY_PF | X86_EFLAGS_MODIFY_CF, - { CS_AC_READ | CS_AC_WRITE, CS_AC_IGNORE, 0 } + { CS_AC_READ, CS_AC_IGNORE, 0 } }, { /* X86_CMP32mr, X86_INS_CMP: cmp{l} $dst, $src */ X86_EFLAGS_MODIFY_OF | X86_EFLAGS_MODIFY_SF | X86_EFLAGS_MODIFY_ZF | X86_EFLAGS_MODIFY_AF | X86_EFLAGS_MODIFY_PF | X86_EFLAGS_MODIFY_CF, - { CS_AC_READ | CS_AC_WRITE, CS_AC_READ, 0 } + { CS_AC_READ, CS_AC_READ, 0 } }, { /* X86_CMP32ri, X86_INS_CMP: cmp{l} $src1, $src2 */ X86_EFLAGS_MODIFY_OF | X86_EFLAGS_MODIFY_SF | X86_EFLAGS_MODIFY_ZF | X86_EFLAGS_MODIFY_AF | X86_EFLAGS_MODIFY_PF | X86_EFLAGS_MODIFY_CF, @@ -1515,15 +1515,15 @@ }, { /* X86_CMP64mi32, X86_INS_CMP: cmp{q} $dst, $src */ X86_EFLAGS_MODIFY_OF | X86_EFLAGS_MODIFY_SF | X86_EFLAGS_MODIFY_ZF | X86_EFLAGS_MODIFY_AF | X86_EFLAGS_MODIFY_PF | X86_EFLAGS_MODIFY_CF, - { CS_AC_READ | CS_AC_WRITE, CS_AC_IGNORE, 0 } + { CS_AC_READ, CS_AC_IGNORE, 0 } }, { /* X86_CMP64mi8, X86_INS_CMP: cmp{q} $dst, $src */ X86_EFLAGS_MODIFY_OF | X86_EFLAGS_MODIFY_SF | X86_EFLAGS_MODIFY_ZF | X86_EFLAGS_MODIFY_AF | X86_EFLAGS_MODIFY_PF | X86_EFLAGS_MODIFY_CF, - { CS_AC_READ | CS_AC_WRITE, CS_AC_IGNORE, 0 } + { CS_AC_READ, CS_AC_IGNORE, 0 } }, { /* X86_CMP64mr, X86_INS_CMP: cmp{q} $dst, $src */ X86_EFLAGS_MODIFY_OF | X86_EFLAGS_MODIFY_SF | X86_EFLAGS_MODIFY_ZF | X86_EFLAGS_MODIFY_AF | X86_EFLAGS_MODIFY_PF | X86_EFLAGS_MODIFY_CF, - { CS_AC_READ | CS_AC_WRITE, CS_AC_READ, 0 } + { CS_AC_READ, CS_AC_READ, 0 } }, { /* X86_CMP64ri32, X86_INS_CMP: cmp{q} $src1, $src2 */ X86_EFLAGS_MODIFY_OF | X86_EFLAGS_MODIFY_SF | X86_EFLAGS_MODIFY_ZF | X86_EFLAGS_MODIFY_AF | X86_EFLAGS_MODIFY_PF | X86_EFLAGS_MODIFY_CF, @@ -1551,15 +1551,15 @@ }, { /* X86_CMP8mi, X86_INS_CMP: cmp{b} $dst, $src */ X86_EFLAGS_MODIFY_OF | X86_EFLAGS_MODIFY_SF | X86_EFLAGS_MODIFY_ZF | X86_EFLAGS_MODIFY_AF | X86_EFLAGS_MODIFY_PF | X86_EFLAGS_MODIFY_CF, - { CS_AC_READ | CS_AC_WRITE, CS_AC_IGNORE, 0 } + { CS_AC_READ, CS_AC_IGNORE, 0 } }, { /* X86_CMP8mi8, X86_INS_CMP: cmp{b} $dst, $src */ X86_EFLAGS_MODIFY_OF | X86_EFLAGS_MODIFY_SF | X86_EFLAGS_MODIFY_ZF | X86_EFLAGS_MODIFY_AF | X86_EFLAGS_MODIFY_PF | X86_EFLAGS_MODIFY_CF, - { CS_AC_READ | CS_AC_WRITE, CS_AC_IGNORE, 0 } + { CS_AC_READ, CS_AC_IGNORE, 0 } }, { /* X86_CMP8mr, X86_INS_CMP: cmp{b} $dst, $src */ X86_EFLAGS_MODIFY_OF | X86_EFLAGS_MODIFY_SF | X86_EFLAGS_MODIFY_ZF | X86_EFLAGS_MODIFY_AF | X86_EFLAGS_MODIFY_PF | X86_EFLAGS_MODIFY_CF, - { CS_AC_READ | CS_AC_WRITE, CS_AC_READ, 0 } + { CS_AC_READ, CS_AC_READ, 0 } }, { /* X86_CMP8ri, X86_INS_CMP: cmp{b} $src1, $src2 */ X86_EFLAGS_MODIFY_OF | X86_EFLAGS_MODIFY_SF | X86_EFLAGS_MODIFY_ZF | X86_EFLAGS_MODIFY_AF | X86_EFLAGS_MODIFY_PF | X86_EFLAGS_MODIFY_CF,