Skip to content

Commit 36a2b30

Browse files
committed
rs, sys: bump capstone to 6.0.0-Alpha5
1 parent 0f57559 commit 36a2b30

File tree

33 files changed

+19767
-18125
lines changed

33 files changed

+19767
-18125
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2828

2929
### Changed
3030
- `InsnDetail::regs_read()`/`InsnDetail::regs_write()` return more of the accessed registers
31-
- Bump bundled capstone to 6.0.0-Alpha4
31+
- Bump bundled capstone to 6.0.0-Alpha5
3232
- Rename ARM64 to AARCH64, SYSZ to SYSTEMZ to follow upstream changes
3333
- AArch64 support is rewritten to follow upstream changes
3434
- Endian must be specified for Sparc/SystemZ, since little endian support is added

capstone-sys/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1919
- Rename ARM64 to AARCH64, SYSZ to SYSTEMZ to follow upstream changes
2020

2121
### Changed
22-
- Bump bundled capstone to 6.0.0-Alpha4
22+
- Bump bundled capstone to 6.0.0-Alpha5
2323
- Change `cs_regs_access()` `regs_read`/`regs_write` args to take `*mut cs_regs` (instead of `*mut u16`)
2424
- makes it more clear that args should be fixed size arrays
2525

capstone-sys/capstone/.github/workflows/build-wheels-publish.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
# windows - x86
6464
# - { os: windows-latest, arch: x86, cibw_build: 'cp*', cibw_skip: '*36* *37*' }
6565
# windows - arm64
66-
- { os: windows-latest, arch: ARM64, cibw_build: 'cp*', cibw_skip: '*36* *37* *38*' }
66+
- { os: windows-11-arm, arch: ARM64, cibw_build: 'cp*', cibw_skip: '*36* *37* *38* *39* *310*' }
6767

6868
steps:
6969
- uses: actions/checkout@v4
@@ -106,17 +106,16 @@ jobs:
106106
uses: docker/setup-qemu-action@v3
107107

108108
- name: '🚧 cibuildwheel run'
109-
uses: pypa/cibuildwheel@v2.23.3
109+
uses: pypa/cibuildwheel@v3.0.1
110110
env:
111111
CIBW_BUILD_FRONTEND: build
112112
CIBW_BUILD: ${{ matrix.cibw_build }}
113113
CIBW_SKIP: ${{ matrix.cibw_skip }}
114114
CIBW_ARCHS: ${{ matrix.arch }}
115115
CIBW_ENVIRONMENT: DEBUG=${{ env.CAPSTONE_DEBUG }}
116116
CIBW_ENVIRONMENT_PASS_LINUX: DEBUG
117-
# https://cibuildwheel.pypa.io/en/stable/faq/#windows-arm64
118117
# https://github.com/pypa/cibuildwheel/pull/1169
119-
CIBW_TEST_SKIP: "*-win_arm64 cp38-macosx_*:arm64"
118+
CIBW_TEST_SKIP: "cp38-macosx_*:arm64"
120119
CIBW_TEST_COMMAND: >
121120
python -m pip install {package}/cstest_py &&
122121
python {project}/suite/run_tests.py

capstone-sys/capstone/ChangeLog

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,49 @@
11
This file details the changelog of Capstone.
22

3+
-----------------------------
4+
Version 6.0.0-Alpha5: August 3rd, 2025
5+
6+
## What's Changed
7+
* Apple AArch64 proprietary by @Rot127 in https://github.com/capstone-engine/capstone/pull/2692
8+
* Add jump group for generic jirl by @jiegec in https://github.com/capstone-engine/capstone/pull/2698
9+
* LoongArch: Compute absolute address for address operand by @jiegec in https://github.com/capstone-engine/capstone/pull/2699
10+
* Fix LoongArch ld/st instructions register info by @jiegec in https://github.com/capstone-engine/capstone/pull/2701
11+
* ARM: fix typo, cspr -> cpsr by @jiegec in https://github.com/capstone-engine/capstone/pull/2716
12+
* Fix arm pop reg access by @jiegec in https://github.com/capstone-engine/capstone/pull/2718
13+
* Fix missing sp register read in ret instruction by @jiegec in https://github.com/capstone-engine/capstone/pull/2719
14+
* Fix missing operand for smstart, due to space replaced by tab by @jiegec in https://github.com/capstone-engine/capstone/pull/2720
15+
* Add flag for the SoftFail case of the LLVM disassembler. by @Rot127 in https://github.com/capstone-engine/capstone/pull/2707
16+
* Remove unused files. by @Rot127 in https://github.com/capstone-engine/capstone/pull/2709
17+
* clang-format: change license to BSD-3-Clause by @tmfink in https://github.com/capstone-engine/capstone/pull/2724
18+
* Use cs_ac_type for operand access mode in all arches and use cs_xtensa_op_type for Xtensa operand type by @jiegec in https://github.com/capstone-engine/capstone/pull/2721
19+
* Make SStream respect the CS_OPT_UNSIGNED flag. by @Rot127 in https://github.com/capstone-engine/capstone/pull/2723
20+
* Make assertion hit warnings optional in release builds. by @Rot127 in https://github.com/capstone-engine/capstone/pull/2729
21+
* Update source list before installing valgrind. by @Rot127 in https://github.com/capstone-engine/capstone/pull/2730
22+
* Add x30 implicit read to the RET alias. by @Rot127 in https://github.com/capstone-engine/capstone/pull/2739
23+
* Print immediate only memory operands for AArch64. by @Rot127 in https://github.com/capstone-engine/capstone/pull/2732
24+
* Add warning about naive search and replace to patch reg names. by @Rot127 in https://github.com/capstone-engine/capstone/pull/2728
25+
* Enable to generate legacy MC tests for the fuzzer. by @Rot127 in https://github.com/capstone-engine/capstone/pull/2733
26+
* Auto-Sync update Sparc LLVM-18 by @Rot127 in https://github.com/capstone-engine/capstone/pull/2704
27+
* Python binding: Use ABI3 wheels by @Antelox in https://github.com/capstone-engine/capstone/pull/2742
28+
* Update Auto-Sync to Python 3.13 and tree-sitter-py 24.0 by @Rot127 in https://github.com/capstone-engine/capstone/pull/2705
29+
* Fix for Risc-V C.SRLI decoding (issue #2731) by @h01G3r in https://github.com/capstone-engine/capstone/pull/2745
30+
* HPPA fix mem operands access and instruction printing by @R33v0LT in https://github.com/capstone-engine/capstone/pull/2746
31+
* Handle zero case of R1 operand field by @Rot127 in https://github.com/capstone-engine/capstone/pull/2743
32+
* Fix comisd memory operand size: xmmword -> qword by @jiegec in https://github.com/capstone-engine/capstone/pull/2750
33+
* Fix missing repne for movsd op by @jiegec in https://github.com/capstone-engine/capstone/pull/2752
34+
* Explain more details about CC change. by @Rot127 in https://github.com/capstone-engine/capstone/pull/2753
35+
* Add a test for FCC conditions for none FPU instructions. by @Rot127 in https://github.com/capstone-engine/capstone/pull/2758
36+
* Print register access type and registers accessed in cstool_mips.c by @jiegec in https://github.com/capstone-engine/capstone/pull/2762
37+
* Fix duplication of memory operand by @Rot127 in https://github.com/capstone-engine/capstone/pull/2761
38+
* Python binding: Windows ARM64 build by @Antelox in https://github.com/capstone-engine/capstone/pull/2760
39+
* Implement cs_regs_access for Alpha architecture by @jiegec in https://github.com/capstone-engine/capstone/pull/2763
40+
* Fix decoding of the FCC fields of FBPcc (format 2_3). by @Rot127 in https://github.com/capstone-engine/capstone/pull/2764
41+
42+
## New Contributors
43+
* @h01G3r made their first contribution in https://github.com/capstone-engine/capstone/pull/2745
44+
45+
**Full Changelog**: https://github.com/capstone-engine/capstone/compare/6.0.0-Alpha4...6.0.0-Alpha5
46+
347
-----------------------------
448
Version 6.0.0-Alpha4: April 11th, 2025
549

capstone-sys/capstone/Mapping.c

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -331,31 +331,31 @@ const cs_ac_type mapping_get_op_access(MCInst *MI, unsigned OpNum,
331331
}
332332

333333
/// Returns the operand at detail->arch.operands[op_count + offset]
334-
/// Or NULL if detail is not set.
335-
#define DEFINE_get_detail_op(arch, ARCH) \
334+
/// Or NULL if detail is not set or the offset would be out of bounds.
335+
#define DEFINE_get_detail_op(arch, ARCH, ARCH_UPPER) \
336336
cs_##arch##_op *ARCH##_get_detail_op(MCInst *MI, int offset) \
337337
{ \
338338
if (!MI->flat_insn->detail) \
339339
return NULL; \
340340
int OpIdx = MI->flat_insn->detail->arch.op_count + offset; \
341-
assert(OpIdx >= 0 && OpIdx < MAX_MC_OPS); \
341+
if (OpIdx < 0 || OpIdx >= NUM_##ARCH_UPPER##_OPS) { return NULL; } \
342342
return &MI->flat_insn->detail->arch.operands[OpIdx]; \
343343
}
344344

345-
DEFINE_get_detail_op(arm, ARM);
346-
DEFINE_get_detail_op(ppc, PPC);
347-
DEFINE_get_detail_op(tricore, TriCore);
348-
DEFINE_get_detail_op(aarch64, AArch64);
349-
DEFINE_get_detail_op(alpha, Alpha);
350-
DEFINE_get_detail_op(hppa, HPPA);
351-
DEFINE_get_detail_op(loongarch, LoongArch);
352-
DEFINE_get_detail_op(mips, Mips);
353-
DEFINE_get_detail_op(riscv, RISCV);
354-
DEFINE_get_detail_op(systemz, SystemZ);
355-
DEFINE_get_detail_op(xtensa, Xtensa);
356-
DEFINE_get_detail_op(bpf, BPF);
357-
DEFINE_get_detail_op(arc, ARC);
358-
DEFINE_get_detail_op(sparc, Sparc);
345+
DEFINE_get_detail_op(arm, ARM, ARM);
346+
DEFINE_get_detail_op(ppc, PPC, PPC);
347+
DEFINE_get_detail_op(tricore, TriCore, TRICORE);
348+
DEFINE_get_detail_op(aarch64, AArch64, AARCH64);
349+
DEFINE_get_detail_op(alpha, Alpha, ALPHA);
350+
DEFINE_get_detail_op(hppa, HPPA, HPPA);
351+
DEFINE_get_detail_op(loongarch, LoongArch, LOONGARCH);
352+
DEFINE_get_detail_op(mips, Mips, MIPS);
353+
DEFINE_get_detail_op(riscv, RISCV, RISCV);
354+
DEFINE_get_detail_op(systemz, SystemZ, SYSTEMZ);
355+
DEFINE_get_detail_op(xtensa, Xtensa, XTENSA);
356+
DEFINE_get_detail_op(bpf, BPF, BPF);
357+
DEFINE_get_detail_op(arc, ARC, ARC);
358+
DEFINE_get_detail_op(sparc, Sparc, SPARC);
359359

360360
/// Returns true if for this architecture the
361361
/// alias operands should be filled.

capstone-sys/capstone/arch/Alpha/AlphaMapping.c

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,4 +182,48 @@ bool Alpha_getInstruction(csh handle, const uint8_t *code,
182182
return Result != MCDisassembler_Fail;
183183
}
184184

185+
#ifndef CAPSTONE_DIET
186+
void Alpha_reg_access(const cs_insn *insn, cs_regs regs_read,
187+
uint8_t *regs_read_count, cs_regs regs_write,
188+
uint8_t *regs_write_count)
189+
{
190+
uint8_t i;
191+
uint8_t read_count, write_count;
192+
cs_alpha *alpha = &(insn->detail->alpha);
193+
194+
read_count = insn->detail->regs_read_count;
195+
write_count = insn->detail->regs_write_count;
196+
197+
// implicit registers
198+
memcpy(regs_read, insn->detail->regs_read,
199+
read_count * sizeof(insn->detail->regs_read[0]));
200+
memcpy(regs_write, insn->detail->regs_write,
201+
write_count * sizeof(insn->detail->regs_write[0]));
202+
203+
// explicit registers
204+
for (i = 0; i < alpha->op_count; i++) {
205+
cs_alpha_op *op = &(alpha->operands[i]);
206+
switch ((int)op->type) {
207+
case ALPHA_OP_REG:
208+
if ((op->access & CS_AC_READ) &&
209+
!arr_exist(regs_read, read_count, op->reg)) {
210+
regs_read[read_count] = (uint16_t)op->reg;
211+
read_count++;
212+
}
213+
if ((op->access & CS_AC_WRITE) &&
214+
!arr_exist(regs_write, write_count, op->reg)) {
215+
regs_write[write_count] = (uint16_t)op->reg;
216+
write_count++;
217+
}
218+
break;
219+
default:
220+
break;
221+
}
222+
}
223+
224+
*regs_read_count = read_count;
225+
*regs_write_count = write_count;
226+
}
227+
#endif
228+
185229
#endif

capstone-sys/capstone/arch/Alpha/AlphaMapping.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,8 @@ void Alpha_set_detail_op_imm(MCInst *MI, unsigned OpNum, alpha_op_type ImmType,
3232
int64_t Imm);
3333
void Alpha_set_detail_op_reg(MCInst *MI, unsigned OpNum, alpha_op_type Reg);
3434

35+
void Alpha_reg_access(const cs_insn *insn, cs_regs regs_read,
36+
uint8_t *regs_read_count, cs_regs regs_write,
37+
uint8_t *regs_write_count);
38+
3539
#endif

capstone-sys/capstone/arch/Alpha/AlphaModule.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ cs_err ALPHA_global_init(cs_struct *ud)
2626
ud->insn_id = Alpha_get_insn_id;
2727
ud->insn_name = Alpha_insn_name;
2828
ud->group_name = Alpha_group_name;
29+
#ifndef CAPSTONE_DIET
30+
ud->reg_access = Alpha_reg_access;
31+
#endif
2932

3033
return CS_ERR_OK;
3134
}

capstone-sys/capstone/arch/Mips/MipsMapping.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ static void Mips_set_detail_op_reg(MCInst *MI, unsigned OpNum, mips_reg Reg,
303303
return;
304304
}
305305

306-
CS_ASSERT((map_get_op_type(MI, OpNum) & ~CS_OP_MEM) == CS_OP_REG);
306+
CS_ASSERT(is_reglist || (map_get_op_type(MI, OpNum) & ~CS_OP_MEM) == CS_OP_REG);
307307
Mips_get_detail_op(MI, 0)->type = MIPS_OP_REG;
308308
Mips_get_detail_op(MI, 0)->reg = Reg;
309309
Mips_get_detail_op(MI, 0)->is_reglist = is_reglist;
@@ -319,8 +319,19 @@ static void Mips_set_detail_op_operand(MCInst *MI, unsigned OpNum)
319319
Mips_set_detail_op_imm(MI, OpNum, value);
320320
} else if (op_type == CS_OP_REG) {
321321
Mips_set_detail_op_reg(MI, OpNum, value, false);
322-
} else
323-
printf("Operand type %d not handled!\n", op_type);
322+
} else {
323+
// Register list which ends with a memory operand
324+
// Gives very large MCInst operand numbers but don't
325+
// have the respective Capstone type in the mapping table.
326+
if (MCOperand_isImm(MCInst_getOperand(MI, OpNum))) {
327+
Mips_get_detail_op(MI, 0)->type = MIPS_OP_MEM;
328+
Mips_get_detail_op(MI, 0)->mem.disp = value;
329+
} else if (MCOperand_isReg(MCInst_getOperand(MI, OpNum))) {
330+
Mips_get_detail_op(MI, 0)->mem.base = value;
331+
} else {
332+
printf("Operand type %d not handled!\n", op_type);
333+
}
334+
}
324335
}
325336

326337
static void Mips_set_detail_op_jump(MCInst *MI, unsigned OpNum)

capstone-sys/capstone/arch/Sparc/SparcMapping.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,12 @@ static void Sparc_add_bit_details(MCInst *MI, const uint8_t *Bytes,
6666
break;
6767
}
6868
case SPARC_INSN_FORM_F2_3:
69-
detail->cc_field = 0x4 | get_insn_field_r(insn, 20, 21);
69+
detail->cc_field = get_insn_field_r(insn, 20, 21);
70+
if (get_insn_field_r(insn, 22, 24) == 1) {
71+
// BPcc and FBPcc encode their fields in two bits.
72+
// BPcc needs the upper bit set to match our CC field enum.
73+
detail->cc_field |= 0x4;
74+
}
7075
break;
7176
case SPARC_INSN_FORM_TRAPSP:
7277
detail->cc_field = 0x4 | get_insn_field_r(insn, 11, 12);
@@ -400,6 +405,10 @@ static inline bool is_single_reg_mem_case(MCInst *MI, unsigned OpNo)
400405
if (map_get_op_type(MI, OpNo) != CS_OP_MEM_REG) {
401406
return false;
402407
}
408+
cs_sparc_op *prev_op = Sparc_get_detail_op(MI, -1);
409+
if (prev_op && prev_op->type == SPARC_OP_MEM) {
410+
return false;
411+
}
403412
if (MI->size == 1) {
404413
return true;
405414
} else if (MI->size > OpNo + 1 && Sparc_get_detail(MI)->operands[0].type != SPARC_OP_MEM) {
@@ -450,6 +459,11 @@ void Sparc_add_cs_detail_0(MCInst *MI, sparc_op_group op_group, unsigned OpNo)
450459
break;
451460
}
452461
case Sparc_OP_GROUP_MemOperand: {
462+
cs_sparc_op *prev_op = Sparc_get_detail_op(MI, -1);
463+
if (prev_op && prev_op->type == SPARC_OP_MEM) {
464+
// Already added.
465+
break;
466+
}
453467
MCOperand *Op1 = MCInst_getOperand(MI, (OpNo));
454468
MCOperand *Op2 = MCInst_getOperand(MI, (OpNo + 1));
455469
if (!MCOperand_isReg(Op1) ||

0 commit comments

Comments
 (0)