+/*
+ * This is used to remember any FS error from VNOP_PAGEIN code when
+ * invoked under vm_fault(). The value is an errno style value. It can
+ * be retrieved by exception handlers using thread_get_state().
+ */
+void
+set_thread_pagein_error(thread_t th, int error)
+{
+ assert(th == current_thread());
+ if (error == 0 || th->t_pagein_error == 0) {
+ th->t_pagein_error = error;
+ }
+}
+
+#if defined(__x86_64__)
+/*
+ * Returns non-zero if the thread has a non-NULL task
+ * and that task has an LDT.
+ */
+int
+thread_task_has_ldt(thread_t th)
+{
+ return th->task && th->task->i386_ldt != 0;
+}
+#endif /* __x86_64__ */
+