Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 101 additions & 16 deletions .github/workflows/CrossBuilds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ on:
- "SPONSORS.TXT"
- "TODO"
pull_request:
release:
types: [published]

# Stop previous runs on the same branch on new push
concurrency:
Expand All @@ -42,29 +44,35 @@ jobs:
arch: x64,
build-system: 'cmake',
diet-build: 'OFF',
build_type: 'Debug',
build_type: 'Release',
upload_name: 'capstone_s390x',
build_exe: false,
diet_build: false,
packages: 'gcc-s390x-linux-gnu g++-s390x-linux-gnu binutils-s390x-linux-gnu libc6-dev-s390x-cross qemu-user-static',
cross_file: 'cross_configs/linux_s390x_ubuntu24.cmake',
}
# - {
# name: 'QEMU Linux Mips 32',
# os: ubuntu-24.04,
# arch: x64,
# build-system: 'cmake',
# diet-build: 'OFF',
# build_type: 'Debug',
# diet_build: false,
# packages: 'gcc-mips-linux-gnu g++-mips-linux-gnu binutils-mips-linux-gnu libc6-dev-mips-cross qemu-user-static',
# cross_file: 'cross_configs/linux_mips_ubuntu24.cmake',
# }
- {
name: 'QEMU Linux Mips 32',
os: ubuntu-24.04,
arch: x64,
build-system: 'cmake',
diet-build: 'OFF',
build_type: 'Release',
upload_name: 'capstone_mips32',
build_exe: false,
diet_build: false,
packages: 'gcc-mips-linux-gnu g++-mips-linux-gnu binutils-mips-linux-gnu libc6-dev-mips-cross qemu-user-static',
cross_file: 'cross_configs/linux_mips_ubuntu24.cmake',
}
- {
name: 'QEMU Linux Mips64el',
os: ubuntu-24.04,
arch: x64,
build-system: 'cmake',
diet-build: 'OFF',
build_type: 'Debug',
build_type: 'Release',
upload_name: 'capstone_mips64el',
build_exe: false,
diet_build: false,
packages: 'gcc-mips64el-linux-gnuabi64 g++-mips64el-linux-gnuabi64 binutils-mips64el-linux-gnuabi64 libc6-dev-mips64el-cross qemu-user-static',
cross_file: 'cross_configs/linux_mips64_ubuntu24.cmake',
Expand All @@ -75,22 +83,54 @@ jobs:
arch: x64,
build-system: 'cmake',
diet-build: 'OFF',
build_type: 'Debug',
build_type: 'Release',
upload_name: 'capstone_ppc64',
build_exe: false,
diet_build: false,
packages: 'gcc-powerpc64-linux-gnu g++-powerpc64-linux-gnu binutils-powerpc64-linux-gnu libc6-dev-ppc64-cross qemu-user-static',
cross_file: 'cross_configs/linux_ppc64_ubuntu24.cmake',
}
- {
name: 'QEMU Linux ARM',
os: ubuntu-24.04,
arch: x64,
build-system: 'cmake',
diet-build: 'OFF',
build_type: 'Release',
upload_name: 'capstone_arm_v7',
build_exe: false,
diet_build: false,
packages: 'gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf binutils-arm-linux-gnueabihf libc6-armhf-cross libc6-dev-armhf-cross qemu-user-static',
cross_file: 'cross_configs/linux_arm_ubuntu24.cmake',
}
- {
name: '[BUILD ONLY] Windows i686 mingw',
os: ubuntu-24.04,
arch: x64,
build-system: 'cmake',
diet-build: 'OFF',
build_type: 'Release',
upload_name: 'capstone_win_i686',
build_exe: true,
diet_build: false,
# Tests are run via Python.
skip_tests: true,
packages: 'gcc-mingw-w64-i686 g++-mingw-w64-i686 mingw-w64-tools nsis',
cross_file: 'cross_configs/windows_i686_ubuntu24.cmake',
}
- {
name: '[BUILD ONLY] Android 35 (arm64_v8a) NDK 29',
os: ubuntu-24.04,
arch: x64,
build-system: 'cmake',
build_option: '-DANDROID_NDK=ndk/ -DANDROID_PLATFORM=android-35 -DANDROID_ABI=arm64-v8a',
diet-build: 'OFF',
build_type: 'Debug',
build_type: 'Release',
upload_name: 'capstone_android_35_arm64_v8a',
build_exe: false,
diet_build: false,
# QEMU alone can't emulate the binaries, because the NDK doesn't
# provide dynamic linker.
# provide a dynamic linker.
skip_tests: true,
packages: 'qemu-user-static',
ndk_version: 'r29',
Expand Down Expand Up @@ -177,3 +217,48 @@ jobs:
if: ${{ matrix.config.skip_tests != true }}
run: |
ctest --test-dir build --output-on-failure -R legacy*

- name: Package binary tar.gz
if: ${{ matrix.config.build_exe == false }}
run: |
cd build
cpack -G TGZ

- uses: actions/upload-artifact@v4
if: ${{ matrix.config.build_exe == false }}
with:
name: ${{ matrix.config.upload_name }}
path: ./build/*.tar.gz

- name: Upload binary package to release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags') && github.event_name == 'release' && matrix.config.build_exe == false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.event.release.tag_name }}
files: |
./build/*.tar.gz

- name: Package NSIS installer
if: ${{ matrix.config.build_exe }}
run: |
makensis -VERSION
cd build
cpack -G NSIS

- uses: actions/upload-artifact@v4
if: ${{ matrix.config.build_exe }}
with:
name: ${{ matrix.config.upload_name }}
path: ./build/capstone-*.exe

- name: Upload NSIS installer to release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags') && github.event_name == 'release' && matrix.config.build_exe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.event.release.tag_name }}
files: |
./build/capstone-*.exe
6 changes: 3 additions & 3 deletions .github/workflows/build-wheels-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ jobs:
include:
# NOTE: Making this to parallelize and speed up workflow
# i686 - manylinux
# - { os: ubuntu-latest, arch: i686, cibw_build: 'cp*-manylinux*', cibw_skip: '' }
- { os: ubuntu-latest, arch: i686, cibw_build: 'cp*-manylinux*', cibw_skip: '' }
# i686 - musllinux
# - { os: ubuntu-latest, arch: i686, cibw_build: 'cp*-musllinux*', cibw_skip: '' }
- { os: ubuntu-latest, arch: i686, cibw_build: 'cp*-musllinux*', cibw_skip: '' }
# x86_64 - manylinux
- { os: ubuntu-latest, arch: x86_64, cibw_build: 'cp*-manylinux*', cibw_skip: '' }
# x86_64 - musllinux
Expand All @@ -63,7 +63,7 @@ jobs:
# windows - amd64
- { os: windows-latest, arch: AMD64, cibw_build: 'cp*', cibw_skip: '' }
# windows - x86
# - { os: windows-latest, arch: x86, cibw_build: 'cp*', cibw_skip: '' }
- { os: windows-latest, arch: x86, cibw_build: 'cp*', cibw_skip: '' }
# windows - arm64
- { os: windows-11-arm, arch: ARM64, cibw_build: 'cp*', cibw_skip: '*38* *39* *310*' }

Expand Down
7 changes: 4 additions & 3 deletions arch/AArch64/AArch64InstPrinter.c
Original file line number Diff line number Diff line change
Expand Up @@ -1131,7 +1131,7 @@ void printShifter(MCInst *MI, unsigned OpNum, SStream *O)
AArch64_AM_getShiftValue(Val) == 0)
return;
SStream_concat(
O, "%s%s%s%s#%d", ", ",
O, "%s%s%s%s#%u", ", ",
AArch64_AM_getShiftExtendName(AArch64_AM_getShiftType(Val)),
" ", markup("<imm:"), AArch64_AM_getShiftValue(Val));
SStream_concat0(O, markup(">"));
Expand Down Expand Up @@ -1202,7 +1202,7 @@ static void printMemExtendImpl(bool SignExtend, bool DoShift, unsigned Width,
if (getUseMarkup)
SStream_concat0(O, "<imm:");
unsigned ShiftAmount = DoShift ? Log2_32(Width / 8) : 0;
SStream_concat(O, "%s%d", "#", ShiftAmount);
SStream_concat(O, "%s%u", "#", ShiftAmount);
if (getUseMarkup)
SStream_concat0(O, ">");
}
Expand Down Expand Up @@ -2319,7 +2319,8 @@ void printSIMDType10Operand(MCInst *MI, unsigned OpNo, SStream *O)
unsigned Val = \
MCOperand_getImm(MCInst_getOperand(MI, (OpNo))); \
SStream_concat(O, "%s", markup("<imm:")); \
SStream_concat(O, "#%d", (Val * Angle) + Remainder); \
SStream_concat(O, "#%" PRId32, \
(int32_t)((Val * Angle) + Remainder)); \
SStream_concat0(O, markup(">")); \
}
DEFINE_printComplexRotationOp(180, 90);
Expand Down
45 changes: 17 additions & 28 deletions arch/AArch64/AArch64Mapping.c
Original file line number Diff line number Diff line change
Expand Up @@ -1653,7 +1653,7 @@ void AArch64_add_cs_detail_0(MCInst *MI, aarch64_op_group op_group,
} else
vas = get_vl_by_suffix(Dot[1]);
AArch64_set_detail_op_sme(MI, OpNum, AARCH64_SME_MATRIX_TILE,
vas);
vas, 0, 0);
break;
}
case AArch64_OP_GROUP_MatrixTileList: {
Expand All @@ -1668,7 +1668,8 @@ void AArch64_add_cs_detail_0(MCInst *MI, aarch64_op_group op_group,
AArch64_set_detail_op_sme(MI, OpNum,
AARCH64_SME_MATRIX_TILE_LIST,
AARCH64LAYOUT_VL_D,
(int)(AARCH64_REG_ZAD0 + I));
(int)(AARCH64_REG_ZAD0 + I),
0);
AArch64_inc_op_count(MI);
}
AArch64_get_detail(MI)->is_doing_sme = false;
Expand Down Expand Up @@ -1976,7 +1977,8 @@ void AArch64_add_cs_detail_1(MCInst *MI, aarch64_op_group op_group,
case AArch64_OP_GROUP_Matrix_64: {
unsigned EltSize = temp_arg_0;
AArch64_set_detail_op_sme(MI, OpNum, AARCH64_SME_MATRIX_TILE,
(AArch64Layout_VectorLayout)EltSize);
(AArch64Layout_VectorLayout)EltSize,
0, 0);
break;
}
case AArch64_OP_GROUP_MatrixIndex_0:
Expand All @@ -1988,7 +1990,8 @@ void AArch64_add_cs_detail_1(MCInst *MI, aarch64_op_group op_group,
AArch64_set_detail_op_sme(
MI, OpNum, AARCH64_SME_MATRIX_SLICE_OFF,
AARCH64LAYOUT_INVALID,
(uint32_t)(MCInst_getOpVal(MI, OpNum) * scale));
(uint32_t)(MCInst_getOpVal(MI, OpNum) * scale),
0);
} else if (AArch64_get_detail_op(MI, 0)->type ==
AARCH64_OP_PRED) {
// The index is part of a predicate
Expand Down Expand Up @@ -2017,7 +2020,7 @@ void AArch64_add_cs_detail_1(MCInst *MI, aarch64_op_group op_group,
vas = get_vl_by_suffix(Dot[1]);
setup_sme_operand(MI);
AArch64_set_detail_op_sme(MI, OpNum, AARCH64_SME_MATRIX_TILE,
vas);
vas, 0, 0);
AArch64_get_detail_op(MI, 0)->sme.is_vertical = isVertical;
break;
}
Expand Down Expand Up @@ -2454,7 +2457,7 @@ void AArch64_set_detail_op_reg(MCInst *MI, unsigned OpNum, aarch64_reg Reg)
(Reg >= AARCH64_REG_ZAB0 && Reg < AARCH64_REG_ZT0)) {
// A tile register should be treated as SME operand.
AArch64_set_detail_op_sme(MI, OpNum, AARCH64_SME_MATRIX_TILE,
sme_reg_to_vas(Reg));
sme_reg_to_vas(Reg), 0, 0);
return;
} else if (((Reg >= AARCH64_REG_P0) && (Reg <= AARCH64_REG_P15)) ||
((Reg >= AARCH64_REG_PN0) && (Reg <= AARCH64_REG_PN15))) {
Expand All @@ -2466,7 +2469,7 @@ void AArch64_set_detail_op_reg(MCInst *MI, unsigned OpNum, aarch64_reg Reg)
if (AArch64_get_detail_op(MI, 0)->type == AARCH64_OP_SME) {
AArch64_set_detail_op_sme(MI, OpNum,
AARCH64_SME_MATRIX_SLICE_REG,
AARCH64LAYOUT_INVALID);
AARCH64LAYOUT_INVALID, 0, 0);
} else if (AArch64_get_detail_op(MI, 0)->type ==
AARCH64_OP_PRED) {
AArch64_set_detail_op_pred(MI, OpNum);
Expand Down Expand Up @@ -2518,7 +2521,7 @@ void AArch64_set_detail_op_imm(MCInst *MI, unsigned OpNum,
AArch64_set_detail_op_sme(MI, OpNum,
AARCH64_SME_MATRIX_SLICE_OFF,
AARCH64LAYOUT_INVALID,
(uint32_t)1);
(uint32_t)1, 0);
} else if (AArch64_get_detail_op(MI, 0)->type ==
AARCH64_OP_PRED) {
AArch64_set_detail_op_pred(MI, OpNum);
Expand Down Expand Up @@ -2720,7 +2723,8 @@ void AArch64_set_detail_op_pred(MCInst *MI, unsigned OpNum)
/// Adds a SME matrix component to a SME operand.
void AArch64_set_detail_op_sme(MCInst *MI, unsigned OpNum,
aarch64_sme_op_part part,
AArch64Layout_VectorLayout vas, ...)
AArch64Layout_VectorLayout vas, uint64_t arg_0,
uint64_t arg_1)
{
if (!detail_is_set(MI))
return;
Expand All @@ -2733,12 +2737,7 @@ void AArch64_set_detail_op_sme(MCInst *MI, unsigned OpNum,
CS_ASSERT_RET(0);
case AARCH64_SME_MATRIX_TILE_LIST: {
setup_sme_operand(MI);
va_list args;
va_start(args, vas);
// NOLINTBEGIN(clang-analyzer-valist.Uninitialized)
int Tile = va_arg(args, int);
// NOLINTEND(clang-analyzer-valist.Uninitialized)
va_end(args);
int Tile = arg_0;
AArch64_get_detail_op(MI, 0)->sme.type = AARCH64_SME_OP_TILE;
AArch64_get_detail_op(MI, 0)->sme.tile = Tile;
AArch64_get_detail_op(MI, 0)->vas = vas;
Expand Down Expand Up @@ -2780,23 +2779,13 @@ void AArch64_set_detail_op_sme(MCInst *MI, unsigned OpNum,
CS_ASSERT_RET(
AArch64_get_detail_op(MI, 0)->sme.slice_offset.imm ==
AARCH64_SLICE_IMM_INVALID);
va_list args;
va_start(args, vas);
// NOLINTBEGIN(clang-analyzer-valist.Uninitialized)
uint16_t offset = va_arg(args, uint32_t);
// NOLINTEND(clang-analyzer-valist.Uninitialized)
va_end(args);
uint16_t offset = arg_0;
AArch64_get_detail_op(MI, 0)->sme.slice_offset.imm = offset;
break;
}
case AARCH64_SME_MATRIX_SLICE_OFF_RANGE: {
va_list args;
va_start(args, vas);
// NOLINTBEGIN(clang-analyzer-valist.Uninitialized)
uint8_t First = va_arg(args, uint32_t);
uint8_t Offset = va_arg(args, uint32_t);
// NOLINTEND(clang-analyzer-valist.Uninitialized)
va_end(args);
uint8_t First = arg_0;
uint8_t Offset = arg_1;
AArch64_get_detail_op(MI, 0)->sme.slice_offset.imm_range.first =
First;
AArch64_get_detail_op(MI, 0)->sme.slice_offset.imm_range.offset =
Expand Down
3 changes: 2 additions & 1 deletion arch/AArch64/AArch64Mapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ void AArch64_set_detail_op_sys(MCInst *MI, unsigned OpNum, aarch64_sysop sys_op,
aarch64_op_type type);
void AArch64_set_detail_op_sme(MCInst *MI, unsigned OpNum,
aarch64_sme_op_part part,
AArch64Layout_VectorLayout vas, ...);
AArch64Layout_VectorLayout vas, uint64_t arg_0,
uint64_t arg_1);
void AArch64_set_detail_op_pred(MCInst *MI, unsigned OpNum);
void AArch64_insert_detail_op_reg_at(MCInst *MI, unsigned index,
aarch64_reg Reg, cs_ac_type access);
Expand Down
Loading
Loading