Skip to content

Commit

Permalink
Fix 2572 - AArch64 stur/ldur memory access info
Browse files Browse the repository at this point in the history
  • Loading branch information
Rot127 committed Dec 6, 2024
1 parent 0a29bf8 commit c51ffd4
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 36 deletions.
72 changes: 36 additions & 36 deletions arch/AArch64/AArch64GenCSMappingInsn.inc
Original file line number Diff line number Diff line change
Expand Up @@ -32598,63 +32598,63 @@
/* ldapurb $Rt, [$Rn, $offset] */
AArch64_LDAPURBi /* 4254 */, AARCH64_INS_LDAPURB,
#ifndef CAPSTONE_DIET
{ 0 }, { 0 }, { AARCH64_FEATURE_HASRCPC_IMMO, 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_INVALID }}
{ 0 }, { 0 }, { AARCH64_FEATURE_HASRCPC_IMMO, 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_READ }}

#endif
},
{
/* ldapurh $Rt, [$Rn, $offset] */
AArch64_LDAPURHi /* 4255 */, AARCH64_INS_LDAPURH,
#ifndef CAPSTONE_DIET
{ 0 }, { 0 }, { AARCH64_FEATURE_HASRCPC_IMMO, 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_INVALID }}
{ 0 }, { 0 }, { AARCH64_FEATURE_HASRCPC_IMMO, 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_READ }}

#endif
},
{
/* ldapursb $Rt, [$Rn, $offset] */
AArch64_LDAPURSBWi /* 4256 */, AARCH64_INS_LDAPURSB,
#ifndef CAPSTONE_DIET
{ 0 }, { 0 }, { AARCH64_FEATURE_HASRCPC_IMMO, 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_INVALID }}
{ 0 }, { 0 }, { AARCH64_FEATURE_HASRCPC_IMMO, 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_READ }}

#endif
},
{
/* ldapursb $Rt, [$Rn, $offset] */
AArch64_LDAPURSBXi /* 4257 */, AARCH64_INS_LDAPURSB,
#ifndef CAPSTONE_DIET
{ 0 }, { 0 }, { AARCH64_FEATURE_HASRCPC_IMMO, 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_INVALID }}
{ 0 }, { 0 }, { AARCH64_FEATURE_HASRCPC_IMMO, 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_READ }}

#endif
},
{
/* ldapursh $Rt, [$Rn, $offset] */
AArch64_LDAPURSHWi /* 4258 */, AARCH64_INS_LDAPURSH,
#ifndef CAPSTONE_DIET
{ 0 }, { 0 }, { AARCH64_FEATURE_HASRCPC_IMMO, 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_INVALID }}
{ 0 }, { 0 }, { AARCH64_FEATURE_HASRCPC_IMMO, 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_READ }}

#endif
},
{
/* ldapursh $Rt, [$Rn, $offset] */
AArch64_LDAPURSHXi /* 4259 */, AARCH64_INS_LDAPURSH,
#ifndef CAPSTONE_DIET
{ 0 }, { 0 }, { AARCH64_FEATURE_HASRCPC_IMMO, 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_INVALID }}
{ 0 }, { 0 }, { AARCH64_FEATURE_HASRCPC_IMMO, 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_READ }}

#endif
},
{
/* ldapursw $Rt, [$Rn, $offset] */
AArch64_LDAPURSWi /* 4260 */, AARCH64_INS_LDAPURSW,
#ifndef CAPSTONE_DIET
{ 0 }, { 0 }, { AARCH64_FEATURE_HASRCPC_IMMO, 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_INVALID }}
{ 0 }, { 0 }, { AARCH64_FEATURE_HASRCPC_IMMO, 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_READ }}

#endif
},
{
/* ldapur $Rt, [$Rn, $offset] */
AArch64_LDAPURXi /* 4261 */, AARCH64_INS_LDAPUR,
#ifndef CAPSTONE_DIET
{ 0 }, { 0 }, { AARCH64_FEATURE_HASRCPC_IMMO, 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_INVALID }}
{ 0 }, { 0 }, { AARCH64_FEATURE_HASRCPC_IMMO, 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_READ }}

#endif
},
Expand Down Expand Up @@ -32686,7 +32686,7 @@
/* ldapur $Rt, [$Rn, $offset] */
AArch64_LDAPURi /* 4265 */, AARCH64_INS_LDAPUR,
#ifndef CAPSTONE_DIET
{ 0 }, { 0 }, { AARCH64_FEATURE_HASRCPC_IMMO, 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_INVALID }}
{ 0 }, { 0 }, { AARCH64_FEATURE_HASRCPC_IMMO, 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_READ }}

#endif
},
Expand Down Expand Up @@ -35430,111 +35430,111 @@
/* ldurb $Rt, [$Rn, $offset] */
AArch64_LDURBBi /* 4608 */, AARCH64_INS_LDURB,
#ifndef CAPSTONE_DIET
{ 0 }, { 0 }, { 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_INVALID }}
{ 0 }, { 0 }, { 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_READ }}

#endif
},
{
/* ldur $Rt, [$Rn, $offset] */
AArch64_LDURBi /* 4609 */, AARCH64_INS_LDUR,
#ifndef CAPSTONE_DIET
{ 0 }, { 0 }, { AARCH64_FEATURE_HASFPARMV8, 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_INVALID }}
{ 0 }, { 0 }, { AARCH64_FEATURE_HASFPARMV8, 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_READ }}

#endif
},
{
/* ldur $Rt, [$Rn, $offset] */
AArch64_LDURDi /* 4610 */, AARCH64_INS_LDUR,
#ifndef CAPSTONE_DIET
{ 0 }, { 0 }, { AARCH64_FEATURE_HASFPARMV8, 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_INVALID }}
{ 0 }, { 0 }, { AARCH64_FEATURE_HASFPARMV8, 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_READ }}

#endif
},
{
/* ldurh $Rt, [$Rn, $offset] */
AArch64_LDURHHi /* 4611 */, AARCH64_INS_LDURH,
#ifndef CAPSTONE_DIET
{ 0 }, { 0 }, { 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_INVALID }}
{ 0 }, { 0 }, { 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_READ }}

#endif
},
{
/* ldur $Rt, [$Rn, $offset] */
AArch64_LDURHi /* 4612 */, AARCH64_INS_LDUR,
#ifndef CAPSTONE_DIET
{ 0 }, { 0 }, { AARCH64_FEATURE_HASFPARMV8, 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_INVALID }}
{ 0 }, { 0 }, { AARCH64_FEATURE_HASFPARMV8, 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_READ }}

#endif
},
{
/* ldur $Rt, [$Rn, $offset] */
AArch64_LDURQi /* 4613 */, AARCH64_INS_LDUR,
#ifndef CAPSTONE_DIET
{ 0 }, { 0 }, { AARCH64_FEATURE_HASFPARMV8, 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_INVALID }}
{ 0 }, { 0 }, { AARCH64_FEATURE_HASFPARMV8, 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_READ }}

#endif
},
{
/* ldursb $Rt, [$Rn, $offset] */
AArch64_LDURSBWi /* 4614 */, AARCH64_INS_LDURSB,
#ifndef CAPSTONE_DIET
{ 0 }, { 0 }, { 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_INVALID }}
{ 0 }, { 0 }, { 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_READ }}

#endif
},
{
/* ldursb $Rt, [$Rn, $offset] */
AArch64_LDURSBXi /* 4615 */, AARCH64_INS_LDURSB,
#ifndef CAPSTONE_DIET
{ 0 }, { 0 }, { 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_INVALID }}
{ 0 }, { 0 }, { 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_READ }}

#endif
},
{
/* ldursh $Rt, [$Rn, $offset] */
AArch64_LDURSHWi /* 4616 */, AARCH64_INS_LDURSH,
#ifndef CAPSTONE_DIET
{ 0 }, { 0 }, { 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_INVALID }}
{ 0 }, { 0 }, { 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_READ }}

#endif
},
{
/* ldursh $Rt, [$Rn, $offset] */
AArch64_LDURSHXi /* 4617 */, AARCH64_INS_LDURSH,
#ifndef CAPSTONE_DIET
{ 0 }, { 0 }, { 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_INVALID }}
{ 0 }, { 0 }, { 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_READ }}

#endif
},
{
/* ldursw $Rt, [$Rn, $offset] */
AArch64_LDURSWi /* 4618 */, AARCH64_INS_LDURSW,
#ifndef CAPSTONE_DIET
{ 0 }, { 0 }, { 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_INVALID }}
{ 0 }, { 0 }, { 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_READ }}

#endif
},
{
/* ldur $Rt, [$Rn, $offset] */
AArch64_LDURSi /* 4619 */, AARCH64_INS_LDUR,
#ifndef CAPSTONE_DIET
{ 0 }, { 0 }, { AARCH64_FEATURE_HASFPARMV8, 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_INVALID }}
{ 0 }, { 0 }, { AARCH64_FEATURE_HASFPARMV8, 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_READ }}

#endif
},
{
/* ldur $Rt, [$Rn, $offset] */
AArch64_LDURWi /* 4620 */, AARCH64_INS_LDUR,
#ifndef CAPSTONE_DIET
{ 0 }, { 0 }, { 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_INVALID }}
{ 0 }, { 0 }, { 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_READ }}

#endif
},
{
/* ldur $Rt, [$Rn, $offset] */
AArch64_LDURXi /* 4621 */, AARCH64_INS_LDUR,
#ifndef CAPSTONE_DIET
{ 0 }, { 0 }, { 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_INVALID }}
{ 0 }, { 0 }, { 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_READ }}

#endif
},
Expand Down Expand Up @@ -52398,31 +52398,31 @@
/* stlurb $Rt, [$Rn, $offset] */
AArch64_STLURBi /* 6729 */, AARCH64_INS_STLURB,
#ifndef CAPSTONE_DIET
{ 0 }, { 0 }, { AARCH64_FEATURE_HASRCPC_IMMO, 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_INVALID }}
{ 0 }, { 0 }, { AARCH64_FEATURE_HASRCPC_IMMO, 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_WRITE }}

#endif
},
{
/* stlurh $Rt, [$Rn, $offset] */
AArch64_STLURHi /* 6730 */, AARCH64_INS_STLURH,
#ifndef CAPSTONE_DIET
{ 0 }, { 0 }, { AARCH64_FEATURE_HASRCPC_IMMO, 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_INVALID }}
{ 0 }, { 0 }, { AARCH64_FEATURE_HASRCPC_IMMO, 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_WRITE }}

#endif
},
{
/* stlur $Rt, [$Rn, $offset] */
AArch64_STLURWi /* 6731 */, AARCH64_INS_STLUR,
#ifndef CAPSTONE_DIET
{ 0 }, { 0 }, { AARCH64_FEATURE_HASRCPC_IMMO, 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_INVALID }}
{ 0 }, { 0 }, { AARCH64_FEATURE_HASRCPC_IMMO, 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_WRITE }}

#endif
},
{
/* stlur $Rt, [$Rn, $offset] */
AArch64_STLURXi /* 6732 */, AARCH64_INS_STLUR,
#ifndef CAPSTONE_DIET
{ 0 }, { 0 }, { AARCH64_FEATURE_HASRCPC_IMMO, 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_INVALID }}
{ 0 }, { 0 }, { AARCH64_FEATURE_HASRCPC_IMMO, 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_WRITE }}

#endif
},
Expand Down Expand Up @@ -53478,71 +53478,71 @@
/* sturb $Rt, [$Rn, $offset] */
AArch64_STURBBi /* 6864 */, AARCH64_INS_STURB,
#ifndef CAPSTONE_DIET
{ 0 }, { 0 }, { 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_INVALID }}
{ 0 }, { 0 }, { 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_WRITE }}

#endif
},
{
/* stur $Rt, [$Rn, $offset] */
AArch64_STURBi /* 6865 */, AARCH64_INS_STUR,
#ifndef CAPSTONE_DIET
{ 0 }, { 0 }, { AARCH64_FEATURE_HASFPARMV8, 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_INVALID }}
{ 0 }, { 0 }, { AARCH64_FEATURE_HASFPARMV8, 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_WRITE }}

#endif
},
{
/* stur $Rt, [$Rn, $offset] */
AArch64_STURDi /* 6866 */, AARCH64_INS_STUR,
#ifndef CAPSTONE_DIET
{ 0 }, { 0 }, { AARCH64_FEATURE_HASFPARMV8, 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_INVALID }}
{ 0 }, { 0 }, { AARCH64_FEATURE_HASFPARMV8, 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_WRITE }}

#endif
},
{
/* sturh $Rt, [$Rn, $offset] */
AArch64_STURHHi /* 6867 */, AARCH64_INS_STURH,
#ifndef CAPSTONE_DIET
{ 0 }, { 0 }, { 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_INVALID }}
{ 0 }, { 0 }, { 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_WRITE }}

#endif
},
{
/* stur $Rt, [$Rn, $offset] */
AArch64_STURHi /* 6868 */, AARCH64_INS_STUR,
#ifndef CAPSTONE_DIET
{ 0 }, { 0 }, { AARCH64_FEATURE_HASFPARMV8, 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_INVALID }}
{ 0 }, { 0 }, { AARCH64_FEATURE_HASFPARMV8, 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_WRITE }}

#endif
},
{
/* stur $Rt, [$Rn, $offset] */
AArch64_STURQi /* 6869 */, AARCH64_INS_STUR,
#ifndef CAPSTONE_DIET
{ 0 }, { 0 }, { AARCH64_FEATURE_HASFPARMV8, 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_INVALID }}
{ 0 }, { 0 }, { AARCH64_FEATURE_HASFPARMV8, 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_WRITE }}

#endif
},
{
/* stur $Rt, [$Rn, $offset] */
AArch64_STURSi /* 6870 */, AARCH64_INS_STUR,
#ifndef CAPSTONE_DIET
{ 0 }, { 0 }, { AARCH64_FEATURE_HASFPARMV8, 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_INVALID }}
{ 0 }, { 0 }, { AARCH64_FEATURE_HASFPARMV8, 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_WRITE }}

#endif
},
{
/* stur $Rt, [$Rn, $offset] */
AArch64_STURWi /* 6871 */, AARCH64_INS_STUR,
#ifndef CAPSTONE_DIET
{ 0 }, { 0 }, { 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_INVALID }}
{ 0 }, { 0 }, { 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_WRITE }}

#endif
},
{
/* stur $Rt, [$Rn, $offset] */
AArch64_STURXi /* 6872 */, AARCH64_INS_STUR,
#ifndef CAPSTONE_DIET
{ 0 }, { 0 }, { 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_INVALID }}
{ 0 }, { 0 }, { 0 }, 0, 0, { .aarch64 = { .mem_acc = CS_AC_WRITE }}

#endif
},
Expand Down
49 changes: 49 additions & 0 deletions tests/issues/issues.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5531,3 +5531,52 @@ test_cases:
access: CS_AC_READ
regs_read: [ x1, w2 ]
regs_write: [ x0 ]
-
input:
name: "issue 2572 - Missing access of memory operand"
bytes: [ 0x00, 0x10, 0x40, 0xb8 ]
arch: "CS_ARCH_AARCH64"
options: [ CS_OPT_DETAIL ]
address: 0x0
expected:
insns:
-
asm_text: "ldur w0, [x0, #1]"
details:
aarch64:
operands:
-
type: AARCH64_OP_REG
reg: w0
access: CS_AC_WRITE
-
type: AARCH64_OP_MEM
mem_base: x0
mem_disp: 0x1
access: CS_AC_READ
regs_read: [ x0 ]
regs_write: [ w0 ]
-
input:
name: "issue 2572 - Missing access of memory operand"
bytes: [ 0x9f, 0xf1, 0x0f, 0x78 ]
arch: "CS_ARCH_AARCH64"
options: [ CS_OPT_DETAIL ]
address: 0x0
expected:
insns:
-
asm_text: "sturh wzr, [x12, #255]"
details:
aarch64:
operands:
-
type: AARCH64_OP_REG
reg: wzr
access: CS_AC_READ
-
type: AARCH64_OP_MEM
mem_base: x12
mem_disp: 255
access: CS_AC_WRITE
regs_read: [ wzr, x12 ]

0 comments on commit c51ffd4

Please sign in to comment.