From f1006f97c24b9cd21fcc7d3faaaea8b6e0305857 Mon Sep 17 00:00:00 2001 From: Anton Kochkov Date: Thu, 20 Jul 2023 16:20:04 +0800 Subject: [PATCH] arm: use `cortexm` cpu instead of `cortex` (#3674) --- librz/analysis/p/analysis_arm_cs.c | 2 +- librz/asm/p/asm_arm_cs.c | 4 ++-- test/db/asm/{arm_cortex_16 => arm_cortexm_16} | 1 + test/db/cmd/cmd_pd | 6 +++--- test/db/cmd/cmd_pd_bugs | 10 +++++----- test/db/tools/rz_asm | 4 ++-- 6 files changed, 14 insertions(+), 13 deletions(-) rename test/db/asm/{arm_cortex_16 => arm_cortexm_16} (50%) diff --git a/librz/analysis/p/analysis_arm_cs.c b/librz/analysis/p/analysis_arm_cs.c index 7ad788816a..95ca7bde18 100644 --- a/librz/analysis/p/analysis_arm_cs.c +++ b/librz/analysis/p/analysis_arm_cs.c @@ -1737,7 +1737,7 @@ static int analysis_op(RzAnalysis *a, RzAnalysisOp *op, ut64 addr, const ut8 *bu int n, ret; mode |= (a->big_endian) ? CS_MODE_BIG_ENDIAN : CS_MODE_LITTLE_ENDIAN; if (RZ_STR_ISNOTEMPTY(a->cpu)) { - if (strstr(a->cpu, "cortex")) { + if (strstr(a->cpu, "cortexm") || strstr(a->cpu, "cortex-m")) { mode |= CS_MODE_MCLASS; } if (a->bits != 64 && strstr(a->cpu, "v8")) { diff --git a/librz/asm/p/asm_arm_cs.c b/librz/asm/p/asm_arm_cs.c index 5b614dd066..de5bac5e9d 100644 --- a/librz/asm/p/asm_arm_cs.c +++ b/librz/asm/p/asm_arm_cs.c @@ -102,7 +102,7 @@ static int disassemble(RzAsm *a, RzAsmOp *op, const ut8 *buf, int len) { } if (a->cpu) { - if (strstr(a->cpu, "cortex")) { + if (strstr(a->cpu, "cortexm") || strstr(a->cpu, "cortex-m")) { mode |= CS_MODE_MCLASS; } if (a->bits != 64) { @@ -298,7 +298,7 @@ static char *mnemonics(RzAsm *a, int id, bool json) { RzAsmPlugin rz_asm_plugin_arm_cs = { .name = "arm", .desc = "Capstone ARM disassembler", - .cpus = "v8,cortex,arm1176,cortexA72,cortexA8", + .cpus = "v8,cortexm,arm1176,cortexA72,cortexA8", .platforms = "bcm2835,omap3430", .features = "v8", .license = "BSD", diff --git a/test/db/asm/arm_cortex_16 b/test/db/asm/arm_cortexm_16 similarity index 50% rename from test/db/asm/arm_cortex_16 rename to test/db/asm/arm_cortexm_16 index c39296777a..3bd403e7f9 100644 --- a/test/db/asm/arm_cortex_16 +++ b/test/db/asm/arm_cortexm_16 @@ -1 +1,2 @@ d "mrs r0, primask" eff31080 +d "msr basepri, r3" 83f31188 diff --git a/test/db/cmd/cmd_pd b/test/db/cmd/cmd_pd index 5fcca74402..49c79c0df2 100644 --- a/test/db/cmd/cmd_pd +++ b/test/db/cmd/cmd_pd @@ -32,15 +32,15 @@ EXPECT=<