- mutex = mutex_addr(host_priv->lock);
- excp = &host_priv->exc_actions[exception];
- exception_deliver(exception, code, codeCnt, excp, mutex);
+ mutex = &host_priv->lock;
+
+ if (KERN_SUCCESS == check_exc_receiver_dependency(exception, host_priv->exc_actions, mutex))
+ {
+ kr = exception_deliver(thread, exception, code, codeCnt, host_priv->exc_actions, mutex);
+ if (kr == KERN_SUCCESS || kr == MACH_RCV_PORT_DIED)
+ goto out;
+ }
+
+out:
+ if ((exception != EXC_CRASH) && (exception != EXC_RESOURCE) &&
+ (exception != EXC_GUARD) && (exception != EXC_CORPSE_NOTIFY))
+ thread_exception_return();
+ return kr;
+}
+
+/*
+ * Routine: exception_triage
+ * Purpose:
+ * The current thread caught an exception.
+ * We make an up-call to the thread's exception server.
+ * Conditions:
+ * Nothing locked and no resources held.
+ * Called from an exception context, so
+ * thread_exception_return and thread_kdb_return
+ * are possible.
+ * Returns:
+ * KERN_SUCCESS if exception is handled by any of the handlers.
+ */
+kern_return_t
+exception_triage(
+ exception_type_t exception,
+ mach_exception_data_t code,
+ mach_msg_type_number_t codeCnt)
+{
+ thread_t thread = current_thread();
+ return exception_triage_thread(exception, code, codeCnt, thread);
+}
+
+kern_return_t
+bsd_exception(
+ exception_type_t exception,
+ mach_exception_data_t code,
+ mach_msg_type_number_t codeCnt)
+{
+ task_t task;
+ lck_mtx_t *mutex;
+ thread_t self = current_thread();
+ kern_return_t kr;