From 230efd1f057a7a77f4ae1b58b0f881ba58425ba3 Mon Sep 17 00:00:00 2001 From: pancake Date: Fri, 6 Dec 2013 05:04:17 +0100 Subject: [PATCH] Rename {RAsmRAnal}Op inst_len and length to size --- TODO.md | 1 + libr/anal/bb.c | 4 +-- libr/anal/p/anal_8051.c | 2 +- libr/anal/p/anal_arc.c | 14 +++++----- libr/anal/p/anal_arm.c | 18 ++++++------- libr/anal/p/anal_avr.c | 4 +-- libr/anal/p/anal_bf.c | 4 +-- libr/anal/p/anal_c55plus.c | 4 +-- libr/anal/p/anal_csr.c | 4 +-- libr/anal/p/anal_dalvik.c | 2 +- libr/anal/p/anal_ebc.c | 2 +- libr/anal/p/anal_i8080.c | 2 +- libr/anal/p/anal_java.c | 2 +- libr/anal/p/anal_m68k.c | 4 +-- libr/anal/p/anal_mips.c | 4 +-- libr/anal/p/anal_ppc.c | 6 ++--- libr/anal/p/anal_sh.c | 34 +++++++++++------------ libr/anal/p/anal_sparc.c | 2 +- libr/anal/p/anal_x86_im.c | 6 ++--- libr/anal/p/anal_x86_simple.c | 48 ++++++++++++++++----------------- libr/anal/p/anal_x86_udis.c | 4 +-- libr/anal/p/anal_z80.c | 2 +- libr/asm/arch/c55plus/c55plus.c | 4 +-- libr/asm/arch/msil/demsil.c | 2 +- libr/asm/p/asm_8051.c | 2 +- libr/asm/p/asm_arc.c | 8 +++--- libr/asm/p/asm_arm.c | 8 +++--- libr/asm/p/asm_arm_winedbg.c | 4 +-- libr/asm/p/asm_avr.c | 2 +- libr/asm/p/asm_bf.c | 2 +- libr/asm/p/asm_csr.c | 2 +- libr/asm/p/asm_dalvik.c | 8 +++--- libr/asm/p/asm_dcpu16.c | 6 ++--- libr/asm/p/asm_ebc.c | 2 +- libr/asm/p/asm_gas.c | 2 +- libr/asm/p/asm_gb.c | 2 +- libr/asm/p/asm_i8080.c | 4 +-- libr/asm/p/asm_java.c | 4 +-- libr/asm/p/asm_m68k.c | 4 +-- libr/asm/p/asm_mips.c | 8 +++--- libr/asm/p/asm_msil.c | 2 +- libr/asm/p/asm_ppc.c | 8 +++--- libr/asm/p/asm_rar.c | 2 +- libr/asm/p/asm_sh.c | 8 +++--- libr/core/cmd_anal.c | 4 +-- libr/core/cmd_debug.c | 4 +-- libr/core/cmd_print.c | 2 +- libr/core/cmd_search.c | 6 ++--- libr/core/cmd_seek.c | 2 +- libr/core/core.c | 2 +- libr/include/r_anal.h | 2 +- libr/include/r_asm.h | 2 +- 52 files changed, 145 insertions(+), 146 deletions(-) diff --git a/TODO.md b/TODO.md index fef5049115..9a30f7c2e3 100644 --- a/TODO.md +++ b/TODO.md @@ -6,6 +6,7 @@ 0.9.8 ===== +* Rename anal.plugin into anal.arch ??? to keep in sync with asm.arch * use __unused if available * rafind2 : add support for unicode/widestring search * .dr- # documented... but not working diff --git a/libr/anal/bb.c b/libr/anal/bb.c index 5398654381..30ad076fed 100644 --- a/libr/anal/bb.c +++ b/libr/anal/bb.c @@ -111,9 +111,9 @@ R_API int r_anal_bb(RAnal *anal, RAnalBlock *bb, ut64 addr, ut8 *buf, ut64 len, if (dst && dst->reg && !strcmp (src->reg->name, pc)) { int memref = anal->bits/8; ut8 b[8]; - ut64 ptr = idx+addr+src->delta; //+op->length; + ut64 ptr = idx+addr+src->delta; anal->iob.read_at (anal->iob.io, ptr, b, memref); - r_anal_ref_add (anal, ptr, addr+idx-op->length, 'd'); + r_anal_ref_add (anal, ptr, addr+idx-op->size, 'd'); } } } diff --git a/libr/anal/p/anal_8051.c b/libr/anal/p/anal_8051.c index 9c6f520131..fd5a247856 100644 --- a/libr/anal/p/anal_8051.c +++ b/libr/anal/p/anal_8051.c @@ -45,7 +45,7 @@ static int i8051_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *buf, int len op->jump = o.addr; op->fail = addr+o.length; } - return op->length = o.length; + return op->size = o.length; } struct r_anal_plugin_t r_anal_plugin_8051 = { diff --git a/libr/anal/p/anal_arc.c b/libr/anal/p/anal_arc.c index fc58eeefe3..7a5331151c 100644 --- a/libr/anal/p/anal_arc.c +++ b/libr/anal/p/anal_arc.c @@ -17,11 +17,11 @@ static int arcompact_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, in highbyte = anal->big_endian? 1: 0; if (((b[lowbyte]&0xf8) >0x38) && ((b[lowbyte]&0xf8) != 0x48)) { - op->length = 2; + op->size = 2; } else { - op->length = 4; + op->size = 4; } -// some ops are 6 and others are 8 byte length +// some ops are 6 and others are 8 byte size op->fail = addr + 4; //eprintf ("----> ST %x\n", subopcode); //eprintf ("BC = 0x%x\n", basecode); @@ -60,7 +60,7 @@ static int arcompact_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, in break; default: /* This is 16 bit instruction */ - op->length = 2; + op->size = 2; op->fail = addr + 2; basecode = (b[1] & 0xf8) >> 3; switch (basecode) { @@ -91,7 +91,7 @@ static int arcompact_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, in } break; } - return op->length; + return op->size; } static int arc_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int len) { @@ -101,7 +101,7 @@ static int arc_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int len) /* ARCtangent A4 */ if (anal->bits == 16) return arcompact_op (anal, op, addr, data, len); - op->length = 4; + op->size = 4; op->fail = addr + 4; ut8 basecode = (b[3] & 0xf8) >> 3; switch (basecode) { @@ -143,7 +143,7 @@ static int arc_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int len) default: break; } - return op->length; + return op->size; } struct r_anal_plugin_t r_anal_plugin_arc = { diff --git a/libr/anal/p/anal_arm.c b/libr/anal/p/anal_arm.c index 6b5db800d0..7b3927bea5 100644 --- a/libr/anal/p/anal_arm.c +++ b/libr/anal/p/anal_arm.c @@ -41,7 +41,7 @@ static int op_thumb(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int le arm_set_thumb(arminsn, R_TRUE); arm_set_input_buffer(arminsn, data); arm_set_pc(arminsn, addr); - op->length = arm_disasm_one_insn(arminsn); + op->size = arm_disasm_one_insn(arminsn); op->jump = arminsn->jmp; op->fail = arminsn->fail; arm_free(arminsn); @@ -52,20 +52,20 @@ static int op_thumb(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int le if (((ins & B4(B1110,0,0,0)) == B4(B0010,0,0,0) ) && (1 == (ins & B4(1,B1000,0,0)) >> 11)) { // dp3 op->type = R_ANAL_OP_TYPE_CMP; - return op->length; + return op->size; } if ( (ins & B4(B1111,B1100,0,0)) == B4(B0100,0,0,0) ) { op_code = (ins & B4(0,B0011,B1100,0)) >> 6; if (op_code == 8 || op_code == 10) { // dp5 op->type = R_ANAL_OP_TYPE_CMP; - return op->length; + return op->size; } } if ( (ins & B4(B1111,B1100,0,0)) == B4(B0100,B0100,0,0) ) { op_code = (ins & B4(0,B0011,0,0)) >> 8; // dp8 if (op_code== 1) { op->type = R_ANAL_OP_TYPE_CMP; - return op->length; + return op->size; } } if (ins == 0xbf) { @@ -121,7 +121,7 @@ static int op_thumb(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int le op->type = R_ANAL_OP_TYPE_SWI; op->val = (ut64)(ins>>8); } - return op->length; + return op->size; } #if 0 @@ -184,7 +184,7 @@ static int arm_op32(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int le #endif if (anal->bits==16) return op_thumb (anal, op, addr, data, len); - op->length = 4; + op->size = 4; #if 0 fprintf(stderr, "CODE %02x %02x %02x %02x\n", codeA[0], codeA[1], codeA[2], codeA[3]); @@ -348,7 +348,7 @@ if ( //op->jump = arminsn->jmp; //op->fail = arminsn->fail; arm_free(arminsn); - return op->length; + return op->size; } @@ -364,7 +364,7 @@ static ut64 getaddr (ut64 addr, const ut8 *d) { static int arm_op64(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *d, int len) { memset (op, 0, sizeof (RAnalOp)); if (d[3]==0) return -1; // invalid - op->length = 4; + op->size = 4; op->type = R_ANAL_OP_TYPE_NULL; if (d[0]==0xc0 && d[3]==0xd6) { // defaults to x30 reg. but can be different @@ -402,7 +402,7 @@ static int arm_op64(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *d, int len) op->fail = addr+4; break; } - return op->length; + return op->size; } static int arm_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int len) { diff --git a/libr/anal/p/anal_avr.c b/libr/anal/p/anal_avr.c index 81a3ba2f2f..f91e486556 100644 --- a/libr/anal/p/anal_avr.c +++ b/libr/anal/p/anal_avr.c @@ -14,7 +14,7 @@ static int avr_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *buf, int len) if (op == NULL) return 2; - op->length = 2; + op->size = 2; if (*ins == 0) { op->type = R_ANAL_OP_TYPE_NOP; } else @@ -67,7 +67,7 @@ static int avr_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *buf, int len) op->eob = R_TRUE; //op->stackptr = } else op->type = R_ANAL_OP_TYPE_UNK; - return op->length; + return op->size; } RAnalPlugin r_anal_plugin_avr = { diff --git a/libr/anal/p/anal_bf.c b/libr/anal/p/anal_bf.c index c1570303d8..4ef1f1977b 100644 --- a/libr/anal/p/anal_bf.c +++ b/libr/anal/p/anal_bf.c @@ -10,7 +10,7 @@ static int bf_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *buf, int len) { if (op == NULL) return 1; memset (op, 0, sizeof (RAnalOp)); - op->length = 1; + op->size = 1; op->esil[0] = 0; switch (buf[0]) { case '[': op->type = R_ANAL_OP_TYPE_CMP; break; @@ -36,7 +36,7 @@ static int bf_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *buf, int len) { op->type = R_ANAL_OP_TYPE_TRAP; break; default: op->type = R_ANAL_OP_TYPE_NOP; break; } - return op->length; + return op->size; } struct r_anal_plugin_t r_anal_plugin_bf = { diff --git a/libr/anal/p/anal_c55plus.c b/libr/anal/p/anal_c55plus.c index ce8223f1ed..a09fe5d0a3 100644 --- a/libr/anal/p/anal_c55plus.c +++ b/libr/anal/p/anal_c55plus.c @@ -24,7 +24,7 @@ static int c55plus_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *buf, int l op->addr = addr; op->jump = op->fail = -1; op->ptr = op->val = -1; - op->length = ins_len; + op->size = ins_len; if (ins_len >= 1 && *ins == 0x20) { op->type = R_ANAL_OP_TYPE_NOP; @@ -75,7 +75,7 @@ static int c55plus_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *buf, int l op->type = R_ANAL_OP_TYPE_UNK; } - return op->length; + return op->size; } struct r_anal_plugin_t r_anal_plugin_c55plus = { diff --git a/libr/anal/p/anal_csr.c b/libr/anal/p/anal_csr.c index 5b46f56041..4f5420bca2 100644 --- a/libr/anal/p/anal_csr.c +++ b/libr/anal/p/anal_csr.c @@ -73,7 +73,7 @@ static int csr_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *bytes, int len memset (op, 0, sizeof (RAnalOp)); op->type = R_ANAL_OP_TYPE_UNK; - op->length = 2; + op->size = 2; switch (i2ut16 (in)) { case INST_NOP: @@ -212,7 +212,7 @@ static int csr_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *bytes, int len } break; } - return op->length; + return op->size; } struct r_anal_plugin_t r_anal_plugin_csr = { diff --git a/libr/anal/p/anal_dalvik.c b/libr/anal/p/anal_dalvik.c index f3895fc3d4..6fe1d8c300 100644 --- a/libr/anal/p/anal_dalvik.c +++ b/libr/anal/p/anal_dalvik.c @@ -16,7 +16,7 @@ static int dalvik_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int l memset (op, '\0', sizeof (RAnalOp)); op->type = R_ANAL_OP_TYPE_UNK; - op->length = sz; + op->size = sz; op->nopcode = 1; // Necesary?? switch(data[0]) { diff --git a/libr/anal/p/anal_ebc.c b/libr/anal/p/anal_ebc.c index 8f9e2a2930..6dc094bcc9 100644 --- a/libr/anal/p/anal_ebc.c +++ b/libr/anal/p/anal_ebc.c @@ -17,7 +17,7 @@ static int ebc_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *buf, int len) if (op == NULL) return 2; - ret = op->length = ebc_decode_command(buf, &cmd); + ret = op->size = ebc_decode_command(buf, &cmd); if (ret < 0) return ret; diff --git a/libr/anal/p/anal_i8080.c b/libr/anal/p/anal_i8080.c index 8f736a7362..5e3e8181b6 100644 --- a/libr/anal/p/anal_i8080.c +++ b/libr/anal/p/anal_i8080.c @@ -143,7 +143,7 @@ static int i8080_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int le op->type = R_ANAL_OP_TYPE_CALL; break; } - return op->length = ilen; + return op->size = ilen; } struct r_anal_plugin_t r_anal_plugin_i8080 = { diff --git a/libr/anal/p/anal_java.c b/libr/anal/p/anal_java.c index 9967003093..cfd280d5d7 100644 --- a/libr/anal/p/anal_java.c +++ b/libr/anal/p/anal_java.c @@ -40,7 +40,7 @@ static int java_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int len memset (op, '\0', sizeof (RAnalOp)); op->type = R_ANAL_OP_TYPE_UNK; - op->length = sz; + op->size= sz; switch (data[0]) { case 0xa9: // ret diff --git a/libr/anal/p/anal_m68k.c b/libr/anal/p/anal_m68k.c index 3088d48ca8..7acb9b5341 100644 --- a/libr/anal/p/anal_m68k.c +++ b/libr/anal/p/anal_m68k.c @@ -9,7 +9,7 @@ static int m68k_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *b, int len) { if (op == NULL) return 4; - op->length = 4; + op->size = 4; switch(b[0] &0xf0) { case 0xb0: op->type = R_ANAL_OP_TYPE_CMP; @@ -44,7 +44,7 @@ static int m68k_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *b, int len) { op->type = R_ANAL_OP_TYPE_UNK; break; } - return op->length; + return op->size; } struct r_anal_plugin_t r_anal_plugin_m68k = { diff --git a/libr/anal/p/anal_mips.c b/libr/anal/p/anal_mips.c index 2e38a6fab8..26f1ebe117 100644 --- a/libr/anal/p/anal_mips.c +++ b/libr/anal/p/anal_mips.c @@ -16,7 +16,7 @@ static int mips_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *b, int len) { memset (op, 0, sizeof (RAnalOp)); op->type = R_ANAL_OP_TYPE_UNK; - op->length = oplen; + op->size = oplen; op->delay = 4; op->esil[0] = 0; @@ -347,7 +347,7 @@ static int mips_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *b, int len) { mul.s fd, fs, ft 000010 10000 sub.s fd, fs, ft 000001 10000 #endif - return op->length; + return op->size; } struct r_anal_plugin_t r_anal_plugin_mips = { diff --git a/libr/anal/p/anal_ppc.c b/libr/anal/p/anal_ppc.c index 58fc425b29..92bbec683e 100644 --- a/libr/anal/p/anal_ppc.c +++ b/libr/anal/p/anal_ppc.c @@ -23,7 +23,7 @@ static int ppc_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *_bytes, int le memset (op, '\0', sizeof (RAnalOp)); op->addr = addr; op->type = 0; - op->length = 4; + op->size = 4; //eprintf("OPCODE IS %08x : %02x (opcode=%d) baddr = %d\n", addr, bytes[0], opcode, baddr); @@ -74,8 +74,8 @@ static int ppc_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *_bytes, int le op->eob = 1; break; } - op->length = 4; - return op->length; + op->size = 4; + return op->size; } static int set_reg_profile(RAnal *anal) { diff --git a/libr/anal/p/anal_sh.c b/libr/anal/p/anal_sh.c index 9b02f1282d..8fb5d3f110 100644 --- a/libr/anal/p/anal_sh.c +++ b/libr/anal/p/anal_sh.c @@ -205,14 +205,14 @@ static int first_nibble_is_0(RAnal* anal, RAnalOp* op, ut16 code){ } //TODO Check missing insns, specially STC might be interesting - return op->length; + return op->size; } static int movl_reg_rdisp(RAnal* anal, RAnalOp* op, ut16 code){ op->type = R_ANAL_OP_TYPE_MOV; op->src[0] = anal_fill_ai_rg(anal,GET_SOURCE_REG(code)); op->dst = anal_fill_reg_disp_mem(anal,GET_TARGET_REG(code),code&0x0F,LONG_SIZE); - return op->length; + return op->size; } @@ -246,7 +246,7 @@ static int first_nibble_is_2(RAnal* anal, RAnalOp* op, ut16 code){ } //TODO Handle 'pushes' (mov Rm,@-Rn) //TODO Handle CMP/STR ?? - return op->length; + return op->size; } @@ -261,7 +261,7 @@ static int first_nibble_is_3(RAnal* anal, RAnalOp* op, ut16 code){ op->src[0] = anal_fill_ai_rg(anal,GET_SOURCE_REG(code)); op->dst = anal_fill_ai_rg(anal,GET_TARGET_REG(code)); } - return op->length; + return op->size; } static int first_nibble_is_4(RAnal* anal, RAnalOp* op, ut16 code){ @@ -276,14 +276,14 @@ static int first_nibble_is_4(RAnal* anal, RAnalOp* op, ut16 code){ op->eob = R_TRUE; } //TODO shifts + many system insns + CMP/P[L|Z]?? - return op->length; + return op->size; } static int movl_rdisp_reg(RAnal* anal, RAnalOp* op, ut16 code){ op->type = R_ANAL_OP_TYPE_MOV; op->dst = anal_fill_ai_rg(anal,GET_TARGET_REG(code)); op->src[0] = anal_fill_reg_disp_mem(anal,GET_SOURCE_REG(code),code&0x0F,LONG_SIZE); - return op->length; + return op->size; } @@ -306,7 +306,7 @@ static int first_nibble_is_6(RAnal* anal, RAnalOp* op, ut16 code){ op->dst = anal_fill_ai_rg(anal,GET_TARGET_REG(code)); } //TODO neg(c) + MOV.L @Rm+,Rn - return op->length; + return op->size; } @@ -314,7 +314,7 @@ static int add_imm(RAnal* anal, RAnalOp* op, ut16 code){ op->type = R_ANAL_OP_TYPE_ADD; op->src[0] = anal_fill_im(anal, (st8)(code&0xFF)); //Casting to (st8) forces sign-extension. op->dst = anal_fill_ai_rg(anal,GET_TARGET_REG(code)); - return op->length; + return op->size; } static int first_nibble_is_8(RAnal* anal, RAnalOp* op, ut16 code){ @@ -335,14 +335,14 @@ static int first_nibble_is_8(RAnal* anal, RAnalOp* op, ut16 code){ op->src[0] = anal_fill_reg_disp_mem(anal,GET_SOURCE_REG(code),code&0x0F,WORD_SIZE); } //TODO some movs + CMP/EQ?? - return op->length; + return op->size; } static int movw_pcdisp_reg(RAnal* anal, RAnalOp* op, ut16 code){ op->type = R_ANAL_OP_TYPE_MOV; op->dst = anal_fill_ai_rg(anal, GET_TARGET_REG(code)); op->src[0] = anal_fill_reg_disp_mem(anal,PC_IDX,code&0xFF,WORD_SIZE); - return op->length; + return op->size; } static int bra(RAnal* anal, RAnalOp* op, ut16 code){ @@ -351,7 +351,7 @@ static int bra(RAnal* anal, RAnalOp* op, ut16 code){ op->delay = 1; op->jump = disarm_12bit_offset(op,GET_BRA_OFFSET(code)); op->eob = R_TRUE; - return op->length; + return op->size; } static int bsr(RAnal* anal, RAnalOp* op, ut16 code){ @@ -359,7 +359,7 @@ static int bsr(RAnal* anal, RAnalOp* op, ut16 code){ op->type = R_ANAL_OP_TYPE_CALL; op->jump = disarm_12bit_offset(op,GET_BRA_OFFSET(code)); op->delay = 1; - return op->length; + return op->size; } @@ -385,27 +385,27 @@ static int first_nibble_is_c(RAnal* anal, RAnalOp* op, ut16 code){ op->dst = anal_fill_ai_rg(anal,0); //Always R0 } //TODO Logic insns referencing GBR - return op->length; + return op->size; } static int movl_pcdisp_reg(RAnal* anal, RAnalOp* op, ut16 code){ op->type = R_ANAL_OP_TYPE_MOV; op->src[0] = anal_pcrel_disp_mov(anal,op,code&0x0F); op->dst = anal_fill_ai_rg(anal,GET_TARGET_REG(code)); - return op->length; + return op->size; } static int mov_imm_reg(RAnal* anal, RAnalOp* op, ut16 code){ op->type = R_ANAL_OP_TYPE_MOV; op->dst = anal_fill_ai_rg(anal,GET_TARGET_REG(code)); op->src[0] = anal_fill_im(anal,(st8)(code & 0xFF)); - return op->length; + return op->size; } static int fpu_insn(RAnal* anal, RAnalOp* op, ut16 code){ //Not interested on FPU stuff for now op->family = R_ANAL_OP_FAMILY_FPU; - return op->length; + return op->size; } /* Table of routines for further analysis based on 1st nibble */ @@ -445,7 +445,7 @@ static int sh_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int len) op->jump = op->fail = -1; op->ptr = op->val = -1; - op->length = 2; + op->size = 2; ret = first_nibble_decode[(b>>4) & 0x0F](anal,op,code); return ret; diff --git a/libr/anal/p/anal_sparc.c b/libr/anal/p/anal_sparc.c index 37b0c6c380..c3d8d32411 100644 --- a/libr/anal/p/anal_sparc.c +++ b/libr/anal/p/anal_sparc.c @@ -450,7 +450,7 @@ static int sparc_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int le memset (op, 0, sizeof (RAnalOp)); op->family = R_ANAL_OP_FAMILY_CPU; op->addr = addr; - op->length = sz; + op->size = sz; op->jump = op->fail = -1; op->ptr = op->val = -1; diff --git a/libr/anal/p/anal_x86_im.c b/libr/anal/p/anal_x86_im.c index a8e943460e..025c847899 100644 --- a/libr/anal/p/anal_x86_im.c +++ b/libr/anal/p/anal_x86_im.c @@ -801,7 +801,7 @@ static int x86_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int len) if (!memcmp ("\xf3\xc3", data, 2)) { op->type = R_ANAL_OP_TYPE_RET; - return op->length = 2; + return op->size = 2; } ret = -1; if (anal->bits==64) @@ -924,10 +924,10 @@ static int x86_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int len) else if (io.id == X86IM_IO_ID_LEAVE) /* leave */ op->type = R_ANAL_OP_TYPE_LEAVE; - op->length = io.len; + op->size = io.len; op->nopcode = io.opcode_count; } - return op->length; + return op->size; } static int set_reg_profile(RAnal *anal) { diff --git a/libr/anal/p/anal_x86_simple.c b/libr/anal/p/anal_x86_simple.c index 3552b220d4..811983f5a0 100644 --- a/libr/anal/p/anal_x86_simple.c +++ b/libr/anal/p/anal_x86_simple.c @@ -98,7 +98,7 @@ static int myop(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *buf, int len) { break; case 0xf4: // hlt op->type = R_ANAL_OP_TYPE_RET; - op->length = 1; + op->size = 1; break; case 0xc3: // ret case 0xc2: // ret + 2 bytes @@ -163,7 +163,7 @@ static int myop(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *buf, int len) { break; case 0x90: op->type = R_ANAL_OP_TYPE_NOP; - op->length = 1; + op->size = 1; break; case 0x0f: // 3 byte nop //0fbe55ff movsx edx, byte [ebp-0x1] @@ -177,19 +177,19 @@ static int myop(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *buf, int len) { } else if (buf[1]>=0x18 && buf[1]<=0x1f) { op->type = R_ANAL_OP_TYPE_NOP; - op->length = 3; + op->size = 3; } else if (buf[1]>=0x80 && buf[1]<=0x8f) { op->type = R_ANAL_OP_TYPE_CJMP; op->jump = addr+6+buf[2]+(buf[3]<<8)+(buf[4]<<16)+(buf[5]<<24);//((unsigned long)((buf+2))+6); op->fail = addr+6; - op->length = 6; + op->size = 6; //op->eob = 1; } else if (buf[1]>=0x40 && buf[1]<=0x4f) { /* Conditional MOV */ op->type = R_ANAL_OP_TYPE_MOV; op->eob = 0; - op->length = 4; + op->size = 4; return 4; } break; @@ -199,7 +199,7 @@ static int myop(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *buf, int len) { op->type = R_ANAL_OP_TYPE_SWI; break; case 0xf1: // int1 - op->length = 1; + op->size = 1; op->val = 1; op->type = R_ANAL_OP_TYPE_SWI; break; @@ -214,13 +214,13 @@ static int myop(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *buf, int len) { op->ptr = (st64)((int)buf[1]+(buf[2]<<8)+(buf[3]<<16)+(buf[4]<<24));//((unsigned long)((buf+2))+6); break; case 0xcd: - op->length = 2; + op->size = 2; op->type = R_ANAL_OP_TYPE_SWI; op->val = buf[1]; break; case 0xe8: // call op->type = R_ANAL_OP_TYPE_CALL; - op->length = 5; + op->size = 5; //op->jump = addr+*ptr+5; //(unsigned long)((buf+1)+5); op->jump = addr+5+buf[1]+(buf[2]<<8)+(buf[3]<<16)+(buf[4]<<24);//((unsigned long)((buf+2))+6); op->fail = addr+5; @@ -229,7 +229,7 @@ static int myop(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *buf, int len) { break; case 0xe9: // jmp op->type = R_ANAL_OP_TYPE_JMP; - op->length = 5; + op->size = 5; //op->jump = (unsigned long)((buf+1)+5); op->jump = addr+5+buf[1]+(buf[2]<<8)+(buf[3]<<16)+(buf[4]<<24);//((unsigned long)((buf+2))+6); op->fail = 0L; @@ -237,7 +237,7 @@ static int myop(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *buf, int len) { break; case 0xeb: // short jmp op->type = R_ANAL_OP_TYPE_JMP; - op->length = 2; + op->size = 2; op->jump = addr+((unsigned long)((char)buf[1])+2); op->fail = 0L; op->eob = 1; @@ -245,7 +245,7 @@ static int myop(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *buf, int len) { case 0xf2: // repnz case 0xf3: // repz op->type = R_ANAL_OP_TYPE_REP; - //op->length = dislen((unsigned char *)&buf); //instLength(buf, 16, 0); + //op->size = dislen((unsigned char *)&buf); //instLength(buf, 16, 0); op->jump = 0L; op->fail = 0L; break; @@ -268,14 +268,14 @@ static int myop(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *buf, int len) { } else if (buf[1]>=0xd0 && buf[1]<=0xd7) { op->type = R_ANAL_OP_TYPE_CALL; - op->length = 2; + op->size = 2; op->eob = 1; //op->jump = vm_arch_x86_regs[VM_X86_EAX+buf[1]-0xd0]; op->fail = addr+2; } else if (buf[1]>=0xe0 && buf[1]<=0xe7) { op->type = R_ANAL_OP_TYPE_UJMP; - op->length = 2; + op->size = 2; //op->jump = vm_arch_x86_regs[VM_X86_EAX+buf[1]-0xd0]; op->eob = 1; } @@ -307,14 +307,14 @@ static int myop(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *buf, int len) { case 0x5e: case 0x5f: op->type = R_ANAL_OP_TYPE_POP; - op->length = 1; + op->size = 1; op->stackptr = -4; break; case 0x2e: // 2e64796e jns 0xb770a4ab !! if (buf[1]>=0x64 && buf[1]<=0x67) { int ret = myop (anal, op, addr, buf+1, len-1); op->jump++; - op->length++; + op->size++; return ret; } break; @@ -324,8 +324,8 @@ static int myop(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *buf, int len) { case 0x67: op->type = R_ANAL_OP_TYPE_CJMP; op->jump = addr+3+buf[2]; //+(buf[2]<<8)+(buf[3]<<16); // XXX - op->length = 3; - op->fail = addr+op->length; + op->size = 3; + op->fail = addr+op->size; //op->eob = 1; break; case 0x68: @@ -372,7 +372,7 @@ static int myop(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *buf, int len) { op->src[1]->base = buf[2]; // 83f821 cmp eax, 0x21 op->type = R_ANAL_OP_TYPE_CMP; - op->length = 3; + op->size = 3; } break; case 0xec: @@ -463,7 +463,7 @@ static int myop(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *buf, int len) { /* conditional jump */ if (buf[1]>=0x80&&buf[1]<=0x8F) { op->type = R_ANAL_OP_TYPE_CJMP; - op->length = 6; + op->size = 6; op->jump = (unsigned long)((buf+2)+6); op->fail = addr+6; op->eob = 1; @@ -491,7 +491,7 @@ static int myop(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *buf, int len) { /* conditional jump */ //if (buf[1]>=0x80&&buf[1]<=0x8F) { op->type = R_ANAL_OP_TYPE_CJMP; - op->length = 2; + op->size = 2; // op->jump = (unsigned long)((buf+2)+6); op->jump = addr+bo+2; //(unsigned long)((buf+1)+5); op->fail = addr+2; @@ -503,12 +503,12 @@ static int myop(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *buf, int len) { //op->type = R_ANAL_OP_TYPE_UNK; } - //if (op->length == 0) - op->length = dislen ((unsigned char *)buf, 64); //instLength(buf, 16, 0); - //op->length = instLength(buf, 16, 0); + //if (op->size == 0) + op->size = dislen ((unsigned char *)buf, 64); //instLength(buf, 16, 0); + //op->size = instLength(buf, 16, 0); if (!(op->jump>>33)) op->jump &= 0xFFFFFFFF; // XXX may break on 64 bits here - return op->length; + return op->size; } struct r_anal_plugin_t r_anal_plugin_x86_simple = { diff --git a/libr/anal/p/anal_x86_udis.c b/libr/anal/p/anal_x86_udis.c index 5ac9e349c3..67e5c13ff8 100644 --- a/libr/anal/p/anal_x86_udis.c +++ b/libr/anal/p/anal_x86_udis.c @@ -161,7 +161,7 @@ int x86_udis86_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int len) op->addr = addr; op->jump = op->fail = -1; op->ptr = op->val = -1; - oplen = op->length = ud_insn_len (&u); + oplen = op->size = ud_insn_len (&u); op->esil[0] = 0; if (anal->decode) @@ -187,7 +187,7 @@ int x86_udis86_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int len) switch (u.mnemonic) { case UD_Iinvalid: - oplen = op->length = -1; + oplen = op->size = -1; return -1; break; case UD_Itest: diff --git a/libr/anal/p/anal_z80.c b/libr/anal/p/anal_z80.c index c19c8c0adc..fd60bb2756 100644 --- a/libr/anal/p/anal_z80.c +++ b/libr/anal/p/anal_z80.c @@ -140,7 +140,7 @@ static int z80_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int len) op->type = R_ANAL_OP_TYPE_CALL; break; } - return op->length = ilen; + return op->size= ilen; } struct r_anal_plugin_t r_anal_plugin_z80 = { diff --git a/libr/asm/arch/c55plus/c55plus.c b/libr/asm/arch/c55plus/c55plus.c index fd7f370cce..0ac7125ed4 100644 --- a/libr/asm/arch/c55plus/c55plus.c +++ b/libr/asm/arch/c55plus/c55plus.c @@ -27,12 +27,12 @@ int c55plus_disassemble(RAsm *a, RAsmOp *op, const ut8 *buf, int len) { // decode instruction ins_decoded = decode(0, &next_ins_pos); if (!ins_decoded) { - op->inst_len = 0; + op->size = 0; return 0; } // opcode length - op->inst_len = next_ins_pos; + op->size = next_ins_pos; ins_decoded_len = strlen(ins_decoded); for (i = 0; i < ins_decoded_len; i++) ins_decoded[i] = tolower(ins_decoded[i]); diff --git a/libr/asm/arch/msil/demsil.c b/libr/asm/arch/msil/demsil.c index 10b5040095..b12ad4ff79 100644 --- a/libr/asm/arch/msil/demsil.c +++ b/libr/asm/arch/msil/demsil.c @@ -140,7 +140,7 @@ int GetSingleMSILInstr(const u8 *pMemory, ut32 MemorySize, DISASMSIL_OFFSET Code // demsil_get(pCurInstr, CurInstr, u8); - if (CurInstr >= 0x00 && CurInstr <= 0xE0) + if (CurInstr <= 0xE0) goto getinstr; // diff --git a/libr/asm/p/asm_8051.c b/libr/asm/p/asm_8051.c index ba1d1ba28f..d448170ce3 100644 --- a/libr/asm/p/asm_8051.c +++ b/libr/asm/p/asm_8051.c @@ -14,7 +14,7 @@ static int disassemble(RAsm *a, RAsmOp *op, const ut8 *buf, int len) { *op->buf_asm = 0; if (!o.name) return 0; // invalid instruction do8051disasm (o, a->pc, op->buf_asm, sizeof (op->buf_asm)); - return (op->inst_len = o.length); + return (op->size = o.length); } RAsmPlugin r_asm_plugin_8051 = { diff --git a/libr/asm/p/asm_arc.c b/libr/asm/p/asm_arc.c index d68d3a9f97..afffa5ec00 100644 --- a/libr/asm/p/asm_arc.c +++ b/libr/asm/p/asm_arc.c @@ -77,12 +77,12 @@ static int disassemble(RAsm *a, RAsmOp *op, const ut8 *buf, int len) { op->buf_asm[0]='\0'; if (a->bits==16) - op->inst_len = ARCompact_decodeInstr ((bfd_vma)Offset, &disasm_obj); - else op->inst_len = ARCTangent_decodeInstr ((bfd_vma)Offset, &disasm_obj); + op->size = ARCompact_decodeInstr ((bfd_vma)Offset, &disasm_obj); + else op->size = ARCTangent_decodeInstr ((bfd_vma)Offset, &disasm_obj); - if (op->inst_len == -1) + if (op->size == -1) strncpy (op->buf_asm, " (data)", R_ASM_BUFSIZE); - return op->inst_len; + return op->size; } RAsmPlugin r_asm_plugin_arc = { diff --git a/libr/asm/p/asm_arm.c b/libr/asm/p/asm_arm.c index c5a44b3b92..c9f980e4cc 100644 --- a/libr/asm/p/asm_arm.c +++ b/libr/asm/p/asm_arm.c @@ -159,16 +159,16 @@ oldcpucode = cpucode; obj.disassembler_options = NULL; /* is endianness ignored on 64bits? */ //r_mem_copyendian (bytes, buf, 4, !a->big_endian); - op->inst_len = print_insn_aarch64 ((bfd_vma)Offset, &obj); + op->size = print_insn_aarch64 ((bfd_vma)Offset, &obj); } else { obj.disassembler_options = options; - op->inst_len = obj.endian? + op->size = obj.endian? print_insn_little_arm ((bfd_vma)Offset, &obj): print_insn_big_arm ((bfd_vma)Offset, &obj); } - if (op->inst_len == -1) + if (op->size == -1) strncpy (op->buf_asm, " (data)", R_ASM_BUFSIZE); - return op->inst_len; + return op->size; } static int assemble(RAsm *a, RAsmOp *op, const char *buf) { diff --git a/libr/asm/p/asm_arm_winedbg.c b/libr/asm/p/asm_arm_winedbg.c index b42231c1a9..28eea2cef9 100644 --- a/libr/asm/p/asm_arm_winedbg.c +++ b/libr/asm/p/asm_arm_winedbg.c @@ -20,11 +20,11 @@ static int disassemble(RAsm *a, RAsmOp *op, const ut8 *buf, int len) { } else { arm_set_input_buffer (arminsn, buf); } - op->inst_len = arm_disasm_one_insn (arminsn); + op->size = arm_disasm_one_insn (arminsn); strncpy (op->buf_asm, arm_insn_asm (arminsn), R_ASM_BUFSIZE); strncpy (op->buf_hex, arm_insn_hex (arminsn), R_ASM_BUFSIZE); arm_free (arminsn); - return op->inst_len; + return op->size; } RAsmPlugin r_asm_plugin_arm_winedbg = { diff --git a/libr/asm/p/asm_avr.c b/libr/asm/p/asm_avr.c index 2de52f343a..0c6cc640c1 100644 --- a/libr/asm/p/asm_avr.c +++ b/libr/asm/p/asm_avr.c @@ -12,7 +12,7 @@ #include "../arch/avr/disasm.c" static int disassemble(RAsm *a, RAsmOp *op, const ut8 *buf, int len) { - return op->inst_len = avrdis (op->buf_asm, a->pc, buf, len); + return op->size = avrdis (op->buf_asm, a->pc, buf, len); } RAsmPlugin r_asm_plugin_avr = { diff --git a/libr/asm/p/asm_bf.c b/libr/asm/p/asm_bf.c index a536a5c8ba..08d859971b 100644 --- a/libr/asm/p/asm_bf.c +++ b/libr/asm/p/asm_bf.c @@ -66,7 +66,7 @@ static int disassemble(RAsm *a, RAsmOp *op, const ut8 *buf, int len) { if (i<1) i=1; else i++; free (buf_cp); - op->inst_len = i; + op->size = i; return i; } diff --git a/libr/asm/p/asm_csr.c b/libr/asm/p/asm_csr.c index 3f1323ac19..43ace17968 100644 --- a/libr/asm/p/asm_csr.c +++ b/libr/asm/p/asm_csr.c @@ -30,7 +30,7 @@ static int arch_csr_disasm(char *str, const unsigned char *buf, ut64 seek) { } static int disassemble(RAsm *a, struct r_asm_op_t *op, const ut8 *buf, int len) { arch_csr_disasm (op->buf_asm, buf, a->pc); - return (op->inst_len=2); + return (op->size=2); } RAsmPlugin r_asm_plugin_csr = { diff --git a/libr/asm/p/asm_dalvik.c b/libr/asm/p/asm_dalvik.c index d618017795..39cb20ea25 100644 --- a/libr/asm/p/asm_dalvik.c +++ b/libr/asm/p/asm_dalvik.c @@ -381,13 +381,13 @@ static int dalvik_disassemble (RAsm *a, RAsmOp *op, const ut8 *buf, int len) { } } else if (len>0) { strcpy (op->buf_asm, "invalid "); - op->inst_len = len; + op->size = len; size = len; } op->payload = payload; size += payload; // XXX // align to 2 - op->inst_len = size; + op->size = size; return size; } @@ -400,8 +400,8 @@ static int dalvik_assemble(RAsm *a, RAsmOp *op, const char *buf) { for (i=0; i<256; i++) if (!strcmp (dalvik_opcodes[i].name, buf)) { r_mem_copyendian (op->buf, (void*)&i, 4, a->big_endian); - op->inst_len = dalvik_opcodes[i].len; - return op->inst_len; + op->size = dalvik_opcodes[i].len; + return op->size; } return 0; } diff --git a/libr/asm/p/asm_dcpu16.c b/libr/asm/p/asm_dcpu16.c index fe1a53690f..e6c91e1357 100644 --- a/libr/asm/p/asm_dcpu16.c +++ b/libr/asm/p/asm_dcpu16.c @@ -12,10 +12,10 @@ // ut64 for length here is overkill! static int disassemble(RAsm *a, RAsmOp *op, const ut8 *buf, int len) { if (len<2) return -1; // at least 2 bytes! - op->inst_len = dcpu16_disasm (op->buf_asm, (const ut16*)buf, len, NULL); - if (op->inst_len == -1) + op->size = dcpu16_disasm (op->buf_asm, (const ut16*)buf, len, NULL); + if (op->size == -1) strcpy (op->buf_asm, " (data)"); - return op->inst_len; + return op->size; } static int assemble(RAsm *a, RAsmOp *op, const char *buf) { diff --git a/libr/asm/p/asm_ebc.c b/libr/asm/p/asm_ebc.c index f33d2bbc79..0e5b294808 100644 --- a/libr/asm/p/asm_ebc.c +++ b/libr/asm/p/asm_ebc.c @@ -19,7 +19,7 @@ static int disassemble(RAsm *a, RAsmOp *op, const ut8 *buf, int len) { snprintf(op->buf_asm, R_ASM_BUFSIZE, "%s %s", cmd.instr, cmd.operands); else snprintf(op->buf_asm, R_ASM_BUFSIZE, "%s", cmd.instr); - op->inst_len = ret; + op->size = ret; return ret; } diff --git a/libr/asm/p/asm_gas.c b/libr/asm/p/asm_gas.c index 0e54490a70..9cc0cf91e0 100644 --- a/libr/asm/p/asm_gas.c +++ b/libr/asm/p/asm_gas.c @@ -19,7 +19,7 @@ static int assemble(RAsm *a, RAsmOp *op, const char *buf) { memcpy (op->buf, out, len<=R_ASM_BUFSIZE?len:R_ASM_BUFSIZE); free (out); } - op->inst_len = len; + op->size = len; return len; } diff --git a/libr/asm/p/asm_gb.c b/libr/asm/p/asm_gb.c index 8bd55bd9dd..30ec9acc8b 100644 --- a/libr/asm/p/asm_gb.c +++ b/libr/asm/p/asm_gb.c @@ -12,7 +12,7 @@ static int disassemble(RAsm *a, RAsmOp *r_op, const ut8 *buf, ut64 len) { int dlen = gbDisass(r_op,buf,len); if(dlen<0) dlen=0; - r_op->inst_len=dlen; + r_op->size=dlen; return dlen; } diff --git a/libr/asm/p/asm_i8080.c b/libr/asm/p/asm_i8080.c index 1491ade8a9..7bd3f950d8 100644 --- a/libr/asm/p/asm_i8080.c +++ b/libr/asm/p/asm_i8080.c @@ -10,8 +10,8 @@ static int do_disassemble(RAsm *a, struct r_asm_op_t *op, const ut8 *buf, int len) { int dlen = i8080_disasm (buf, op->buf_asm, len); if (dlen<0) dlen = 0; - op->inst_len = dlen; - return op->inst_len; + op->size = dlen; + return op->size; } RAsmPlugin r_asm_plugin_i8080 = { diff --git a/libr/asm/p/asm_java.c b/libr/asm/p/asm_java.c index 0819b0719d..6b05910f04 100644 --- a/libr/asm/p/asm_java.c +++ b/libr/asm/p/asm_java.c @@ -19,13 +19,13 @@ static int disassemble(RAsm *a, RAsmOp *op, const ut8 *buf, int len) { if (obj) r_java_set_obj (obj); } } - return op->inst_len = r_java_disasm (a->pc, buf, + return op->size = r_java_disasm (a->pc, buf, op->buf_asm, sizeof (op->buf_asm)); } static int assemble(RAsm *a, RAsmOp *op, const char *buf) { // TODO: get class info from bin if possible - return op->inst_len = r_java_assemble (op->buf, buf); + return op->size = r_java_assemble (op->buf, buf); } RAsmPlugin r_asm_plugin_java = { diff --git a/libr/asm/p/asm_m68k.c b/libr/asm/p/asm_m68k.c index 73f8110ab2..93755291cb 100644 --- a/libr/asm/p/asm_m68k.c +++ b/libr/asm/p/asm_m68k.c @@ -25,9 +25,9 @@ static int disassemble(RAsm *a, RAsmOp *aop, const ut8 *buf, int len) { dp.instr = bof; M68k_Disassemble(&dp); snprintf (aop->buf_asm, R_ASM_BUFSIZE, "%s %s", opcode, operands); - aop->inst_len = 4; + aop->size = 4; - return aop->inst_len; + return aop->size; } RAsmPlugin r_asm_plugin_m68k = { diff --git a/libr/asm/p/asm_mips.c b/libr/asm/p/asm_mips.c index 88f7120cbd..92149b21bf 100644 --- a/libr/asm/p/asm_mips.c +++ b/libr/asm/p/asm_mips.c @@ -79,11 +79,11 @@ static int disassemble(struct r_asm_t *a, struct r_asm_op_t *op, const ut8 *buf, op->buf_asm[0] = '\0'; if (a->big_endian) - op->inst_len = print_insn_big_mips ((bfd_vma)Offset, &disasm_obj); - else op->inst_len = print_insn_little_mips ((bfd_vma)Offset, &disasm_obj); - if (op->inst_len == -1) + op->size = print_insn_big_mips ((bfd_vma)Offset, &disasm_obj); + else op->size = print_insn_little_mips ((bfd_vma)Offset, &disasm_obj); + if (op->size == -1) strncpy (op->buf_asm, " (data)", R_ASM_BUFSIZE); - return op->inst_len; + return op->size; } static int assemble(RAsm *a, RAsmOp *op, const char *str) { diff --git a/libr/asm/p/asm_msil.c b/libr/asm/p/asm_msil.c index 3eb675e642..af5f746c41 100644 --- a/libr/asm/p/asm_msil.c +++ b/libr/asm/p/asm_msil.c @@ -22,7 +22,7 @@ static int arch_msil_disasm(char *str, const ut8 *buf, ut64 seek) { static int disassemble(RAsm *a, struct r_asm_op_t *op, const ut8 *buf, int len) { arch_msil_disasm (op->buf_asm, buf, a->pc); - return (op->inst_len=2); + return (op->size=2); } RAsmPlugin r_asm_plugin_msil = { diff --git a/libr/asm/p/asm_ppc.c b/libr/asm/p/asm_ppc.c index fa73dbac57..f92c40e78a 100644 --- a/libr/asm/p/asm_ppc.c +++ b/libr/asm/p/asm_ppc.c @@ -79,13 +79,13 @@ static int disassemble(RAsm *a, struct r_asm_op_t *op, const ut8 *buf, int len) op->buf_asm[0]='\0'; if (a->big_endian) - op->inst_len = print_insn_big_powerpc((bfd_vma)Offset, &disasm_obj); - else op->inst_len = print_insn_little_powerpc((bfd_vma)Offset, &disasm_obj); + op->size = print_insn_big_powerpc((bfd_vma)Offset, &disasm_obj); + else op->size = print_insn_little_powerpc((bfd_vma)Offset, &disasm_obj); - if (op->inst_len == -1) + if (op->size == -1) strncpy (op->buf_asm, " (data)", R_ASM_BUFSIZE); - return op->inst_len; + return op->size; } RAsmPlugin r_asm_plugin_ppc = { diff --git a/libr/asm/p/asm_rar.c b/libr/asm/p/asm_rar.c index 4bca08b3ac..29c570c17f 100644 --- a/libr/asm/p/asm_rar.c +++ b/libr/asm/p/asm_rar.c @@ -18,7 +18,7 @@ static int disassemble(RAsm *a, RAsmOp *op, const ut8 *buf, int len) { // XXX: This is wrong, some opcodes are 32bit in thumb mode static int assemble(RAsm *a, RAsmOp *op, const char *str) { Bitbuf b = {.out = op->buf, .bits = 0}; - return op->inst_len = rarvm_assemble (&b, str); + return op->size = rarvm_assemble (&b, str); } RAsmPlugin r_asm_plugin_rar = { diff --git a/libr/asm/p/asm_sh.c b/libr/asm/p/asm_sh.c index b6f27db6f1..c8cc42a247 100644 --- a/libr/asm/p/asm_sh.c +++ b/libr/asm/p/asm_sh.c @@ -70,12 +70,12 @@ static int disassemble(RAsm *a, RAsmOp *op, const ut8 *buf, int len) { disasm_obj.fprintf_func = &buf_fprintf; disasm_obj.stream = stdout; - op->buf_asm[0]='\0'; - op->inst_len = print_insn_shl ((bfd_vma)Offset, &disasm_obj); + op->buf_asm[0] = '\0'; + op->size = print_insn_shl ((bfd_vma)Offset, &disasm_obj); - if (op->inst_len == -1) + if (op->size == -1) strncpy (op->buf_asm, " (data)", R_ASM_BUFSIZE); - return op->inst_len; + return op->size; } RAsmPlugin r_asm_plugin_sh = { diff --git a/libr/core/cmd_anal.c b/libr/core/cmd_anal.c index 432b65e894..515612e0eb 100644 --- a/libr/core/cmd_anal.c +++ b/libr/core/cmd_anal.c @@ -720,9 +720,7 @@ eprintf ("XXX: This command conflicts with 'ar'\n"); if (ptr != NULL) { RAnalOp *op = r_core_op_anal (core, addr); if (op != NULL) { - //eprintf("at(0x%08"PFMT64x")=%d (%s)\n", addr, atoi(ptr+1), ptr+1); - //trace_set_times(addr, atoi(ptr+1)); - RDebugTracepoint *tp = r_debug_trace_add (core->dbg, addr, op->length); + RDebugTracepoint *tp = r_debug_trace_add (core->dbg, addr, op->size); tp->count = atoi (ptr+1); r_anal_trace_bb (core->anal, addr); r_anal_op_free (op); diff --git a/libr/core/cmd_debug.c b/libr/core/cmd_debug.c index 7bbfd70ca9..6d53e505df 100644 --- a/libr/core/cmd_debug.c +++ b/libr/core/cmd_debug.c @@ -219,7 +219,7 @@ static void cmd_debug_backtrace (RCore *core, const char *input) { // XXX Do asm.arch should define the max size of opcode? r_core_read_at (core, addr, buf, 32); // XXX longer opcodes? r_anal_op (core->anal, &analop, addr, buf, sizeof (buf)); - } while (r_bp_traptrace_at (core->dbg->bp, addr, analop.length)); + } while (r_bp_traptrace_at (core->dbg->bp, addr, analop.size)); r_bp_traptrace_enable (core->dbg->bp, R_FALSE); } } @@ -959,7 +959,7 @@ static int cmd_debug(void *data, const char *input) { eprintf ("Dont know how to skip this instruction\n"); break; } - addr += aop.length; + addr += aop.size; } r_debug_reg_set (core->dbg, "pc", addr); } diff --git a/libr/core/cmd_print.c b/libr/core/cmd_print.c index 91027c27e7..645056a1b5 100644 --- a/libr/core/cmd_print.c +++ b/libr/core/cmd_print.c @@ -909,7 +909,7 @@ static int cmd_print(void *data, const char *input) { } else { r_cons_printf ("0x%08"PFMT64x" %16s %s\n", core->offset+pdn_offset, asmop.buf_hex, asmop.buf_asm); - pdn_offset += (go_by_instr? asmop.inst_len: 1); + pdn_offset += (go_by_instr? asmop.size: 1); } } if (buf != core->block) free (buf); diff --git a/libr/core/cmd_search.c b/libr/core/cmd_search.c index acfb3c4ecb..d9e9157d6a 100644 --- a/libr/core/cmd_search.c +++ b/libr/core/cmd_search.c @@ -218,8 +218,8 @@ static ut64 findprevopsz(RCore *core, ut64 addr) { r_io_read_at (core->io, base, buf, sizeof (buf)); for (i=0; i<16; i++) { if (r_anal_op (core->anal, &aop, addr-i, buf+120-i, 16+i)) { - if (aop.length<1) break; - if (i == aop.length) { + if (aop.size<1) break; + if (i == aop.size) { switch (aop.type) { case R_ANAL_OP_TYPE_ILL: case R_ANAL_OP_TYPE_TRAP: @@ -268,7 +268,7 @@ static int r_core_search_rop(RCore *core, ut64 from, ut64 to, int opt) { ropat = prev2; else ropat = prev; } else ropat = from+i; - roplen = from - ropat + i + aop.length; + roplen = from - ropat + i + aop.size; r_core_cmdf (core, "pD %d @ 0x%"PFMT64x, roplen, ropat); break; diff --git a/libr/core/cmd_seek.c b/libr/core/cmd_seek.c index 62134361e1..d63aa2b079 100644 --- a/libr/core/cmd_seek.c +++ b/libr/core/cmd_seek.c @@ -14,7 +14,7 @@ static int prevopsz (RCore *core, ut64 addr) { ret = r_anal_op (core->anal, &op, base+i, buf+i, sizeof (buf)-i); if (!ret) continue; - len = op.length; + len = op.size; r_anal_op_fini (&op); // XXX if (len<1) continue; i += len-1; diff --git a/libr/core/core.c b/libr/core/core.c index 11557dbf22..c1ef27e833 100644 --- a/libr/core/core.c +++ b/libr/core/core.c @@ -121,7 +121,7 @@ static ut64 num_callback(RNum *userptr, const char *str, int *ok) { case 'j': return op.jump; case 'f': return op.fail; case 'm': return op.ptr; // memref - case 'l': return op.length; + case 'l': return op.size; case 'b': return core->blocksize; case 's': return core->file->size; case 'w': return r_config_get_i (core->config, "asm.bits") / 8; diff --git a/libr/include/r_anal.h b/libr/include/r_anal.h index 87b26a18d9..5c2f94a391 100644 --- a/libr/include/r_anal.h +++ b/libr/include/r_anal.h @@ -554,7 +554,7 @@ typedef struct r_anal_op_t { ut64 type; /* type of opcode */ int stackop; /* operation on stack? */ int cond; /* condition type */ - int length; /* length in bytes of opcode */ + int size; /* size in bytes of opcode */ int nopcode; /* number of bytes representing the opcode (not the arguments) */ int family; /* family of opcode */ int eob; /* end of block (boolean) */ diff --git a/libr/include/r_asm.h b/libr/include/r_asm.h index 4534b40fd1..12bc7c9e63 100644 --- a/libr/include/r_asm.h +++ b/libr/include/r_asm.h @@ -57,7 +57,7 @@ enum { }; typedef struct r_asm_op_t { - int inst_len; // rename to size or length + int size; // instruction size int payload; // size of payload (opsize = (intstlen-payload)) // But this is pretty slow..so maybe we should add some accessors ut8 buf[R_ASM_BUFSIZE];