Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: arch.h 5330 2006-09-05 18:43:12Z edwin $
-
*/
#include "config.h"
*/
void md_init(void)
{
- assert(sizeof(vm_arg) == sizevmarg);
- assert(OFFSET(java_objectheader, vftbl) == offobjvftbl);
assert(OFFSET(vftbl_t, baseval) == offbaseval);
assert(OFFSET(vftbl_t, diffval) == offdiffval);
- assert(OFFSET(vm_arg, type) == offvmargtype);
- assert(OFFSET(vm_arg, data) == offvmargdata);
assert(OFFSET(castinfo, super_baseval) == offcast_super_baseval);
assert(OFFSET(castinfo, super_diffval) == offcast_super_diffval);
assert(OFFSET(castinfo, sub_baseval) == offcast_sub_baseval);
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));
+
+ /* return NULL if no mptr was specified (used for replacement) */
+
+ if (mptr == NULL)
+ return NULL;
+
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;
}