Skip to content

Commit 41bb337

Browse files
committed
This time actually fix big endian issue.
Of course an enum value has the width of an int. If it is 64bits long and on a big endian machine, the enum value gets assigned to the upper bits. Not the lower ones.
1 parent 306d571 commit 41bb337

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

bindings/python/capstone/aarch64.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class AArch64SysOpSysReg(ctypes.Union):
5252
('sysreg', ctypes.c_uint),
5353
('tlbi', ctypes.c_uint),
5454
('ic', ctypes.c_uint),
55-
('raw_val', ctypes.c_uint64),
55+
('raw_val', ctypes.c_int),
5656
)
5757

5858
class AArch64SysOpSysImm(ctypes.Union):

bindings/python/cstest_py/src/cstest_py/details.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,7 @@ def test_expected_aarch64(actual: CsInsn, expected: dict) -> bool:
755755
aop.sysop.sub_type, eop.get("sub_type"), "sub_type"
756756
):
757757
return False
758-
if not compare_uint64(
758+
if not compare_int32(
759759
aop.sysop.reg.raw_val, eop.get("sys_raw_val"), "sys_raw_val"
760760
):
761761
return False
@@ -764,7 +764,7 @@ def test_expected_aarch64(actual: CsInsn, expected: dict) -> bool:
764764
aop.sysop.sub_type, eop.get("sub_type"), "sub_type"
765765
):
766766
return False
767-
if not compare_uint64(
767+
if not compare_int32(
768768
aop.sysop.imm.raw_val, eop.get("sys_raw_val"), "sys_raw_val"
769769
):
770770
return False
@@ -778,7 +778,7 @@ def test_expected_aarch64(actual: CsInsn, expected: dict) -> bool:
778778
aop.sysop.sub_type, eop.get("sub_type"), "sub_type"
779779
):
780780
return False
781-
if not compare_uint64(
781+
if not compare_int32(
782782
aop.sysop.alias.raw_val, eop.get("sys_raw_val"), "sys_raw_val"
783783
):
784784
return False

include/capstone/aarch64.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -1972,13 +1972,13 @@ typedef union {
19721972
aarch64_sysreg sysreg;
19731973
aarch64_tlbi tlbi;
19741974
aarch64_ic ic;
1975-
uint64_t raw_val;
1975+
int raw_val;
19761976
} aarch64_sysop_reg;
19771977

19781978
typedef union {
19791979
aarch64_dbnxs dbnxs;
19801980
aarch64_exactfpimm exactfpimm;
1981-
uint64_t raw_val;
1981+
int raw_val;
19821982
} aarch64_sysop_imm;
19831983

19841984
typedef union {
@@ -1997,7 +1997,7 @@ typedef union {
19971997
aarch64_bti bti;
19981998
aarch64_svepredpat svepredpat;
19991999
aarch64_sveveclenspecifier sveveclenspecifier;
2000-
uint64_t raw_val;
2000+
int raw_val;
20012001
} aarch64_sysop_alias;
20022002

20032003
/// Operand type for instruction's operands

suite/cstest/include/test_detail_aarch64.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ typedef struct {
5858
int8_t imm_range_offset;
5959
double fp;
6060
bool fp_set; /// Only relevant for SysOps with EXACTFPIMM
61-
uint64_t sys_raw_val;
61+
int sys_raw_val;
6262

6363
TestDetailAArch64SME *sme;
6464

suite/cstest/src/test_detail_aarch64.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -180,13 +180,13 @@ bool test_expected_aarch64(csh *handle, cs_aarch64 *actual,
180180
case AARCH64_OP_SYSREG:
181181
compare_enum_ret(op->sysop.sub_type, eop->sub_type,
182182
false);
183-
compare_uint64_ret(op->sysop.reg.raw_val,
183+
compare_int_ret(op->sysop.reg.raw_val,
184184
eop->sys_raw_val, false);
185185
break;
186186
case AARCH64_OP_SYSIMM:
187187
compare_enum_ret(op->sysop.sub_type, eop->sub_type,
188188
false);
189-
compare_uint64_ret(op->sysop.imm.raw_val,
189+
compare_int_ret(op->sysop.imm.raw_val,
190190
eop->sys_raw_val, false);
191191
if (eop->fp_set) {
192192
compare_fp_ret(op->fp, eop->fp, false);
@@ -195,7 +195,7 @@ bool test_expected_aarch64(csh *handle, cs_aarch64 *actual,
195195
case AARCH64_OP_SYSALIAS:
196196
compare_enum_ret(op->sysop.sub_type, eop->sub_type,
197197
false);
198-
compare_uint64_ret(op->sysop.alias.raw_val,
198+
compare_int_ret(op->sysop.alias.raw_val,
199199
eop->sys_raw_val, false);
200200
break;
201201
case AARCH64_OP_MEM:

0 commit comments

Comments
 (0)