Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: patcher.c 7892 2007-05-10 12:50:45Z tbfg $
-
*/
#include "config.h"
#include <assert.h>
+#include <stdint.h>
#include "vm/types.h"
/* patch the field value's address */
- *((ptrint *) (pv + disp)) = (ptrint) &(fi->value);
+ *((intptr_t *) (pv + disp)) = (intptr_t) fi->value;
/* synchronize data cache */
{
constant_classref *cr;
s4 disp;
- u1 *pv;
+ u1 *pv, *ra;
+ u4 mcode;
classinfo *c;
/* get stuff from the stack */
+ ra = (u1 *) *((ptrint *) (sp + 5 * 8));
+ mcode = *((u4 *) (sp + 3 * 8));
cr = (constant_classref *) *((ptrint *) (sp + 2 * 8));
disp = *((s4 *) (sp + 1 * 8));
pv = (u1 *) *((ptrint *) (sp + 0 * 8));
if (!(c = resolve_classref_eager(cr)))
return false;
+ /* patch back original code */
+
+ *((u4 *) ra) = mcode;
+
+ /* synchronize instruction cache */
+
+ md_icacheflush(ra, 4);
+
/* patch the classinfo pointer */
*((ptrint *) (pv + disp)) = (ptrint) c;
{
constant_classref *cr;
s4 disp;
- u1 *pv;
+ u1 *pv, *ra;
+ u4 mcode;
classinfo *c;
/* get stuff from the stack */
+ ra = (u1 *) *((ptrint *) (sp + 5 * 8));
+ mcode = *((u4 *) (sp + 3 * 8));
cr = (constant_classref *) *((ptrint *) (sp + 2 * 8));
disp = *((s4 *) (sp + 1 * 8));
pv = (u1 *) *((ptrint *) (sp + 0 * 8));
if (!(c = resolve_classref_eager(cr)))
return false;
+ /* patch back original code */
+
+ *((u4 *) ra) = mcode;
+
+ /* synchronize instruction cache */
+
+ md_icacheflush(ra, 4);
+
/* patch super class' vftbl */
*((ptrint *) (pv + disp)) = (ptrint) c->vftbl;
{
constant_classref *cr;
s4 disp;
- u1 *pv;
+ u1 *pv, *ra;
+ u4 mcode;
classinfo *c;
/* get stuff from the stack */
+ ra = (u1 *) *((ptrint *) (sp + 5 * 8));
+ mcode = *((u4 *) (sp + 3 * 8));
cr = (constant_classref *) *((ptrint *) (sp + 2 * 8));
disp = *((s4 *) (sp + 1 * 8));
pv = (u1 *) *((ptrint *) (sp + 0 * 8));
if (!(c = resolve_classref_eager(cr)))
return false;
+ /* patch back original code */
+
+ *((u4 *) ra) = mcode;
+
+ /* synchronize instruction cache */
+
+ md_icacheflush(ra, 4);
+
/* patch class flags */
*((s4 *) (pv + disp)) = (s4) c->flags;