Fix arch.riscv.vs plugin (decoding always failed) ##arch

This commit is contained in:
pancake 2023-09-12 23:45:58 +02:00 committed by pancake
parent cfccd3d92d
commit db299d28cc
3 changed files with 8 additions and 5 deletions

View File

@ -76,14 +76,18 @@ static bool r_arch_cs_init(RArchSession *as, csh *cs_handle) {
}
#else
if (*cs_handle) {
if (as->config->syntax == R_ARCH_SYNTAX_ATT) {
switch (as->config->syntax) {
case R_ARCH_SYNTAX_ATT:
cs_option (*cs_handle, CS_OPT_SYNTAX, CS_OPT_SYNTAX_ATT);
break;
#if CS_API_MAJOR >= 4
} else if (as->config->syntax == R_ARCH_SYNTAX_MASM) {
case R_ARCH_SYNTAX_MASM:
cs_option (*cs_handle, CS_OPT_SYNTAX, CS_OPT_SYNTAX_MASM);
break;
#endif
} else {
default:
cs_option (*cs_handle, CS_OPT_SYNTAX, CS_OPT_SYNTAX_INTEL);
break;
}
}
#endif

View File

@ -119,7 +119,6 @@ static bool decode(RArchSession *as, RAnalOp *op, RArchDecodeMask mask) {
// WORDs must be aligned at even byte boundaries in the address space
static int archinfo(RArchSession *as, ut32 q) {
// R2_590
switch (q) {
case R_ANAL_ARCHINFO_ALIGN:
return 1;

View File

@ -259,7 +259,7 @@ static void set_opdir(RAnalOp *op) {
}
#define CSINC RISCV
#define CSINC_MODE (as->config->bits == 64)? CS_MODE_RISCV64: CS_MODE_RISCV32
#define CSINC_MODE (CS_MODE_RISCVC | ((as->config->bits == 64)? CS_MODE_RISCV64: CS_MODE_RISCV32))
#include "../capstone.inc.c"
static bool riscv_decode(RArchSession *a, RAnalOp *op, RArchDecodeMask mask) {