-
-
Notifications
You must be signed in to change notification settings - Fork 373
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add copy of meta-programming macros for capstone-sys build.
- Loading branch information
Showing
4 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// SPDX-FileCopyrightText: 2023 Rot127 <[email protected]> | ||
// SPDX-License-Identifier: LGPL-3.0-only | ||
|
||
#ifndef AARCH64_META_MACROS_H | ||
#define AARCH64_META_MACROS_H | ||
|
||
#ifdef USE_SYS_CAPSTONE | ||
|
||
/// Macro for meta programming. | ||
/// Meant for projects using Capstone and need to support multiple | ||
/// versions of it. | ||
/// These macros replace several instances of the old "ARM64" with | ||
/// the new "AArch64" name depending on the CS version. | ||
#if CS_NEXT_VERSION < 6 | ||
#define CS_AARCH64(x) ARM64##x | ||
#else | ||
#define CS_AARCH64(x) AArch64##x | ||
#endif | ||
|
||
#if CS_NEXT_VERSION < 6 | ||
#define CS_AARCH64pre(x) x##ARM64 | ||
#else | ||
#define CS_AARCH64pre(x) x##AARCH64 | ||
#endif | ||
|
||
#if CS_NEXT_VERSION < 6 | ||
#define CS_AARCH64CC(x) ARM64_CC##x | ||
#else | ||
#define CS_AARCH64CC(x) AArch64CC##x | ||
#endif | ||
|
||
#if CS_NEXT_VERSION < 6 | ||
#define CS_AARCH64_VL_(x) ARM64_VAS_##x | ||
#else | ||
#define CS_AARCH64_VL_(x) AArch64Layout_VL_##x | ||
#endif | ||
|
||
#if CS_NEXT_VERSION < 6 | ||
#define CS_aarch64(x) arm64##x | ||
#else | ||
#define CS_aarch64(x) aarch64##x | ||
#endif | ||
|
||
#if CS_NEXT_VERSION < 6 | ||
#define CS_aarch64_op() cs_arm64_op | ||
#define CS_aarch64_reg() arm64_reg | ||
#define CS_aarch64_cc() arm64_cc | ||
#define CS_cs_aarch64() cs_arm64 | ||
#define CS_aarch64_extender() arm64_extender | ||
#define CS_aarch64_shifter() arm64_shifter | ||
#define CS_aarch64_vas() arm64_vas | ||
#else | ||
#define CS_aarch64_op() cs_aarch64_op | ||
#define CS_aarch64_reg() aarch64_reg | ||
#define CS_aarch64_cc() AArch64CC_CondCode | ||
#define CS_cs_aarch64() cs_aarch64 | ||
#define CS_aarch64_extender() aarch64_extender | ||
#define CS_aarch64_shifter() aarch64_shifter | ||
#define CS_aarch64_vas() AArch64Layout_VectorLayout | ||
#endif | ||
|
||
#endif // USE_SYS_CAPSTONE | ||
#endif // AARCH64_META_MACROS_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters