summaryrefslogtreecommitdiffstats
path: root/sys/i386/include/globals.h
diff options
context:
space:
mode:
authorjasone <jasone@FreeBSD.org>2000-09-07 01:33:02 +0000
committerjasone <jasone@FreeBSD.org>2000-09-07 01:33:02 +0000
commit769e0f974d8929599ba599ac496510fffc90ff34 (patch)
tree9387522900085835de81e7830e570ef3f6b3ea80 /sys/i386/include/globals.h
parentacf1927de02afda4855ec278b1128fd9446405ea (diff)
downloadFreeBSD-src-769e0f974d8929599ba599ac496510fffc90ff34.zip
FreeBSD-src-769e0f974d8929599ba599ac496510fffc90ff34.tar.gz
Major update to the way synchronization is done in the kernel. Highlights
include: * Mutual exclusion is used instead of spl*(). See mutex(9). (Note: The alpha port is still in transition and currently uses both.) * Per-CPU idle processes. * Interrupts are run in their own separate kernel threads and can be preempted (i386 only). Partially contributed by: BSDi (BSD/OS) Submissions by (at least): cp, dfr, dillon, grog, jake, jhb, sheldonh
Diffstat (limited to 'sys/i386/include/globals.h')
-rw-r--r--sys/i386/include/globals.h42
1 files changed, 38 insertions, 4 deletions
diff --git a/sys/i386/include/globals.h b/sys/i386/include/globals.h
index ae05d56..71bbbd5 100644
--- a/sys/i386/include/globals.h
+++ b/sys/i386/include/globals.h
@@ -74,6 +74,14 @@
__asm("movl %0,%%fs:gd_" #name : : "r" (val)); \
}
+static __inline int
+_global_globaldata(void)
+{
+ int val;
+ __asm("movl %%fs:globaldata,%0" : "=r" (val));
+ return (val);
+}
+
#if defined(SMP) || defined(KLD_MODULE) || defined(ACTUALLY_LKM_NOT_KERNEL)
/*
* The following set of macros works for UP kernel as well, but for maximum
@@ -82,18 +90,21 @@
* portability between UP and SMP kernels.
*/
#define curproc GLOBAL_RVALUE_NV(curproc, struct proc *)
+#define prevproc GLOBAL_RVALUE_NV(prevproc, struct proc *)
#define curpcb GLOBAL_RVALUE_NV(curpcb, struct pcb *)
-#define npxproc GLOBAL_LVALUE(npxproc, struct proc *)
+#define npxproc GLOBAL_RVALUE_NV(npxproc, struct proc *)
+#define idleproc GLOBAL_RVALUE_NV(idleproc, struct proc *)
#define common_tss GLOBAL_LVALUE(common_tss, struct i386tss)
#define switchtime GLOBAL_LVALUE(switchtime, struct timeval)
#define switchticks GLOBAL_LVALUE(switchticks, int)
+#define intr_nesting_level GLOBAL_RVALUE(intr_nesting_level, u_char)
#define common_tssd GLOBAL_LVALUE(common_tssd, struct segment_descriptor)
#define tss_gdt GLOBAL_LVALUE(tss_gdt, struct segment_descriptor *)
-#define astpending GLOBAL_LVALUE(astpending, u_int)
+#define astpending GLOBAL_RVALUE(astpending, u_int)
#ifdef USER_LDT
-#define currentldt GLOBAL_LVALUE(currentldt, int)
+#define currentldt GLOBAL_RVALUE(currentldt, int)
#endif
#ifdef SMP
@@ -109,19 +120,32 @@
#define prv_CADDR3 GLOBAL_RVALUE(prv_CADDR3, caddr_t)
#define prv_PADDR1 GLOBAL_RVALUE(prv_PADDR1, unsigned *)
#endif
+
+#define witness_spin_check GLOBAL_RVALUE(witness_spin_check, int)
+
#endif /*UP kernel*/
GLOBAL_FUNC(curproc)
+GLOBAL_FUNC(prevproc)
GLOBAL_FUNC(astpending)
GLOBAL_FUNC(curpcb)
GLOBAL_FUNC(npxproc)
+GLOBAL_FUNC(idleproc)
GLOBAL_FUNC(common_tss)
GLOBAL_FUNC(switchtime)
GLOBAL_FUNC(switchticks)
+GLOBAL_FUNC(intr_nesting_level)
GLOBAL_FUNC(common_tssd)
GLOBAL_FUNC(tss_gdt)
+/* XXX */
+#ifdef KTR_PERCPU
+GLOBAL_FUNC(ktr_idx)
+GLOBAL_FUNC(ktr_buf)
+GLOBAL_FUNC(ktr_buf_data)
+#endif
+
#ifdef USER_LDT
GLOBAL_FUNC(currentldt)
#endif
@@ -140,7 +164,17 @@ GLOBAL_FUNC(prv_CADDR3)
GLOBAL_FUNC(prv_PADDR1)
#endif
-#define SET_CURPROC(x) (_global_curproc_set_nv((int)x))
+GLOBAL_FUNC(witness_spin_check)
+
+#ifdef SMP
+#define GLOBALDATA GLOBAL_RVALUE(globaldata, struct globaldata *)
+#else
+#define GLOBALDATA (&globaldata)
+#endif
+
+#define CURPROC curproc
+
+#define PCPU_SET(name, value) (_global_##name##_set((int)value))
#endif /* _KERNEL */
OpenPOWER on IntegriCloud