X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=src%2Fvm%2Fjit%2Fm68k%2Fmd.c;h=c2c668adbe41578f921667ff63271319dbddbe85;hb=bfb7d15b502b8170ec8a9b348c546418c0e44ace;hp=4214fad1b1668b5f78a1350a0ad268ec49c6dab0;hpb=2457ad8bcdb80a1026380a158052aa91ad06651d;p=cacao.git diff --git a/src/vm/jit/m68k/md.c b/src/vm/jit/m68k/md.c index 4214fad1b..c2c668adb 100644 --- a/src/vm/jit/m68k/md.c +++ b/src/vm/jit/m68k/md.c @@ -119,20 +119,22 @@ u1* md_get_method_patch_address(u1 *ra, stackframeinfo *sfi, u1 *mptr) s2 offset; if (*((u2*)(ra - 2)) == 0x4e94) { /* jsr %a4@ */ - /* we had a moveal XXX, %a3 which is a 3 word opcode */ - /* 2679 0000 0000 */ - assert(*(u2*)(ra - 8) == 0x2879); /* moveal */ - pa = *((u4*)(ra - 6)); /* another indirection ! */ - } else if (*((u2*)(ra - 2)) == 0x4e92) { /* jsr %a2@ */ - if (*(u2*)(ra - 8) == 0x247c) { - /* found a invokestatic/invokespecial */ - pa = ((u4*)(ra - 6)); /* no indirection ! */ - } else if (*((u2*)(ra - 6)) == 0x246b) { + if (*((u2*)(ra - 6)) == 0x286b) { /* found an invokevirtual */ /* get offset of load instruction 246b XXXX */ offset = *((s2*)(ra - 4)); pa = mptr + offset; /* mptr contains the magic we want */ } else { + /* we had a moveal XXX, %a3 which is a 3 word opcode */ + /* 2679 0000 0000 */ + assert(*(u2*)(ra - 8) == 0x2879); /* moveal */ + pa = *((u4*)(ra - 6)); /* another indirection ! */ + } + } else if (*((u2*)(ra - 2)) == 0x4e92) { /* jsr %a2@ */ + if (*(u2*)(ra - 8) == 0x247c) { + /* found a invokestatic/invokespecial */ + pa = ((u4*)(ra - 6)); /* no indirection ! */ + } else { assert(0); } } else { @@ -211,8 +213,39 @@ u1* md_stacktrace_get_returnaddress(u1* sp, u4 framesize) { /* return address is above stackpointer */ u1 *ra = *((u1**)(sp + framesize)); + + /* XXX: This helps for now, but it's a ugly hack + * the problem _may_ be: the link instruction is used + * by some gcc generated code, and we get an additional word + * on the stack, the old framepointer. Its address is somewhere + * near sp, but that all depends the code generated by the compiler. + * I'm unsure about a clean solution. + */ + #if 0 + if (!(ra > 0x40000000 && ra < 0x80000000)) { + ra = *((u1**)(sp + framesize + 4)); + } + #endif + /* assert(ra > 0x40000000 && ra < 0x80000000); + printf("XXXXXX=%x\n", ra); + */ return ra; } void md_codegen_patch_branch(void) { assert(0); } + + +/* + * These are local overrides for various environment variables in Emacs. + * Please do not remove this and leave it at the end of the file, where + * Emacs will automagically detect them. + * --------------------------------------------------------------------- + * Local variables: + * mode: c + * indent-tabs-mode: t + * c-basic-offset: 4 + * tab-width: 4 + * End: + * vim:noexpandtab:sw=4:ts=4: + */