PR85 for x86_64.
[cacao.git] / src / vm / jit / x86_64 / patcher.c
index fa0c0b296d264b0bc990bf92bf4ed17bb3cf5197..ae4b7aa2131eb14c9949dca08ab808ba38f185ab 100644 (file)
@@ -59,6 +59,21 @@ void patcher_patch_code(patchref_t *pr)
        md_icacheflush((void*) pr->mpc, PATCHER_CALL_SIZE);
 }
 
+/**
+ * Check if the trap instruction at the given PC is valid.
+ *
+ * @param pc Program counter.
+ *
+ * @return true if valid, false otherwise.
+ */
+bool patcher_is_valid_trap_instruction_at(void* pc)
+{
+       uint16_t mcode = *((uint16_t*) pc);
+
+       // Check for the undefined instruction we use.
+       return (mcode == 0x0b0f);
+}
+
 
 /* patcher_resolve_classref_to_classinfo ***************************************