8 #define fail_if_no_enough_buffer_or_set(bytecode, jvm, n) \
9 if ((jvm->size - jvm->current) < n) { \
10 RZ_LOG_DEBUG("java: buffer is not big enough (available: %u, needed: %u)\n", jvm->size - jvm->current, n); \
15 #define load_ut8(bytecode, jvm, t, c) \
16 fail_if_no_enough_buffer_or_set(bytecode, jvm, 2); \
17 bytecode->args[0] = (c)jvm->buffer[jvm->current + 1]; \
18 bytecode->type[0] = (t)
20 #define load_ut8x2(bytecode, jvm, t0, t1, c0, c1) \
21 fail_if_no_enough_buffer_or_set(bytecode, jvm, 3); \
22 bytecode->args[0] = (c0)jvm->buffer[jvm->current + 1]; \
23 bytecode->type[0] = (t0); \
24 bytecode->args[1] = (c1)jvm->buffer[jvm->current + 2]; \
25 bytecode->type[1] = (t1)
27 #define load_ut16(bytecode, jvm, t, c) \
28 fail_if_no_enough_buffer_or_set(bytecode, jvm, 3); \
29 bytecode->args[0] = (c)rz_read_at_be16(jvm->buffer, jvm->current + 1); \
30 bytecode->type[0] = (t)
32 #define load_ut32(bytecode, jvm, t, c) \
33 fail_if_no_enough_buffer_or_set(bytecode, jvm, 5); \
34 bytecode->args[0] = (c)rz_read_at_be32(jvm->buffer, jvm->current + 1); \
35 bytecode->type[0] = (t)
37 #define load_ut16_ut8(bytecode, jvm, t0, t1, c0, c1) \
38 fail_if_no_enough_buffer_or_set(bytecode, jvm, 4); \
39 bytecode->args[0] = (c0)rz_read_at_be16(jvm->buffer, jvm->current + 1); \
40 bytecode->type[0] = (t0); \
41 bytecode->args[1] = (c1)rz_read_at_be8(jvm->buffer, jvm->current + 3); \
42 bytecode->type[1] = (t1)
44 #define load_ut16x2(bytecode, jvm, t0, t1, c0, c1) \
45 fail_if_no_enough_buffer_or_set(bytecode, jvm, 5); \
46 bytecode->args[0] = (c0)rz_read_at_be16(jvm->buffer, jvm->current + 1); \
47 bytecode->type[0] = (t0); \
48 bytecode->args[1] = (c1)rz_read_at_be16(jvm->buffer, jvm->current + 3); \
49 bytecode->type[1] = (t1)
81 bytecode->
args[0] = pc_default;
118 bytecode->
args[0] = pc_default;
120 bytecode->
extra = ts;
135 strcpy(bytecode->
name,
"nop");
140 strcpy(bytecode->
name,
"aconst_null");
146 strcpy(bytecode->
name,
"iconst_m1");
152 strcpy(bytecode->
name,
"iconst_0");
158 strcpy(bytecode->
name,
"iconst_1");
164 strcpy(bytecode->
name,
"iconst_2");
170 strcpy(bytecode->
name,
"iconst_3");
176 strcpy(bytecode->
name,
"iconst_4");
182 strcpy(bytecode->
name,
"iconst_5");
188 strcpy(bytecode->
name,
"lconst_0");
194 strcpy(bytecode->
name,
"lconst_1");
200 strcpy(bytecode->
name,
"fconst_0");
206 strcpy(bytecode->
name,
"fconst_1");
212 strcpy(bytecode->
name,
"fconst_2");
218 strcpy(bytecode->
name,
"dconst_0");
224 strcpy(bytecode->
name,
"dconst_1");
230 strcpy(bytecode->
name,
"bipush");
236 strcpy(bytecode->
name,
"sipush");
242 strcpy(bytecode->
name,
"ldc");
248 strcpy(bytecode->
name,
"ldc_w");
254 strcpy(bytecode->
name,
"ldc2_w");
260 strcpy(bytecode->
name,
"iload");
266 strcpy(bytecode->
name,
"lload");
272 strcpy(bytecode->
name,
"fload");
278 strcpy(bytecode->
name,
"dload");
284 strcpy(bytecode->
name,
"aload");
290 strcpy(bytecode->
name,
"iload_0");
296 strcpy(bytecode->
name,
"iload_1");
302 strcpy(bytecode->
name,
"iload_2");
308 strcpy(bytecode->
name,
"iload_3");
314 strcpy(bytecode->
name,
"lload_0");
320 strcpy(bytecode->
name,
"lload_1");
326 strcpy(bytecode->
name,
"lload_2");
332 strcpy(bytecode->
name,
"lload_3");
338 strcpy(bytecode->
name,
"fload_0");
344 strcpy(bytecode->
name,
"fload_1");
350 strcpy(bytecode->
name,
"fload_2");
356 strcpy(bytecode->
name,
"fload_3");
362 strcpy(bytecode->
name,
"dload_0");
368 strcpy(bytecode->
name,
"dload_1");
374 strcpy(bytecode->
name,
"dload_2");
380 strcpy(bytecode->
name,
"dload_3");
386 strcpy(bytecode->
name,
"aload_0");
392 strcpy(bytecode->
name,
"aload_1");
398 strcpy(bytecode->
name,
"aload_2");
404 strcpy(bytecode->
name,
"aload_3");
410 strcpy(bytecode->
name,
"iaload");
417 strcpy(bytecode->
name,
"laload");
424 strcpy(bytecode->
name,
"faload");
431 strcpy(bytecode->
name,
"daload");
438 strcpy(bytecode->
name,
"aaload");
445 strcpy(bytecode->
name,
"baload");
452 strcpy(bytecode->
name,
"caload");
459 strcpy(bytecode->
name,
"saload");
466 strcpy(bytecode->
name,
"istore");
472 strcpy(bytecode->
name,
"lstore");
478 strcpy(bytecode->
name,
"fstore");
484 strcpy(bytecode->
name,
"dstore");
490 strcpy(bytecode->
name,
"astore");
496 strcpy(bytecode->
name,
"istore_0");
502 strcpy(bytecode->
name,
"istore_1");
508 strcpy(bytecode->
name,
"istore_2");
514 strcpy(bytecode->
name,
"istore_3");
520 strcpy(bytecode->
name,
"lstore_0");
526 strcpy(bytecode->
name,
"lstore_1");
532 strcpy(bytecode->
name,
"lstore_2");
538 strcpy(bytecode->
name,
"lstore_3");
544 strcpy(bytecode->
name,
"fstore_0");
550 strcpy(bytecode->
name,
"fstore_1");
556 strcpy(bytecode->
name,
"fstore_2");
562 strcpy(bytecode->
name,
"fstore_3");
568 strcpy(bytecode->
name,
"dstore_0");
574 strcpy(bytecode->
name,
"dstore_1");
580 strcpy(bytecode->
name,
"dstore_2");
586 strcpy(bytecode->
name,
"dstore_3");
592 strcpy(bytecode->
name,
"astore_0");
598 strcpy(bytecode->
name,
"astore_1");
604 strcpy(bytecode->
name,
"astore_2");
610 strcpy(bytecode->
name,
"astore_3");
616 strcpy(bytecode->
name,
"iastore");
622 strcpy(bytecode->
name,
"lastore");
628 strcpy(bytecode->
name,
"fastore");
634 strcpy(bytecode->
name,
"dastore");
641 strcpy(bytecode->
name,
"aastore");
647 strcpy(bytecode->
name,
"bastore");
653 strcpy(bytecode->
name,
"castore");
659 strcpy(bytecode->
name,
"sastore");
666 strcpy(bytecode->
name,
"pop");
672 strcpy(bytecode->
name,
"pop2");
678 strcpy(bytecode->
name,
"dup");
685 strcpy(bytecode->
name,
"dup_x1");
692 strcpy(bytecode->
name,
"dup_x2");
699 strcpy(bytecode->
name,
"dup2");
706 strcpy(bytecode->
name,
"dup2_x1");
713 strcpy(bytecode->
name,
"dup2_x2");
720 strcpy(bytecode->
name,
"swap");
727 strcpy(bytecode->
name,
"iadd");
734 strcpy(bytecode->
name,
"ladd");
741 strcpy(bytecode->
name,
"fadd");
748 strcpy(bytecode->
name,
"dadd");
755 strcpy(bytecode->
name,
"isub");
762 strcpy(bytecode->
name,
"lsub");
769 strcpy(bytecode->
name,
"fsub");
776 strcpy(bytecode->
name,
"dsub");
783 strcpy(bytecode->
name,
"imul");
790 strcpy(bytecode->
name,
"lmul");
797 strcpy(bytecode->
name,
"fmul");
804 strcpy(bytecode->
name,
"dmul");
811 strcpy(bytecode->
name,
"idiv");
818 strcpy(bytecode->
name,
"ldiv");
825 strcpy(bytecode->
name,
"fdiv");
832 strcpy(bytecode->
name,
"ddiv");
839 strcpy(bytecode->
name,
"irem");
846 strcpy(bytecode->
name,
"lrem");
853 strcpy(bytecode->
name,
"frem");
860 strcpy(bytecode->
name,
"drem");
867 strcpy(bytecode->
name,
"ineg");
874 strcpy(bytecode->
name,
"lneg");
881 strcpy(bytecode->
name,
"fneg");
888 strcpy(bytecode->
name,
"dneg");
895 strcpy(bytecode->
name,
"ishl");
902 strcpy(bytecode->
name,
"lshl");
909 strcpy(bytecode->
name,
"ishr");
916 strcpy(bytecode->
name,
"lshr");
923 strcpy(bytecode->
name,
"iushr");
930 strcpy(bytecode->
name,
"lushr");
937 strcpy(bytecode->
name,
"iand");
944 strcpy(bytecode->
name,
"land");
951 strcpy(bytecode->
name,
"ior");
958 strcpy(bytecode->
name,
"lor");
965 strcpy(bytecode->
name,
"ixor");
972 strcpy(bytecode->
name,
"lxor");
979 strcpy(bytecode->
name,
"iinc");
984 strcpy(bytecode->
name,
"i2l");
991 strcpy(bytecode->
name,
"i2f");
998 strcpy(bytecode->
name,
"i2d");
1005 strcpy(bytecode->
name,
"l2i");
1012 strcpy(bytecode->
name,
"l2f");
1019 strcpy(bytecode->
name,
"l2d");
1026 strcpy(bytecode->
name,
"f2i");
1033 strcpy(bytecode->
name,
"f2l");
1040 strcpy(bytecode->
name,
"f2d");
1047 strcpy(bytecode->
name,
"d2i");
1054 strcpy(bytecode->
name,
"d2l");
1061 strcpy(bytecode->
name,
"d2f");
1068 strcpy(bytecode->
name,
"i2b");
1075 strcpy(bytecode->
name,
"i2c");
1082 strcpy(bytecode->
name,
"i2s");
1089 strcpy(bytecode->
name,
"lcmp");
1096 strcpy(bytecode->
name,
"fcmpl");
1103 strcpy(bytecode->
name,
"fcmpg");
1110 strcpy(bytecode->
name,
"dcmpl");
1117 strcpy(bytecode->
name,
"dcmpg");
1124 strcpy(bytecode->
name,
"ifeq");
1130 strcpy(bytecode->
name,
"ifne");
1136 strcpy(bytecode->
name,
"iflt");
1142 strcpy(bytecode->
name,
"ifge");
1148 strcpy(bytecode->
name,
"ifgt");
1154 strcpy(bytecode->
name,
"ifle");
1160 strcpy(bytecode->
name,
"if_icmpeq");
1166 strcpy(bytecode->
name,
"if_icmpne");
1172 strcpy(bytecode->
name,
"if_icmplt");
1178 strcpy(bytecode->
name,
"if_icmpge");
1184 strcpy(bytecode->
name,
"if_icmpgt");
1190 strcpy(bytecode->
name,
"if_icmple");
1196 strcpy(bytecode->
name,
"if_acmpeq");
1202 strcpy(bytecode->
name,
"if_acmpne");
1208 strcpy(bytecode->
name,
"goto");
1213 strcpy(bytecode->
name,
"jsr");
1219 strcpy(bytecode->
name,
"ret");
1225 strcpy(bytecode->
name,
"tableswitch");
1234 strcpy(bytecode->
name,
"lookupswitch");
1243 strcpy(bytecode->
name,
"ireturn");
1249 strcpy(bytecode->
name,
"lreturn");
1255 strcpy(bytecode->
name,
"freturn");
1261 strcpy(bytecode->
name,
"dreturn");
1267 strcpy(bytecode->
name,
"areturn");
1273 strcpy(bytecode->
name,
"return");
1278 strcpy(bytecode->
name,
"getstatic");
1284 strcpy(bytecode->
name,
"putstatic");
1290 strcpy(bytecode->
name,
"getfield");
1297 strcpy(bytecode->
name,
"putfield");
1303 strcpy(bytecode->
name,
"invokevirtual");
1309 strcpy(bytecode->
name,
"invokespecial");
1315 strcpy(bytecode->
name,
"invokestatic");
1320 strcpy(bytecode->
name,
"invokeinterface");
1327 strcpy(bytecode->
name,
"invokedynamic");
1333 strcpy(bytecode->
name,
"new");
1340 strcpy(bytecode->
name,
"newarray");
1347 strcpy(bytecode->
name,
"anewarray");
1354 strcpy(bytecode->
name,
"arraylength");
1361 strcpy(bytecode->
name,
"athrow");
1368 strcpy(bytecode->
name,
"checkcast");
1375 strcpy(bytecode->
name,
"instanceof");
1382 strcpy(bytecode->
name,
"monitorenter");
1388 strcpy(bytecode->
name,
"monitorexit");
1394 strcpy(bytecode->
name,
"wide");
1398 strcpy(bytecode->
name,
"multianewarray");
1404 strcpy(bytecode->
name,
"ifnull");
1410 strcpy(bytecode->
name,
"ifnonnull");
1416 strcpy(bytecode->
name,
"goto_w");
1422 strcpy(bytecode->
name,
"jsr_w");
1428 strcpy(bytecode->
name,
"breakpoint");
1433 strcpy(bytecode->
name,
"impdep1");
1438 strcpy(bytecode->
name,
"impdep2");
1443 strcpy(bytecode->
name,
"illegal");
1449 if (!bytecode->
atype) {
1473 }
else if (bytecode->
type[0] > 0 && !bytecode->
type[1]) {
1479 address = bytecode->
pc + bytecode->
args[0];
1483 switch (bytecode->
args[0]) {
1520 }
else if (bytecode->
type[0] > 0 && bytecode->
type[1] > 0) {
#define BYTECODE_C7_IFNONNULL
#define BYTECODE_C8_GOTO_W
#define BYTECODE_33_BALOAD
#define BYTECODE_C3_MONITOREXIT
#define BYTECODE_35_SALOAD
#define BYTECODE_36_ISTORE
#define BYTECODE_3E_ISTORE_3
#define BYTECODE_17_FLOAD
#define BYTECODE_BF_ATHROW
#define BYTECODE_FE_IMPDEP1
#define BYTECODE_31_DALOAD
#define BYTECODE_56_SASTORE
#define BYTECODE_53_AASTORE
#define BYTECODE_09_LCONST_0
#define BYTECODE_1C_ILOAD_2
#define BYTECODE_A3_IF_ICMPGT
#define BYTECODE_98_DCMPG
#define BYTECODE_C5_MULTIANEWARRAY
#define BYTECODE_5A_DUP_X1
#define BYTECODE_A0_IF_ICMPNE
#define BYTECODE_3B_ISTORE_0
#define BYTECODE_06_ICONST_3
#define BYTECODE_B9_INVOKEINTERFACE
#define BYTECODE_45_FSTORE_2
#define BYTECODE_B0_ARETURN
#define BYTECODE_08_ICONST_5
#define BYTECODE_19_ALOAD
#define BYTECODE_07_ICONST_4
#define BYTECODE_40_LSTORE_1
#define BYTECODE_C6_IFNULL
#define BYTECODE_3D_ISTORE_2
#define BYTECODE_51_FASTORE
#define BYTECODE_38_FSTORE
#define BYTECODE_10_BIPUSH
#define BYTECODE_4A_DSTORE_3
#define BYTECODE_AE_FRETURN
#define BYTECODE_25_FLOAD_3
#define BYTECODE_50_LASTORE
#define BYTECODE_3F_LSTORE_0
#define BYTECODE_97_DCMPL
#define BYTECODE_4F_IASTORE
#define BYTECODE_29_DLOAD_3
#define BYTECODE_A2_IF_ICMPGE
#define BYTECODE_5B_DUP_X2
#define BYTECODE_11_SIPUSH
#define BYTECODE_B2_GETSTATIC
#define BYTECODE_7D_LUSHR
#define BYTECODE_26_DLOAD_0
#define BYTECODE_28_DLOAD_2
#define BYTECODE_B8_INVOKESTATIC
#define BYTECODE_CA_BREAKPOINT
#define BYTECODE_02_ICONST_M1
#define BYTECODE_4B_ASTORE_0
#define BYTECODE_42_LSTORE_3
#define BYTECODE_44_FSTORE_1
#define BYTECODE_BE_ARRAYLENGTH
#define BYTECODE_4C_ASTORE_1
#define BYTECODE_AC_IRETURN
#define BYTECODE_0A_LCONST_1
#define BYTECODE_B4_GETFIELD
#define BYTECODE_AF_DRETURN
#define BYTECODE_AA_TABLESWITCH
#define BYTECODE_BC_NEWARRAY
#define BYTECODE_AD_LRETURN
#define BYTECODE_24_FLOAD_2
#define BYTECODE_46_FSTORE_3
#define BYTECODE_1D_ILOAD_3
#define BYTECODE_52_DASTORE
#define BYTECODE_04_ICONST_1
#define BYTECODE_96_FCMPG
#define BYTECODE_C1_INSTANCEOF
#define BYTECODE_0B_FCONST_0
#define BYTECODE_0E_DCONST_0
#define BYTECODE_03_ICONST_0
#define BYTECODE_2A_ALOAD_0
#define BYTECODE_43_FSTORE_0
#define BYTECODE_13_LDC_W
#define BYTECODE_B7_INVOKESPECIAL
#define BYTECODE_C9_JSR_W
#define BYTECODE_30_FALOAD
#define BYTECODE_1A_ILOAD_0
#define BYTECODE_27_DLOAD_1
#define BYTECODE_4D_ASTORE_2
#define BYTECODE_22_FLOAD_0
#define BYTECODE_32_AALOAD
#define BYTECODE_A6_IF_ACMPNE
#define BYTECODE_FF_IMPDEP2
#define BYTECODE_5E_DUP2_X2
#define BYTECODE_2F_LALOAD
#define BYTECODE_49_DSTORE_2
#define BYTECODE_0F_DCONST_1
#define BYTECODE_21_LLOAD_3
#define BYTECODE_9F_IF_ICMPEQ
#define BYTECODE_54_BASTORE
#define BYTECODE_AB_LOOKUPSWITCH
#define BYTECODE_1E_LLOAD_0
#define BYTECODE_05_ICONST_2
#define BYTECODE_2C_ALOAD_2
#define BYTECODE_15_ILOAD
#define BYTECODE_BA_INVOKEDYNAMIC
#define BYTECODE_47_DSTORE_0
#define BYTECODE_7C_IUSHR
#define BYTECODE_39_DSTORE
#define BYTECODE_01_ACONST_NULL
#define BYTECODE_B3_PUTSTATIC
#define BYTECODE_A4_IF_ICMPLE
#define BYTECODE_1B_ILOAD_1
#define BYTECODE_B5_PUTFIELD
#define BYTECODE_A1_IF_ICMPLT
#define BYTECODE_0C_FCONST_1
#define BYTECODE_4E_ASTORE_3
#define BYTECODE_20_LLOAD_2
#define BYTECODE_1F_LLOAD_1
#define BYTECODE_48_DSTORE_1
#define BYTECODE_23_FLOAD_1
@ BYTECODE_TYPE_CONST_POOL
#define BYTECODE_0D_FCONST_2
#define BYTECODE_5D_DUP2_X1
#define BYTECODE_3A_ASTORE
#define BYTECODE_C0_CHECKCAST
#define BYTECODE_41_LSTORE_2
#define BYTECODE_95_FCMPL
#define BYTECODE_B1_RETURN
#define BYTECODE_18_DLOAD
#define BYTECODE_3C_ISTORE_1
#define BYTECODE_2D_ALOAD_3
#define BYTECODE_BD_ANEWARRAY
#define BYTECODE_14_LDC2_W
#define BYTECODE_34_CALOAD
#define BYTECODE_2B_ALOAD_1
#define BYTECODE_37_LSTORE
#define BYTECODE_A5_IF_ACMPEQ
#define BYTECODE_16_LLOAD
#define BYTECODE_55_CASTORE
#define BYTECODE_C2_MONITORENTER
#define BYTECODE_B6_INVOKEVIRTUAL
#define BYTECODE_2E_IALOAD
#define JAVA_ASM_CONSTANT_POOL_STR
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void static offset struct stat static buf void long static basep static whence static length const void static len static semflg const void static shmflg const struct timespec struct timespec static rem const char static group const void length
RZ_API void Ht_() free(HtName_(Ht) *ht)
#define load_ut16(bytecode, jvm, t, c)
bool jvm_fetch(JavaVM *jvm, Bytecode *bytecode)
static bool decode_instruction(JavaVM *jvm, Bytecode *bytecode)
bool jvm_init(JavaVM *jvm, const ut8 *buffer, const ut32 size, ut64 pc, ut64 section)
void bytecode_clean(Bytecode *bytecode)
static ut32 align_upper(JavaVM *jvm)
void bytecode_snprint(RzStrBuf *sb, Bytecode *bytecode)
static bool decode_tableswitch(JavaVM *jvm, Bytecode *bytecode)
#define load_ut16_ut8(bytecode, jvm, t0, t1, c0, c1)
#define load_ut8x2(bytecode, jvm, t0, t1, c0, c1)
#define load_ut8(bytecode, jvm, t, c)
#define load_ut32(bytecode, jvm, t, c)
static bool decode_lookupswitch(JavaVM *jvm, Bytecode *bytecode)
return memset(p, 0, total)
@ RZ_ANALYSIS_OP_TYPE_CMP
@ RZ_ANALYSIS_OP_TYPE_SUB
@ RZ_ANALYSIS_OP_TYPE_LOAD
@ RZ_ANALYSIS_OP_TYPE_UNK
@ RZ_ANALYSIS_OP_TYPE_MUL
@ RZ_ANALYSIS_OP_TYPE_JMP
@ RZ_ANALYSIS_OP_TYPE_AND
@ RZ_ANALYSIS_OP_TYPE_SYNC
@ RZ_ANALYSIS_OP_TYPE_MOD
@ RZ_ANALYSIS_OP_TYPE_SWI
@ RZ_ANALYSIS_OP_TYPE_CALL
@ RZ_ANALYSIS_OP_TYPE_ADD
@ RZ_ANALYSIS_OP_TYPE_STORE
@ RZ_ANALYSIS_OP_TYPE_PUSH
@ RZ_ANALYSIS_OP_TYPE_SHR
@ RZ_ANALYSIS_OP_TYPE_POP
@ RZ_ANALYSIS_OP_TYPE_CJMP
@ RZ_ANALYSIS_OP_TYPE_DIV
@ RZ_ANALYSIS_OP_TYPE_CAST
@ RZ_ANALYSIS_OP_TYPE_UCJMP
@ RZ_ANALYSIS_OP_TYPE_MOV
@ RZ_ANALYSIS_OP_TYPE_SHL
@ RZ_ANALYSIS_OP_TYPE_ILL
@ RZ_ANALYSIS_OP_TYPE_UCALL
@ RZ_ANALYSIS_OP_TYPE_RET
@ RZ_ANALYSIS_OP_TYPE_NOP
@ RZ_ANALYSIS_OP_TYPE_XOR
@ RZ_ANALYSIS_OP_TYPE_NEW
@ RZ_ANALYSIS_OP_TYPE_LENGTH
#define rz_warn_if_reached()
#define rz_return_if_fail(expr)
#define rz_return_val_if_fail(expr, val)
static ut32 rz_read_at_be32(const void *src, size_t offset)
RZ_API const char * rz_strbuf_setf(RzStrBuf *sb, const char *fmt,...) RZ_PRINTF_CHECK(2
ut64(WINAPI *w32_GetEnabledXStateFeatures)()