18 int vA, vB, vC, vD, vE, vF, vG, vH, payload = 0,
i = (
int)
buf[0];
22 char *flag_str =
NULL;
25 const char *buf_asm =
NULL;
37 int first_key =
buf[4] | (
buf[5] << 8) | (
buf[6] << 16) | (
buf[7] << 24);
38 buf_asm =
sdb_fmt(
"packed-switch-payload %d, %d", array_size, first_key);
40 payload = 2 * (array_size * 2);
50 buf_asm =
sdb_fmt(
"sparse-switch-payload %d", array_size);
52 payload = 2 * (array_size * 4);
63 buf_asm =
sdb_fmt(
"fill-array-data-payload %d, %d", elem_width, array_size);
64 payload = array_size * elem_width;
85 vB = (
buf[1] & 0xf0) >> 4;
91 vB = (
buf[3] << 8) |
buf[2];
96 vA = (
buf[3] << 8) |
buf[2];
97 vB = (
buf[5] << 8) |
buf[4];
108 vB = (
buf[1] & 0xf0) >> 4;
115 short sB = (
buf[3] << 8) |
buf[2];
122 vB =
buf[2] | (
buf[3] << 8) | (
buf[4] << 16) | (
buf[5] << 24);
123 if (
buf[0] == 0x17) {
124 rz_strf(
str,
" v%i:v%i, 0x%08x", vA, vA + 1, vB);
133 vB = 0 | (
buf[2] << 16) | (
buf[3] << 24);
134 if (
buf[0] == 0x19) {
135 rz_strf(
str,
" v%i:v%i, 0x%08x", vA, vA + 1, vB);
166 vB = (
buf[1] & 0xf0) >> 4;
167 vC = (
buf[3] << 8) |
buf[2];
172 vA = (
signed char)
buf[1];
178 vA = (short)(
buf[3] << 8 |
buf[2]);
197 vB = (
buf[1] & 0xf0) >> 4;
205 vB = (short)(
buf[2] | (
buf[3] << 8) | (
buf[4] << 16) | (
buf[5] << 24));
210 vA = (
int)(
buf[1] & 0x0f);
211 vB = (
buf[3] << 8) |
buf[2];
225 (
buf[4] & 0xf0) >> 4,
buf[5] & 0x0f, (
buf[5] & 0xf0) >> 4);
237 vB = (
buf[3] << 8) |
buf[2];
238 vC = (
buf[5] << 8) |
buf[4];
239 rz_strf(
str,
" {v%i..v%i}, [%04x]", vC, vC + vA - 1, vB);
243 vA = (
int)(
buf[1] & 0xf0) >> 4;
244 vB = (
buf[3] << 8) |
buf[2];
254 (
buf[4] & 0xf0) >> 4,
buf[5] & 0x0f);
258 (
buf[4] & 0xf0) >> 4,
buf[5] & 0x0f, (
buf[5] & 0xf0) >> 4);
270 vB = (
buf[3] << 8) |
buf[2];
271 if (
buf[0] == 0x1a) {
278 }
else if (
buf[0] == 0x1c ||
buf[0] == 0x1f ||
buf[0] == 0x22) {
296 vA = (
buf[1] & 0x0f);
297 vB = (
buf[1] & 0xf0) >> 4;
298 vC = (
buf[3] << 8) |
buf[2];
301 rz_strf(
str,
" v%i, v%i, [obj+%04x]", vA, vB, vC);
309 vB = (
buf[3] << 8) |
buf[2];
319 vA = (
buf[1] & 0x0f);
320 vB = (
buf[1] & 0xf0) >> 4;
321 vC = (
buf[3] << 8) |
buf[2];
322 if (
buf[0] == 0x20 ||
buf[0] == 0x23) {
325 rz_strf(
str,
" v%i, v%i, %s", vA, vB, flag_str);
327 rz_strf(
str,
" v%i, v%i, class+%i", vA, vB, vC);
332 rz_strf(
str,
" v%i, v%i, %s", vA, vB, flag_str);
334 rz_strf(
str,
" v%i, v%i, field+%i", vA, vB, vC);
352 vB = (
buf[3] << 8) |
buf[2];
353 vC = (
buf[5] << 8) |
buf[4];
354 if (
buf[0] == 0x25) {
357 rz_strf(
str,
" {v%i..v%i}, %s", vC, vC + vA - 1, flag_str);
359 rz_strf(
str,
" {v%i..v%i}, class+%i", vC, vC + vA - 1, vB);
361 }
else if (
buf[0] == 0xfd) {
364 rz_strf(
str,
" {v%i..v%i}, %s", vC, vC + vA - 1, flag_str);
366 rz_strf(
str,
" {v%i..v%i}, call_site+%i", vC, vC + vA - 1, vB);
371 rz_strf(
str,
" {v%i..v%i}, %s", vC, vC + vA - 1, flag_str);
373 rz_strf(
str,
" {v%i..v%i}, method+%i", vC, vC + vA - 1, vB);
379 vA = (
int)(
buf[1] & 0xf0) >> 4;
380 vB = (
buf[3] << 8) |
buf[2];
390 (
buf[4] & 0xf0) >> 4,
buf[5] & 0x0f);
394 (
buf[4] & 0xf0) >> 4,
buf[5] & 0x0f, (
buf[5] & 0xf0) >> 4);
398 (
buf[4] & 0xf0) >> 4,
buf[5] & 0x0f, (
buf[5] & 0xf0) >> 4,
buf[1] & 0x0f);
404 if (
buf[0] == 0x24) {
411 }
else if (
buf[0] == 0xfc) {
430 vA = (
buf[1] & 0xf0) >> 4;
431 vG = (
buf[1] & 0x0f);
432 vB = (
buf[3] << 8) |
buf[2];
433 vD = (
buf[4] & 0xf0) >> 4;
434 vC = (
buf[4] & 0x0f);
435 vF = (
buf[5] & 0xf0) >> 4;
436 vE = (
buf[5] & 0x0f);
437 vH = (
buf[7] << 8) |
buf[6];
450 rz_strf(
str,
" {v%d, v%d, v%d, v%d}", vC, vD, vE, vF);
453 rz_strf(
str,
" {v%d, v%d, v%d, v%d, v%d}", vC, vD, vE, vF, vG);
477 vB = (
buf[3] << 8) |
buf[2];
478 vC = (
buf[5] << 8) |
buf[4];
479 vH = (
buf[7] << 8) |
buf[6];
482 rz_strf(
str,
" {v%i..v%i}, %s", vC, vC + vA - 1, flag_str);
484 rz_strf(
str,
" {v%i..v%i}, method+%i", vC, vC + vA - 1, vB);
505 }
else if (
len > 0) {
513 }
else if (
len > 0 && payload >=
len) {
516 op->payload = payload;
519 if (
size +
op->payload < 0) {
533 char *
p = strchr(
buf,
' ');
538 for (
i = 0;
i < 256;
i++) {
554 .desc =
"AndroidVM Dalvik",
561 #ifndef RZ_PLUGIN_INCORE
static int dalvik_assemble(RzAsm *a, RzAsmOp *op, const char *buf)
RzAsmPlugin rz_asm_plugin_dalvik
RZ_API RzLibStruct rizin_plugin
static int dalvik_disassemble(RzAsm *a, RzAsmOp *op, const ut8 *buf, int len)
@ fmtopvAAcBBBBBBBBBBBBBBBB
static const struct dalvik_opcodes_t dalvik_opcodes[256]
RZ_API char * sdb_fmt(const char *fmt,...)
RZ_API void Ht_() free(HtName_(Ht) *ht)
return strdup("=SP r13\n" "=LR r14\n" "=PC r15\n" "=A0 r0\n" "=A1 r1\n" "=A2 r2\n" "=A3 r3\n" "=ZF zf\n" "=SF nf\n" "=OF vf\n" "=CF cf\n" "=SN or0\n" "gpr lr .32 56 0\n" "gpr pc .32 60 0\n" "gpr cpsr .32 64 0 ____tfiae_________________qvczn\n" "gpr or0 .32 68 0\n" "gpr tf .1 64.5 0 thumb\n" "gpr ef .1 64.9 0 endian\n" "gpr jf .1 64.24 0 java\n" "gpr qf .1 64.27 0 sticky_overflow\n" "gpr vf .1 64.28 0 overflow\n" "gpr cf .1 64.29 0 carry\n" "gpr zf .1 64.30 0 zero\n" "gpr nf .1 64.31 0 negative\n" "gpr itc .4 64.10 0 if_then_count\n" "gpr gef .4 64.16 0 great_or_equal\n" "gpr r0 .32 0 0\n" "gpr r1 .32 4 0\n" "gpr r2 .32 8 0\n" "gpr r3 .32 12 0\n" "gpr r4 .32 16 0\n" "gpr r5 .32 20 0\n" "gpr r6 .32 24 0\n" "gpr r7 .32 28 0\n" "gpr r8 .32 32 0\n" "gpr r9 .32 36 0\n" "gpr r10 .32 40 0\n" "gpr r11 .32 44 0\n" "gpr r12 .32 48 0\n" "gpr r13 .32 52 0\n" "gpr r14 .32 56 0\n" "gpr r15 .32 60 0\n" "gpr r16 .32 64 0\n" "gpr r17 .32 68 0\n")
#define RZ_ASM_GET_NAME(x, y, z)
#define RZ_ASM_GET_OFFSET(x, y, z)
#define rz_return_val_if_fail(expr, val)
static void rz_write_ble32(void *dest, ut32 val, bool big_endian)
#define RZ_STR_ISNOTEMPTY(x)
RZ_API char * rz_str_appendf(char *ptr, const char *fmt,...) RZ_PRINTF_CHECK(2
RZ_API char * rz_str_append(char *ptr, const char *string)
#define RZ_STR_ISEMPTY(x)
#define rz_strf(buf,...)
Convenience macro for local temporary strings.
RZ_API const char * rz_strbuf_set(RzStrBuf *sb, const char *s)
RZ_API bool rz_strbuf_setbin(RzStrBuf *sb, const ut8 *s, size_t len)
#define RZ_SYS_ENDIAN_LITTLE
ut64(WINAPI *w32_GetEnabledXStateFeatures)()