Skip to content

Commit

Permalink
Make thumb, v8 and m-class positional cstool arguments.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rot127 committed Nov 25, 2024
1 parent e46838e commit 98ec129
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
4 changes: 2 additions & 2 deletions arch/ARM/ARMModule.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ cs_err ARM_option(cs_struct *handle, cs_opt_type type, size_t value)
{
switch (type) {
case CS_OPT_MODE:
handle->mode = (cs_mode)value;
handle->mode ^= (cs_mode)value;
break;
case CS_OPT_SYNTAX:
handle->syntax |= (int)value;
handle->syntax ^= (int)value;
break;
default:
break;
Expand Down
15 changes: 6 additions & 9 deletions cstool/cstool.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ static struct {
CS_ARCH_MIPS, CS_ARCH_MAX }, 0, CS_MODE_MIPS_NOFLOAT },
{ "+ptr64", "Enables 64-bit pointers support", {
CS_ARCH_MIPS, CS_ARCH_MAX }, 0, CS_MODE_MIPS_PTR64 },
{ "+thumb", "Enables Thumb mode for ARM.", {
CS_ARCH_ARM, CS_ARCH_MAX }, 0, CS_MODE_THUMB },
{ "+m", "Enables the M extension for ARM.", {
CS_ARCH_ARM, CS_ARCH_MAX }, 0, CS_MODE_MCLASS },
{ "+v8", "Sets the ARM version to v8+", {
CS_ARCH_ARM, CS_ARCH_MAX }, 0, CS_MODE_V8 },
{ NULL }
};

Expand All @@ -59,15 +65,6 @@ static struct {
{ "arm", "ARM, little endian", CS_ARCH_ARM, CS_MODE_ARM },
{ "armle", "ARM, little endian", CS_ARCH_ARM, CS_MODE_ARM | CS_MODE_LITTLE_ENDIAN },
{ "armbe", "ARM, big endian", CS_ARCH_ARM, CS_MODE_ARM | CS_MODE_BIG_ENDIAN },
{ "armv8", "ARM v8", CS_ARCH_ARM, CS_MODE_ARM | CS_MODE_V8 },
{ "armv8be", "ARM v8, big endian", CS_ARCH_ARM, CS_MODE_ARM | CS_MODE_V8 | CS_MODE_BIG_ENDIAN },
{ "cortexm", "ARM Cortex-M Thumb", CS_ARCH_ARM, CS_MODE_ARM | CS_MODE_THUMB | CS_MODE_MCLASS },
{ "cortexmv8", "ARM Cortex-M Thumb, v8", CS_ARCH_ARM, CS_MODE_ARM | CS_MODE_THUMB | CS_MODE_MCLASS | CS_MODE_V8 },
{ "thumb", "ARM Thumb mode, little endian", CS_ARCH_ARM, CS_MODE_ARM | CS_MODE_THUMB },
{ "thumble", "ARM Thumb mode, little endian", CS_ARCH_ARM, CS_MODE_ARM | CS_MODE_THUMB | CS_MODE_LITTLE_ENDIAN },
{ "thumbbe", "ARM Thumb mode, big endian", CS_ARCH_ARM, CS_MODE_ARM | CS_MODE_THUMB | CS_MODE_BIG_ENDIAN },
{ "thumbv8", "ARM Thumb v8", CS_ARCH_ARM, CS_MODE_ARM | CS_MODE_THUMB | CS_MODE_V8 },
{ "thumbv8be", "ARM Thumb v8, big endian", CS_ARCH_ARM, CS_MODE_ARM | CS_MODE_THUMB | CS_MODE_V8 | CS_MODE_BIG_ENDIAN },

{ "aarch64", "AArch64", CS_ARCH_AARCH64, CS_MODE_LITTLE_ENDIAN },
{ "aarch64be", "AArch64, big endian", CS_ARCH_AARCH64, CS_MODE_BIG_ENDIAN },
Expand Down

0 comments on commit 98ec129

Please sign in to comment.