Skip to content

Commit

Permalink
arm: use cortexm cpu instead of cortex (#3674)
Browse files Browse the repository at this point in the history
  • Loading branch information
XVilka authored Jul 20, 2023
1 parent 8f1710a commit f1006f9
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion librz/analysis/p/analysis_arm_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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")) {
Expand Down
4 changes: 2 additions & 2 deletions librz/asm/p/asm_arm_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions test/db/asm/arm_cortex_16 → test/db/asm/arm_cortexm_16
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
d "mrs r0, primask" eff31080
d "msr basepri, r3" 83f31188
6 changes: 3 additions & 3 deletions test/db/cmd/cmd_pd
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ EXPECT=<<EOF
EOF
RUN

NAME=pd v8 and cortex
NAME=pd V8 and Cortex-M profiles
FILE=malloc://128
ARGS=-a arm -b 16
CMDS=<<EOF
echo
pad fff7c0ea@e:asm.cpu=v8
pad fff7c0ea@e:asm.cpu=cortex
pad fff7c0ea@e:asm.cpu=cortexm
pad fff7c0ea@e:asm.cpu=v8
pad fff7c0ea@e:asm.cpu=cortex
pad fff7c0ea@e:asm.cpu=cortexm
pad fff7c0ea@e:asm.cpu=v8
pad fff7c0ea@e:asm.cpu=
pad fff7c0ea@e:asm.cpu=tetris
Expand Down
10 changes: 5 additions & 5 deletions test/db/cmd/cmd_pd_bugs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ EXPECT=<<EOF
EOF
RUN

NAME=pd arm cortex 0
NAME=pd arm cortex-m 0
FILE==
ARGS=-a arm -b 16
CMDS=wx 80f30988; pi 1
Expand All @@ -25,20 +25,20 @@ EOF
EXPECT_ERR=
RUN

NAME=pd arm cortex 1
NAME=pd arm cortex-m 1
FILE==
ARGS=-a arm -b 16 -e asm.cpu=cortex
ARGS=-a arm -b 16 -e asm.cpu=cortexm
CMDS=wx 80f30988;pi 1
EXPECT=<<EOF
msr psp, r0
EOF
EXPECT_ERR=
RUN

NAME=pd arm cortex 2
NAME=pd arm cortex-m 2
FILE==
ARGS=-a arm -b 16
CMDS=e asm.cpu=cortex;wx 80f30988;pi 1
CMDS=e asm.cpu=cortexm;wx 80f30988;pi 1
EXPECT=<<EOF
msr psp, r0
EOF
Expand Down
4 changes: 2 additions & 2 deletions test/db/tools/rz_asm
Original file line number Diff line number Diff line change
Expand Up @@ -388,15 +388,15 @@ RUN

NAME=rz-asm -c
FILE==
CMDS=!rz-asm -a arm -b 16 -d -c cortex 0x80f30988
CMDS=!rz-asm -a arm -b 16 -d -c cortexm 0x80f30988
EXPECT=<<EOF
msr psp, r0
EOF
RUN

NAME=rz-asm -A with -c and -o
FILE==
CMDS=!rz-asm -a arm -b 16 -A -o 0x1000 -c cortex 0x80f30988
CMDS=!rz-asm -a arm -b 16 -A -o 0x1000 -c cortexm 0x80f30988
EXPECT=<<EOF
offset: 0x00001000
bytes: 80f30988
Expand Down

0 comments on commit f1006f9

Please sign in to comment.