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 {
{
/* 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:
+ */