static int enter_switch_op (ut64 addr, const ut8 * bytes ) { ut8 sz = (BYTES_CONSUMED+1) % 4 ? 1 + 4 - (BYTES_CONSUMED+1) % 4: 1; // + (BYTES_CONSUMED+1) % 4; ut8 sz2 = (4 - (addr+1) % 4) + (addr+1) % 4; IFDBG eprintf ("Addr approach: 0x%04x and BYTES_CONSUMED approach: 0x%04"PFMT64x", BYTES_CONSUMED%%4 = 0x%04x\n", sz2, BYTES_CONSUMED, sz); init_switch_op (); IN_SWITCH_OP = 1; SWITCH_OP.addr = addr; SWITCH_OP.def_jmp = (int)(UINT (bytes, sz)); SWITCH_OP.min_val = (int)(UINT (bytes, sz + 4)); SWITCH_OP.max_val = (int)(UINT (bytes, sz + 8)); sz += 12; return sz; }
static int enter_switch_op (ut64 addr, const ut8 * bytes, char *output, int outlen ) { ut8 idx = bytes[0]; IN_SWITCH_OP = 1; ut8 sz = (BYTES_CONSUMED+1) % 4 ? 1 + 4 - (BYTES_CONSUMED+1) % 4: 1; // + (BYTES_CONSUMED+1) % 4; ut8 sz2 = (4 - (addr+1) % 4) + (addr+1) % 4; IFDBG eprintf ("Addr approach: 0x%04x and BYTES_CONSUMED approach: 0x%04x\n", sz2, sz); init_switch_op (); IN_SWITCH_OP = 1; SWITCH_OP.addr = addr; SWITCH_OP.def_jmp = (ut32)(UINT (bytes, sz)); SWITCH_OP.min_val = (ut32)(UINT (bytes, sz + 4)); SWITCH_OP.max_val = (ut32)(UINT (bytes, sz + 8)); sz += 12; snprintf (output, outlen, "%s default: 0x%04"PFMT64x, JAVA_OPS[idx].name, SWITCH_OP.def_jmp+SWITCH_OP.addr); return update_bytes_consumed(sz); }
R_API void r_java_new_method () { IN_SWITCH_OP = 0; init_switch_op (); BYTES_CONSUMED = 0; }
R_API void r_java_new_method () { IFDBG eprintf ("Reseting the bytes consumed, they were: 0x%04"PFMT64x".\n", BYTES_CONSUMED); IN_SWITCH_OP = 0; init_switch_op (); BYTES_CONSUMED = 0; }