aboutsummaryrefslogtreecommitdiff
path: root/sys/ia64
diff options
context:
space:
mode:
authorMatthew Dillon <dillon@FreeBSD.org>2002-03-27 05:39:23 +0000
committerMatthew Dillon <dillon@FreeBSD.org>2002-03-27 05:39:23 +0000
commitd74ac6819b2cc8e5c18a099a97ffc16616b4e94d (patch)
tree8233f61cf29e01829b91c6a5cf27defe60e6b8d8 /sys/ia64
parent50a565560242eb8b86d01bb62036d501aa4fa52b (diff)
Notes
Diffstat (limited to 'sys/ia64')
-rw-r--r--sys/ia64/ia64/critical.c58
-rw-r--r--sys/ia64/include/cpufunc.h17
-rw-r--r--sys/ia64/include/proc.h1
3 files changed, 64 insertions, 12 deletions
diff --git a/sys/ia64/ia64/critical.c b/sys/ia64/ia64/critical.c
new file mode 100644
index 000000000000..77a6c83bb33b
--- /dev/null
+++ b/sys/ia64/ia64/critical.c
@@ -0,0 +1,58 @@
+/*-
+ * Copyright (c) 2001 Matthew Dillon. This code is distributed under
+ * the BSD copyright, /usr/src/COPYRIGHT.
+ *
+ * $FreeBSD$
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/pcpu.h>
+#include <sys/eventhandler.h> /* XX */
+#include <sys/ktr.h> /* XX */
+#include <sys/signalvar.h>
+#include <sys/sysproto.h> /* XX */
+#include <sys/kernel.h>
+#include <sys/proc.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
+#include <sys/sysctl.h>
+#include <sys/ucontext.h>
+
+void
+cpu_critical_enter(void)
+{
+ struct thread *td = curthread;
+
+ td->td_md.md_savecrit = intr_disable();
+}
+
+void
+cpu_critical_exit(void)
+{
+ struct thread *td = curthread;
+
+ intr_restore(td->td_md.md_savecrit);
+}
+
+/*
+ * cpu_critical_fork_exit() - cleanup after fork
+ */
+void
+cpu_critical_fork_exit(void)
+{
+ struct thread *td = curthread;
+
+ td->td_critnest = 1;
+ td->td_md.md_savecrit = (ia64_get_psr() | IA64_PSR_I);
+}
+
+/*
+ * cpu_thread_link() - thread linkup, initialize machine-dependant fields
+ */
+void
+cpu_thread_link(struct thread *td)
+{
+ td->td_md.md_savecrit = 0;
+}
+
diff --git a/sys/ia64/include/cpufunc.h b/sys/ia64/include/cpufunc.h
index 713ecf49239e..e7cf818021fc 100644
--- a/sys/ia64/include/cpufunc.h
+++ b/sys/ia64/include/cpufunc.h
@@ -34,7 +34,7 @@
#include <sys/types.h>
#include <machine/ia64_cpu.h>
-#define CRITICAL_FORK (ia64_get_psr() | IA64_PSR_I)
+struct thread;
#ifdef __GNUC__
@@ -300,17 +300,10 @@ intr_restore(critical_t psr)
__asm __volatile ("mov psr.l=%0;; srlz.d" :: "r" (psr));
}
-static __inline critical_t
-cpu_critical_enter(void)
-{
- return (intr_disable());
-}
-
-static __inline void
-cpu_critical_exit(critical_t psr)
-{
- intr_restore(psr);
-}
+void cpu_critical_enter(void);
+void cpu_critical_exit(void);
+void cpu_critical_fork_exit(void);
+void cpu_thread_link(struct thread *td);
#endif /* _KERNEL */
diff --git a/sys/ia64/include/proc.h b/sys/ia64/include/proc.h
index c9ae251557e5..4daead6a4c0a 100644
--- a/sys/ia64/include/proc.h
+++ b/sys/ia64/include/proc.h
@@ -39,6 +39,7 @@ struct mdthread {
u_long md_flags;
void *md_kstackvirt; /* virtual address of td_kstack */
vm_offset_t md_bspstore; /* initial ar.bspstore */
+ register_t md_savecrit;
};
#define MDP_FPUSED 0x0001 /* Process used the FPU */