diff --git a/jazelle.c b/jazelle.c index b0b365c..a84c760 100644 --- a/jazelle.c +++ b/jazelle.c @@ -82,6 +82,22 @@ bytecode IDs that use a handler: 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe 0xff is hardwired to bkpt #0 +Raspberry Pi v1.2 B+, **Linux userspace**: + +bytecode IDs that use a handler: + 0x0f, 0x12, 0x13, 0x14, 0x62, 0x63, 0x66, 0x67, 0x6a, 0x6b, 0x6c, 0x6d, + 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x77, 0x79, 0x7b, 0x7d, 0x86, 0x87, + 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x95, 0x96, 0x97, 0x98, + 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, + 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbf, 0xc0, 0xc1, 0xc2, + 0xc3, 0xc4, 0xc5, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, + 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, + 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, + 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, + 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe +seems to be the same as FX3 except for 0x53 (aastore). +NOTE: baremetal is different, it is able to execute 0x6c (idiv) without problem! + */ #ifdef __linux__ @@ -295,8 +311,10 @@ static int jazelle_exec_native(const void* bytecode, const void* block) { // libjz contradicts this... // set configuration valid & jazelle enable bits +#if !defined(__linux__) || defined(__KERNEL__) "mov r0, #2\n" "mcr p14, 7, r0, c1, c0, 0\n" +#endif "mov r0, #1\n" "mcr p14, 7, r0, c2, c0, 0\n" @@ -319,8 +337,10 @@ static int jazelle_exec_native(const void* bytecode, const void* block) { ".Lend:\n" "mov r5, #0\n" +#ifndef __linux__ "mcr p14, 7, %r5, c1, c0, 0\n" "mcr p14, 7, %r5, c2, c0, 0\n" +#endif "pop {r4-r12,lr}\n" "bx lr\n" @@ -481,6 +501,17 @@ static void jazelle_test_handlers(uint8_t hflags[256/8]) { hflags[i>>3]|=(1<<(i&7)); continue; // yeah } +#ifdef __linux__ + if (i == 0x2e) continue; // iaload, will do a random data load. avoid this in non baremetal contexts + if (i >= 0x2f && i <= 0x35) continue; // laload, faload, daload, aaload, baload, caload, saload + if (i >= 0x4f && i <= 0x56 +#if __ARM_ARCH >= 6 + && i != 0x53 +#endif + ) continue; // [ilfdabcs]astore + if (i == 0xbe) continue; // arraylength +#endif + bytecode_testh[8] = i; memset(&bytecode_testh[9], 0, 8);