o = exceptions_new_hardware_exception(pv, sp, ra, xpc, type, val);
- /* set registers */
-
- _sc->arm_r10 = (ptrint) o;
- _sc->arm_fp = (ptrint) xpc;
- _sc->arm_pc = (ptrint) asm_handle_exception;
+ /* set registers if we have an exception, return continue execution
+ otherwise (this is needed for patchers to work) */
+
+ if (o != NULL) {
+ _sc->arm_r10 = (ptrint) o;
+ _sc->arm_fp = (ptrint) xpc;
+ _sc->arm_pc = (ptrint) asm_handle_exception;
+ }
}