* Updated to jitcache-arm-x86 branch d4f6023b26c5+d1b5b1c106ac
[cacao.git] / src / vm / jit / arm / patcher.c
index 105fa094468ba9c607cdc72aa5a42d02f855bff6..f3d70b2544957066c6817dccf62657f5045cf88b 100644 (file)
                /*(inst) |= (1 << 23);*/ \
        }
 
+/* This is the same as gen_resolveload but does not check whether the opcode
+ * is 'clean' (= current offset is zero).
+ */
+#define gen_resolveload_unchecked(inst,offset) \
+       assert((offset) >= -0x0fff && (offset) <= 0x0fff); \
+       if ((offset) <  0) { \
+               (inst) = ((inst) & 0xff7ff000) | ((-(offset)) & 0x0fff); \
+               /*(inst) &= ~(1 << 23);*/ \
+       } else { \
+               (inst) = ((inst) & 0xfffff000) | ((offset) & 0x0fff); \
+               /*(inst) |= (1 << 23);*/ \
+       }
+
+/* patch_md ********************************************************************
+
+   Patch back address in a machine dependent way 
+
+*******************************************************************************/
+void patch_md(s4 md_patch, ptrint dest, void* ref)
+{
+       gen_resolveload_unchecked(*((s4 *) dest), (s4) ref);
+}
 
 /* patcher_patch_code **********************************************************