Add few tests for v850.gnu and fix instruction bounds ##disasm

This commit is contained in:
pancake 2020-11-25 16:31:10 +01:00 committed by pancake
parent c45c5180cf
commit b8f37cb0c3
9 changed files with 35 additions and 12 deletions

View File

@ -12,7 +12,7 @@ all: ${ALL_TARGETS}
ALL_TARGETS=
# TODO: rename to enabled plugins
ARCHS=null.mk ppc_gnu.mk ppc_cs.mk arm_gnu.mk avr.mk xap.mk dalvik.mk sh.mk ebc.mk gb.mk malbolge.mk ws.mk h8300.mk cr16.mk v850.mk msp430.mk sparc_gnu.mk sparc_cs.mk x86_cs.mk cris.mk 6502.mk snes.mk riscv.mk vax.mk xtensa.mk rsp.mk mcore.mk tricore.mk
ARCHS=null.mk ppc_gnu.mk ppc_cs.mk arm_gnu.mk avr.mk xap.mk dalvik.mk sh.mk ebc.mk gb.mk malbolge.mk ws.mk h8300.mk cr16.mk v850.mk v850_gnu.mk msp430.mk sparc_gnu.mk sparc_cs.mk x86_cs.mk cris.mk 6502.mk snes.mk riscv.mk vax.mk xtensa.mk rsp.mk mcore.mk tricore.mk
include $(ARCHS)
clean:

View File

@ -562,7 +562,7 @@ static int archinfo(RAnal *anal, int q) {
case R_ANAL_ARCHINFO_ALIGN:
return 2;
case R_ANAL_ARCHINFO_MAX_OP_SIZE:
return 6;
return 8;
case R_ANAL_ARCHINFO_MIN_OP_SIZE:
return 2;
}

View File

@ -60,6 +60,7 @@ r_asm_sources = [
'p/asm_tricore.c',
'p/asm_v810.c',
'p/asm_v850.c',
'p/asm_v850_gnu.c',
'p/asm_vax.c',
'p/asm_wasm.c',
'p/asm_ws.c',
@ -76,6 +77,8 @@ r_asm_sources = [
'arch/amd29k/amd29k.c',
#'arch/8051/8051_disas.c',
'arch/8051/8051_ass.c',
'arch/v850/gnu/v850-dis.c',
'arch/v850/gnu/v850-opc.c',
'arch/arc/gnu/arc-dis.c',
'arch/arc/gnu/arc-ext.c',
'arch/arc/gnu/arc-opc.c',

View File

@ -33,12 +33,9 @@ DECLARE_GENERIC_FPRINTF_FUNC()
static int disassemble(RAsm *a, RAsmOp *op, const ut8 *buf, int len) {
struct disassemble_info disasm_obj;
if (len < 6) {
return -1;
}
buf_global = &op->buf_asm;
Offset = a->pc;
memcpy (bytes, buf, 6);
memcpy (bytes, buf, R_MIN (len, 8));
/* prepare disassembler */
memset (&disasm_obj, '\0', sizeof (struct disassemble_info));
@ -69,9 +66,9 @@ static int disassemble(RAsm *a, RAsmOp *op, const ut8 *buf, int len) {
if (op->size == -1) {
r_strbuf_set (&op->buf_asm, "(data)");
}
if (!memcmp (buf, "\xff\xff\xff\xff\xff\xff", op->size)) {
if (!memcmp (buf, "\xff\xff\xff\xff\xff\xff\xff\xff", op->size)) {
r_strbuf_set (&op->buf_asm, "breakpoint");
return 2;
return 4;
}
return op->size;
}

View File

@ -144,6 +144,22 @@ typedef struct _utX {
#define B_UNSET(x, n) ((x) &= ~(1ULL << (n)))
#define B_TOGGLE(x, n) ((x) ^= (1ULL << (n)))
#define B11111 31
#define B11110 30
#define B11101 29
#define B11100 28
#define B11011 27
#define B11010 26
#define B11001 25
#define B11000 24
#define B10111 23
#define B10110 22
#define B10101 21
#define B10100 20
#define B10011 19
#define B10010 18
#define B10001 17
#define B10000 16
#define B1111 15
#define B1110 14
#define B1101 13

View File

@ -109,6 +109,7 @@ asm_plugins = [
'tricore',
'v810',
'v850',
'v850_gnu',
'vax',
'wasm',
'ws',

View File

@ -11,7 +11,6 @@ EXPECT=<<EOF
0x001000d0 5 74 sym.___main
0x0010011a 3 34 sym._exit
0x0010013c 18 768 sym.__printf_r
0x00100847 1 8 fcn.00100847
0x00100e72 1 46 fcn.00100e72
0x001014e0 1 36 fcn.001014e0
0x00101cb8 1 20 sym._vfprintf
@ -138,7 +137,6 @@ EXPECT=<<EOF
0x00104b72 1 154 fcn.00104b72
0x00104ec0 1 4 fcn.00104ec0
0x00104ec4 38 668 -> 648 sym.___udivdi3
0x001051e7 1 14 fcn.001051e7
0x001052d8 5 74 sym.___main
0x00105322 3 34 sym._exit
0x00105344 19 186 sym.__fclose_r
@ -201,7 +199,6 @@ EXPECT=<<EOF
0x0010772c 3 58 sym.__strerror_r
0x00107cd4 1 12 fcn.00107cd4
0x00107cea 1 12 fcn.00107cea
0x0010840d 1 8 fcn.0010840d
0x0010907e 1 10 fcn.0010907e
0x00109fce 4 146 fcn.00109fce
0x0010ade6 1 12 fcn.0010ade6
@ -212,7 +209,6 @@ EXPECT=<<EOF
0x0010ae5c 4 50 sym._system
0x0010ae8e 1 28 sym._write
0x0010aeaa 4 130 sym.__unlink_r
0x0010b5af 1 8 fcn.0010b5af
0x0010bbda 1 46 fcn.0010bbda
0x0010c248 1 36 fcn.0010c248
0x0010ca20 1 20 sym._vfprintf

7
test/db/asm/v850.gnu_32 Normal file
View File

@ -0,0 +1,7 @@
d "prepare {ep - lp}, 1" 83072100 0x0
d "prepare {ep - lp}, 0" 81072100 0x0
d "prepare {r20 - lp}, 1" 8307e1ff 0x0
d "dispose 1, {ep - lp}, r0" 43062000 0x0
d "ei" e0876001 0x0
# d "nop" 0000 0x0
# d "breakpoint" ffff 0x0

View File

@ -31,8 +31,11 @@ lang c
linenum true
lsyms true
machine NEC V800 series
maxopsz 8
minopsz 2
nx false
os linux
pcalign 2
pic false
relocs true
rpath NONE