Changes:
- $Id: patcher.c 3113 2005-07-27 10:36:38Z twisti $
+ $Id: patcher.c 3126 2005-08-02 21:44:03Z cacao $
*/
+#include <sys/cachectl.h>
+
#include "config.h"
#include "vm/jit/mips/types.h"
{
u1 *ra;
java_objectheader *o;
+#if SIZEOF_VOID_P == 8
u8 mcode;
+#else
+ u4 mcode[2];
+#endif
unresolved_field *uf;
s4 disp;
u1 *pv;
/* get stuff from the stack */
- ra = (u1 *) *((ptrint *) (sp + 5 * 8));
- o = (java_objectheader *) *((ptrint *) (sp + 4 * 8));
- mcode = *((u8 *) (sp + 3 * 8));
- uf = (unresolved_field *) *((ptrint *) (sp + 2 * 8));
- disp = *((s4 *) (sp + 1 * 8));
- pv = (u1 *) *((ptrint *) (sp + 0 * 8));
+ ra = (u1 *) *((ptrint *) (sp + 5 * 8));
+ o = (java_objectheader *) *((ptrint *) (sp + 4 * 8));
+#if SIZEOF_VOID_P == 8
+ mcode = *((u8 *) (sp + 3 * 8));
+#else
+ mcode[0] = *((u4 *) (sp + 3 * 8));
+ mcode[1] = *((u4 *) (sp + 3 * 8 + 4));
+#endif
+ uf = (unresolved_field *) *((ptrint *) (sp + 2 * 8));
+ disp = *((s4 *) (sp + 1 * 8));
+ pv = (u1 *) *((ptrint *) (sp + 0 * 8));
/* calculate and set the new return address */
/* check if the field's class is initialized */
- if (!fi->class->initialized)
- if (!initialize_class(fi->class))
+ if (!fi->class->initialized) {
+ if (!initialize_class(fi->class)) {
+ PATCHER_MONITOREXIT;
+
return false;
+ }
+ }
/* patch back original code */
+#if SIZEOF_VOID_P == 8
*((u4 *) (ra + 0 * 4)) = mcode;
*((u4 *) (ra + 1 * 4)) = mcode >> 32;
+#else
+ *((u4 *) (ra + 0 * 4)) = mcode[0];
+ *((u4 *) (ra + 1 * 4)) = mcode[1];
+#endif
/* synchronize instruction cache */
- docacheflush(ra, 2 * 4);
+ cacheflush(ra, 2 * 4, ICACHE);
/* patch the field value's address */
*((ptrint *) (pv + disp)) = (ptrint) &(fi->value);
+ /* synchronize data cache */
+
+ cacheflush(pv + disp, SIZEOF_VOID_P, DCACHE);
+
PATCHER_MARK_PATCHED_MONITOREXIT;
return true;
{
u1 *ra;
java_objectheader *o;
+#if SIZEOF_VOID_P == 8
u8 mcode;
+#else
+ u4 mcode[2];
+#endif
unresolved_field *uf;
fieldinfo *fi;
- ra = (u1 *) *((ptrint *) (sp + 5 * 8));
- o = (java_objectheader *) *((ptrint *) (sp + 4 * 8));
- mcode = *((u8 *) (sp + 3 * 8));
- uf = (unresolved_field *) *((ptrint *) (sp + 2 * 8));
+ ra = (u1 *) *((ptrint *) (sp + 5 * 8));
+ o = (java_objectheader *) *((ptrint *) (sp + 4 * 8));
+#if SIZEOF_VOID_P == 8
+ mcode = *((u8 *) (sp + 3 * 8));
+#else
+ mcode[0] = *((u4 *) (sp + 3 * 8));
+ mcode[1] = *((u4 *) (sp + 3 * 8 + 4));
+#endif
+ uf = (unresolved_field *) *((ptrint *) (sp + 2 * 8));
/* calculate and set the new return address */
/* patch back original code */
+#if SIZEOF_VOID_P == 8
*((u4 *) (ra + 0 * 4)) = mcode;
*((u4 *) (ra + 1 * 4)) = mcode >> 32;
+#else
+ *((u4 *) (ra + 0 * 4)) = mcode[0];
+ *((u4 *) (ra + 1 * 4)) = mcode[1];
+#endif
/* if we show disassembly, we have to skip the nop's */
/* synchronize instruction cache */
- docacheflush(ra, 2 * 4);
+ if (opt_showdisassemble)
+ cacheflush(ra - 2 * 4, 3 * 4, ICACHE);
+ else
+ cacheflush(ra, 2 * 4, ICACHE);
PATCHER_MARK_PATCHED_MONITOREXIT;
{
u1 *ra;
java_objectheader *o;
+#if SIZEOF_VOID_P == 8
u8 mcode;
+#else
+ u4 mcode[2];
+#endif
constant_classref *cr;
s4 disp;
u1 *pv;
/* get stuff from the stack */
- ra = (u1 *) *((ptrint *) (sp + 5 * 8));
- o = (java_objectheader *) *((ptrint *) (sp + 4 * 8));
- mcode = *((u8 *) (sp + 3 * 8));
- cr = (constant_classref *) *((ptrint *) (sp + 2 * 8));
- disp = *((s4 *) (sp + 1 * 8));
- pv = (u1 *) *((ptrint *) (sp + 0 * 8));
+ ra = (u1 *) *((ptrint *) (sp + 5 * 8));
+ o = (java_objectheader *) *((ptrint *) (sp + 4 * 8));
+#if SIZEOF_VOID_P == 8
+ mcode = *((u8 *) (sp + 3 * 8));
+#else
+ mcode[0] = *((u4 *) (sp + 3 * 8));
+ mcode[1] = *((u4 *) (sp + 3 * 8 + 4));
+#endif
+ cr = (constant_classref *) *((ptrint *) (sp + 2 * 8));
+ disp = *((s4 *) (sp + 1 * 8));
+ pv = (u1 *) *((ptrint *) (sp + 0 * 8));
/* calculate and set the new return address */
/* patch back original code */
+#if SIZEOF_VOID_P == 8
*((u4 *) (ra + 1 * 4)) = mcode;
*((u4 *) (ra + 2 * 4)) = mcode >> 32;
+#else
+ *((u4 *) (ra + 1 * 4)) = mcode[0];
+ *((u4 *) (ra + 2 * 4)) = mcode[1];
+#endif
/* synchronize instruction cache */
- docacheflush(ra + 1 * 4, 2 * 4);
+ cacheflush(ra + 1 * 4, 2 * 4, ICACHE);
/* patch the classinfo pointer */
{
u1 *ra;
java_objectheader *o;
+#if SIZEOF_VOID_P == 8
u8 mcode;
+#else
+ u4 mcode[2];
+#endif
constant_classref *cr;
s4 disp;
u1 *pv;
/* get stuff from the stack */
- ra = (u1 *) *((ptrint *) (sp + 5 * 8));
- o = (java_objectheader *) *((ptrint *) (sp + 4 * 8));
- mcode = *((u8 *) (sp + 3 * 8));
- cr = (constant_classref *) *((ptrint *) (sp + 2 * 8));
- disp = *((s4 *) (sp + 1 * 8));
- pv = (u1 *) *((ptrint *) (sp + 0 * 8));
+ ra = (u1 *) *((ptrint *) (sp + 5 * 8));
+ o = (java_objectheader *) *((ptrint *) (sp + 4 * 8));
+#if SIZEOF_VOID_P == 8
+ mcode = *((u8 *) (sp + 3 * 8));
+#else
+ mcode[0] = *((u4 *) (sp + 3 * 8));
+ mcode[1] = *((u4 *) (sp + 3 * 8 + 4));
+#endif
+ cr = (constant_classref *) *((ptrint *) (sp + 2 * 8));
+ disp = *((s4 *) (sp + 1 * 8));
+ pv = (u1 *) *((ptrint *) (sp + 0 * 8));
/* calculate and set the new return address */
/* patch back original code */
+#if SIZEOF_VOID_P == 8
*((u4 *) (ra + 1 * 4)) = mcode;
*((u4 *) (ra + 2 * 4)) = mcode >> 32;
+#else
+ *((u4 *) (ra + 1 * 4)) = mcode[0];
+ *((u4 *) (ra + 2 * 4)) = mcode[1];
+#endif
/* synchronize instruction cache */
- docacheflush(ra + 4, 2 * 4);
+ cacheflush(ra + 1 * 4, 2 * 4, ICACHE);
/* patch the class' vftbl pointer */
{
u1 *ra;
java_objectheader *o;
+#if SIZEOF_VOID_P == 8
u8 mcode;
+#else
+ u4 mcode[2];
+#endif
constant_classref *cr;
s4 disp;
u1 *pv;
/* get stuff from the stack */
- ra = (u1 *) *((ptrint *) (sp + 5 * 8));
- o = (java_objectheader *) *((ptrint *) (sp + 4 * 8));
- mcode = *((u8 *) (sp + 3 * 8));
- cr = (constant_classref *) *((ptrint *) (sp + 2 * 8));
- disp = *((s4 *) (sp + 1 * 8));
- pv = (u1 *) *((ptrint *) (sp + 0 * 8));
+ ra = (u1 *) *((ptrint *) (sp + 5 * 8));
+ o = (java_objectheader *) *((ptrint *) (sp + 4 * 8));
+#if SIZEOF_VOID_P == 8
+ mcode = *((u8 *) (sp + 3 * 8));
+#else
+ mcode[0] = *((u4 *) (sp + 3 * 8));
+ mcode[1] = *((u4 *) (sp + 3 * 8 + 4));
+#endif
+ cr = (constant_classref *) *((ptrint *) (sp + 2 * 8));
+ disp = *((s4 *) (sp + 1 * 8));
+ pv = (u1 *) *((ptrint *) (sp + 0 * 8));
/* calculate and set the new return address */
/* patch back original code */
+#if SIZEOF_VOID_P == 8
*((u4 *) (ra + 0 * 4)) = mcode;
*((u4 *) (ra + 1 * 4)) = mcode >> 32;
+#else
+ *((u4 *) (ra + 0 * 4)) = mcode[0];
+ *((u4 *) (ra + 1 * 4)) = mcode[1];
+#endif
/* synchronize instruction cache */
- docacheflush(ra, 2 * 4);
+ cacheflush(ra, 2 * 4, ICACHE);
/* patch the class' vftbl pointer */
{
u1 *ra;
java_objectheader *o;
+#if SIZEOF_VOID_P == 8
u8 mcode;
+#else
+ u4 mcode[2];
+#endif
constant_classref *cr;
s4 disp;
u1 *pv;
/* get stuff from the stack */
- ra = (u1 *) *((ptrint *) (sp + 5 * 8));
- o = (java_objectheader *) *((ptrint *) (sp + 4 * 8));
- mcode = *((u8 *) (sp + 3 * 8));
- cr = (constant_classref *) *((ptrint *) (sp + 2 * 8));
- disp = *((s4 *) (sp + 1 * 8));
- pv = (u1 *) *((ptrint *) (sp + 0 * 8));
+ ra = (u1 *) *((ptrint *) (sp + 5 * 8));
+ o = (java_objectheader *) *((ptrint *) (sp + 4 * 8));
+#if SIZEOF_VOID_P == 8
+ mcode = *((u8 *) (sp + 3 * 8));
+#else
+ mcode[0] = *((u4 *) (sp + 3 * 8));
+ mcode[1] = *((u4 *) (sp + 3 * 8 + 4));
+#endif
+ cr = (constant_classref *) *((ptrint *) (sp + 2 * 8));
+ disp = *((s4 *) (sp + 1 * 8));
+ pv = (u1 *) *((ptrint *) (sp + 0 * 8));
/* calculate and set the new return address */
/* patch back original code */
+#if SIZEOF_VOID_P == 8
*((u4 *) (ra + 0 * 4)) = mcode;
*((u4 *) (ra + 1 * 4)) = mcode >> 32;
+#else
+ *((u4 *) (ra + 0 * 4)) = mcode[0];
+ *((u4 *) (ra + 1 * 4)) = mcode[1];
+#endif
/* synchronize instruction cache */
- docacheflush(ra, 2 * 4);
+ cacheflush(ra, 2 * 4, ICACHE);
/* patch the class' vftbl pointer */
{
u1 *ra;
java_objectheader *o;
+#if SIZEOF_VOID_P == 8
u8 mcode;
+#else
+ u4 mcode[2];
+#endif
constant_classref *cr;
s4 disp;
u1 *pv;
/* get stuff from the stack */
- ra = (u1 *) *((ptrint *) (sp + 5 * 8));
- o = (java_objectheader *) *((ptrint *) (sp + 4 * 8));
- mcode = *((u8 *) (sp + 3 * 8));
- cr = (constant_classref *) *((ptrint *) (sp + 2 * 8));
- disp = *((s4 *) (sp + 1 * 8));
- pv = (u1 *) *((ptrint *) (sp + 0 * 8));
+ ra = (u1 *) *((ptrint *) (sp + 5 * 8));
+ o = (java_objectheader *) *((ptrint *) (sp + 4 * 8));
+#if SIZEOF_VOID_P == 8
+ mcode = *((u8 *) (sp + 3 * 8));
+#else
+ mcode[0] = *((u4 *) (sp + 3 * 8));
+ mcode[1] = *((u4 *) (sp + 3 * 8 + 4));
+#endif
+ cr = (constant_classref *) *((ptrint *) (sp + 2 * 8));
+ disp = *((s4 *) (sp + 1 * 8));
+ pv = (u1 *) *((ptrint *) (sp + 0 * 8));
/* calculate and set the new return address */
/* patch back original code */
+#if SIZEOF_VOID_P == 8
*((u4 *) (ra + 1 * 4)) = mcode;
*((u4 *) (ra + 2 * 4)) = mcode >> 32;
+#else
+ *((u4 *) (ra + 1 * 4)) = mcode[0];
+ *((u4 *) (ra + 2 * 4)) = mcode[1];
+#endif
/* synchronize instruction cache */
- docacheflush(ra + 1 * 4, 2 * 4);
+ cacheflush(ra + 1 * 4, 2 * 4, ICACHE);
/* patch the class' vftbl pointer */
{
u1 *ra;
java_objectheader *o;
+#if SIZEOF_VOID_P == 8
u8 mcode;
+#else
+ u4 mcode[2];
+#endif
unresolved_method *um;
s4 disp;
u1 *pv;
/* get stuff from the stack */
- ra = (u1 *) *((ptrint *) (sp + 5 * 8));
- o = (java_objectheader *) *((ptrint *) (sp + 4 * 8));
- mcode = *((u8 *) (sp + 3 * 8));
- um = (unresolved_method *) *((ptrint *) (sp + 2 * 8));
- disp = *((s4 *) (sp + 1 * 8));
- pv = (u1 *) *((ptrint *) (sp + 0 * 8));
+ ra = (u1 *) *((ptrint *) (sp + 5 * 8));
+ o = (java_objectheader *) *((ptrint *) (sp + 4 * 8));
+#if SIZEOF_VOID_P == 8
+ mcode = *((u8 *) (sp + 3 * 8));
+#else
+ mcode[0] = *((u4 *) (sp + 3 * 8));
+ mcode[1] = *((u4 *) (sp + 3 * 8 + 4));
+#endif
+ um = (unresolved_method *) *((ptrint *) (sp + 2 * 8));
+ disp = *((s4 *) (sp + 1 * 8));
+ pv = (u1 *) *((ptrint *) (sp + 0 * 8));
/* calculate and set the new return address */
/* patch back original code */
+#if SIZEOF_VOID_P == 8
*((u4 *) (ra + 0 * 4)) = mcode;
*((u4 *) (ra + 1 * 4)) = mcode >> 32;
+#else
+ *((u4 *) (ra + 0 * 4)) = mcode[0];
+ *((u4 *) (ra + 1 * 4)) = mcode[1];
+#endif
/* synchronize instruction cache */
- docacheflush(ra, 2 * 4);
+ cacheflush(ra, 2 * 4, ICACHE);
/* patch stubroutine */
{
u1 *ra;
java_objectheader *o;
+#if SIZEOF_VOID_P == 8
u8 mcode;
+#else
+ u4 mcode[2];
+#endif
unresolved_method *um;
methodinfo *m;
/* get stuff from the stack */
- ra = (u1 *) *((ptrint *) (sp + 5 * 8));
- o = (java_objectheader *) *((ptrint *) (sp + 4 * 8));
- mcode = *((u8 *) (sp + 3 * 8));
- um = (unresolved_method *) *((ptrint *) (sp + 2 * 8));
+ ra = (u1 *) *((ptrint *) (sp + 5 * 8));
+ o = (java_objectheader *) *((ptrint *) (sp + 4 * 8));
+#if SIZEOF_VOID_P == 8
+ mcode = *((u8 *) (sp + 3 * 8));
+#else
+ mcode[0] = *((u4 *) (sp + 3 * 8));
+ mcode[1] = *((u4 *) (sp + 3 * 8 + 4));
+#endif
+ um = (unresolved_method *) *((ptrint *) (sp + 2 * 8));
/* calculate and set the new return address */
/* patch back original code */
+#if SIZEOF_VOID_P == 8
*((u4 *) (ra + 0 * 4)) = mcode;
*((u4 *) (ra + 1 * 4)) = mcode >> 32;
+#else
+ *((u4 *) (ra + 0 * 4)) = mcode[0];
+ *((u4 *) (ra + 1 * 4)) = mcode[1];
+#endif
/* if we show disassembly, we have to skip the nop's */
/* synchronize instruction cache */
- docacheflush(ra, 2 * 4);
+ if (opt_showdisassemble)
+ cacheflush(ra - 2 * 4, 4 * 4, ICACHE);
+ else
+ cacheflush(ra, 2 * 4, ICACHE);
PATCHER_MARK_PATCHED_MONITOREXIT;
{
u1 *ra;
java_objectheader *o;
+#if SIZEOF_VOID_P == 8
u8 mcode;
+#else
+ u4 mcode[2];
+#endif
unresolved_method *um;
methodinfo *m;
/* get stuff from the stack */
- ra = (u1 *) *((ptrint *) (sp + 5 * 8));
- o = (java_objectheader *) *((ptrint *) (sp + 4 * 8));
- mcode = *((u8 *) (sp + 3 * 8));
- um = (unresolved_method *) *((ptrint *) (sp + 2 * 8));
+ ra = (u1 *) *((ptrint *) (sp + 5 * 8));
+ o = (java_objectheader *) *((ptrint *) (sp + 4 * 8));
+#if SIZEOF_VOID_P == 8
+ mcode = *((u8 *) (sp + 3 * 8));
+#else
+ mcode[0] = *((u4 *) (sp + 3 * 8));
+ mcode[1] = *((u4 *) (sp + 3 * 8 + 4));
+#endif
+ um = (unresolved_method *) *((ptrint *) (sp + 2 * 8));
/* calculate and set the new return address */
/* patch back original code */
+#if SIZEOF_VOID_P == 8
*((u4 *) (ra + 0 * 4)) = mcode;
*((u4 *) (ra + 1 * 4)) = mcode >> 32;
+#else
+ *((u4 *) (ra + 0 * 4)) = mcode[0];
+ *((u4 *) (ra + 1 * 4)) = mcode[1];
+#endif
/* if we show disassembly, we have to skip the nop's */
/* synchronize instruction cache */
- docacheflush(ra, 2 * 4);
+ if (opt_showdisassemble)
+ cacheflush(ra - 2 * 4, 5 * 4, ICACHE);
+ else
+ cacheflush(ra, 3 * 4, ICACHE);
PATCHER_MARK_PATCHED_MONITOREXIT;
{
u1 *ra;
java_objectheader *o;
+#if SIZEOF_VOID_P == 8
u8 mcode;
+#else
+ u4 mcode[2];
+#endif
constant_classref *cr;
s4 disp;
u1 *pv;
/* get stuff from the stack */
- ra = (u1 *) *((ptrint *) (sp + 5 * 8));
- o = (java_objectheader *) *((ptrint *) (sp + 4 * 8));
- mcode = *((u8 *) (sp + 3 * 8));
- cr = (constant_classref *) *((ptrint *) (sp + 2 * 8));
- disp = *((s4 *) (sp + 1 * 8));
- pv = (u1 *) *((ptrint *) (sp + 0 * 8));
+ ra = (u1 *) *((ptrint *) (sp + 5 * 8));
+ o = (java_objectheader *) *((ptrint *) (sp + 4 * 8));
+#if SIZEOF_VOID_P == 8
+ mcode = *((u8 *) (sp + 3 * 8));
+#else
+ mcode[0] = *((u4 *) (sp + 3 * 8));
+ mcode[1] = *((u4 *) (sp + 3 * 8 + 4));
+#endif
+ cr = (constant_classref *) *((ptrint *) (sp + 2 * 8));
+ disp = *((s4 *) (sp + 1 * 8));
+ pv = (u1 *) *((ptrint *) (sp + 0 * 8));
/* calculate and set the new return address */
/* patch back original code */
+#if SIZEOF_VOID_P == 8
*((u4 *) (ra + 0 * 4)) = mcode;
*((u4 *) (ra + 1 * 4)) = mcode >> 32;
+#else
+ *((u4 *) (ra + 0 * 4)) = mcode[0];
+ *((u4 *) (ra + 1 * 4)) = mcode[1];
+#endif
/* synchronize instruction cache */
- docacheflush(ra, 2 * 4);
+ cacheflush(ra, 2 * 4, ICACHE);
/* patch class flags */
{
u1 *ra;
java_objectheader *o;
+#if SIZEOF_VOID_P == 8
u8 mcode;
+#else
+ u4 mcode[2];
+#endif
constant_classref *cr;
classinfo *c;
/* get stuff from the stack */
- ra = (u1 *) *((ptrint *) (sp + 5 * 8));
- o = (java_objectheader *) *((ptrint *) (sp + 4 * 8));
- mcode = *((u8 *) (sp + 3 * 8));
- cr = (constant_classref *) *((ptrint *) (sp + 2 * 8));
+ ra = (u1 *) *((ptrint *) (sp + 5 * 8));
+ o = (java_objectheader *) *((ptrint *) (sp + 4 * 8));
+#if SIZEOF_VOID_P == 8
+ mcode = *((u8 *) (sp + 3 * 8));
+#else
+ mcode[0] = *((u4 *) (sp + 3 * 8));
+ mcode[1] = *((u4 *) (sp + 3 * 8 + 4));
+#endif
+ cr = (constant_classref *) *((ptrint *) (sp + 2 * 8));
/* calculate and set the new return address */
/* patch back original code */
+#if SIZEOF_VOID_P == 8
*((u4 *) (ra + 0 * 4)) = mcode;
*((u4 *) (ra + 1 * 4)) = mcode >> 32;
+#else
+ *((u4 *) (ra + 0 * 4)) = mcode[0];
+ *((u4 *) (ra + 1 * 4)) = mcode[1];
+#endif
/* if we show disassembly, we have to skip the nop's */
/* synchronize instruction cache */
- docacheflush(ra, 6 * 4);
+ if (opt_showdisassemble)
+ cacheflush(ra - 2 * 4, 8 * 4, ICACHE);
+ else
+ cacheflush(ra, 6 * 4, ICACHE);
PATCHER_MARK_PATCHED_MONITOREXIT;
{
u1 *ra;
java_objectheader *o;
+#if SIZEOF_VOID_P == 8
u8 mcode;
+#else
+ u4 mcode[2];
+#endif
constant_classref *cr;
s4 disp;
u1 *pv;
/* get stuff from the stack */
- ra = (u1 *) *((ptrint *) (sp + 5 * 8));
- o = (java_objectheader *) *((ptrint *) (sp + 4 * 8));
- mcode = *((u8 *) (sp + 3 * 8));
- cr = (constant_classref *) *((ptrint *) (sp + 2 * 8));
- disp = *((s4 *) (sp + 1 * 8));
- pv = (u1 *) *((ptrint *) (sp + 0 * 8));
+ ra = (u1 *) *((ptrint *) (sp + 5 * 8));
+ o = (java_objectheader *) *((ptrint *) (sp + 4 * 8));
+#if SIZEOF_VOID_P == 8
+ mcode = *((u8 *) (sp + 3 * 8));
+#else
+ mcode[0] = *((u4 *) (sp + 3 * 8));
+ mcode[1] = *((u4 *) (sp + 3 * 8 + 4));
+#endif
+ cr = (constant_classref *) *((ptrint *) (sp + 2 * 8));
+ disp = *((s4 *) (sp + 1 * 8));
+ pv = (u1 *) *((ptrint *) (sp + 0 * 8));
/* calculate and set the new return address */
/* patch back original code */
+#if SIZEOF_VOID_P == 8
*((u4 *) (ra + 0 * 4)) = mcode;
*((u4 *) (ra + 1 * 4)) = mcode >> 32;
+#else
+ *((u4 *) (ra + 0 * 4)) = mcode[0];
+ *((u4 *) (ra + 1 * 4)) = mcode[1];
+#endif
/* synchronize instruction cache */
- docacheflush(ra, 2 * 4);
+ cacheflush(ra, 2 * 4, ICACHE);
/* patch super class' vftbl */
/* patcher_clinit **************************************************************
- XXX
+ No special machine code.
*******************************************************************************/
{
u1 *ra;
java_objectheader *o;
+#if SIZEOF_VOID_P == 8
u8 mcode;
+#else
+ u4 mcode[2];
+#endif
classinfo *c;
/* get stuff from the stack */
- ra = (u1 *) *((ptrint *) (sp + 5 * 8));
- o = (java_objectheader *) *((ptrint *) (sp + 4 * 8));
- mcode = *((u8 *) (sp + 3 * 8));
- c = (classinfo *) *((ptrint *) (sp + 2 * 8));
+ ra = (u1 *) *((ptrint *) (sp + 5 * 8));
+ o = (java_objectheader *) *((ptrint *) (sp + 4 * 8));
+#if SIZEOF_VOID_P == 8
+ mcode = *((u8 *) (sp + 3 * 8));
+#else
+ mcode[0] = *((u4 *) (sp + 3 * 8));
+ mcode[1] = *((u4 *) (sp + 3 * 8 + 4));
+#endif
+ c = (classinfo *) *((ptrint *) (sp + 2 * 8));
/* calculate and set the new return address */
/* patch back original code */
- *((u4 *) (ra + 0)) = mcode;
- *((u4 *) (ra + 4)) = mcode >> 32;
+#if SIZEOF_VOID_P == 8
+ *((u4 *) (ra + 0 * 4)) = mcode;
+ *((u4 *) (ra + 1 * 4)) = mcode >> 32;
+#else
+ *((u4 *) (ra + 0 * 4)) = mcode[0];
+ *((u4 *) (ra + 1 * 4)) = mcode[1];
+#endif
/* synchronize instruction cache */
- docacheflush(ra, 2 * 4);
+ cacheflush(ra, 2 * 4, ICACHE);
PATCHER_MARK_PATCHED_MONITOREXIT;
{
u1 *ra;
java_objectheader *o;
+#if SIZEOF_VOID_P == 8
u8 mcode;
+#else
+ u4 mcode[2];
+#endif
methodinfo *m;
s4 disp;
u1 *pv;
/* get stuff from the stack */
- ra = (u1 *) *((ptrint *) (sp + 5 * 8));
- o = (java_objectheader *) *((ptrint *) (sp + 4 * 8));
- mcode = *((u8 *) (sp + 3 * 8));
- m = (methodinfo *) *((ptrint *) (sp + 2 * 8));
- disp = *((s4 *) (sp + 1 * 8));
- pv = (u1 *) *((ptrint *) (sp + 0 * 8));
+ ra = (u1 *) *((ptrint *) (sp + 5 * 8));
+ o = (java_objectheader *) *((ptrint *) (sp + 4 * 8));
+#if SIZEOF_VOID_P == 8
+ mcode = *((u8 *) (sp + 3 * 8));
+#else
+ mcode[0] = *((u4 *) (sp + 3 * 8));
+ mcode[1] = *((u4 *) (sp + 3 * 8 + 4));
+#endif
+ m = (methodinfo *) *((ptrint *) (sp + 2 * 8));
+ disp = *((s4 *) (sp + 1 * 8));
+ pv = (u1 *) *((ptrint *) (sp + 0 * 8));
/* calculate and set the new return address */
/* patch back original code */
+#if SIZEOF_VOID_P == 8
*((u4 *) (ra + 0 * 4)) = mcode;
*((u4 *) (ra + 1 * 4)) = mcode >> 32;
+#else
+ *((u4 *) (ra + 0 * 4)) = mcode[0];
+ *((u4 *) (ra + 1 * 4)) = mcode[1];
+#endif
/* synchronize instruction cache */
- docacheflush(ra, 2 * 4);
+ cacheflush(ra, 2 * 4, ICACHE);
/* patch native function pointer */