Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/i386/include Prevent gcc from reordering things suc...
details: https://anonhg.NetBSD.org/src/rev/8647723a0f1c
branches: trunk
changeset: 519478:8647723a0f1c
user: fvdl <fvdl%NetBSD.org@localhost>
date: Tue Dec 18 10:12:28 2001 +0000
description:
Prevent gcc from reordering things such that instructions may fall out
of a range which is protected by spl/splx. Originally proposed by
YAMAMOTO Takashi (yamt%netbsd.org@localhost) on tech-kern. This change mirrors
the one done by Bill Sommerfeld on the i386 mp branch.
diffstat:
sys/arch/i386/include/intr.h | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
diffs (42 lines):
diff -r f24d19c7c022 -r 8647723a0f1c sys/arch/i386/include/intr.h
--- a/sys/arch/i386/include/intr.h Tue Dec 18 09:31:47 2001 +0000
+++ b/sys/arch/i386/include/intr.h Tue Dec 18 10:12:28 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: intr.h,v 1.22 2001/07/16 16:53:00 thorpej Exp $ */
+/* $NetBSD: intr.h,v 1.23 2001/12/18 10:12:28 fvdl Exp $ */
/*-
* Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -80,6 +80,16 @@
static __inline void softintr __P((int));
/*
+ * compiler barrier: prevent reordering of instructions.
+ * XXX something similar will move to <sys/cdefs.h>
+ * or thereabouts.
+ * This prevents the compiler from reordering code around
+ * this "instruction", acting as a sequence point for code generation.
+ */
+
+#define __splbarrier() __asm __volatile("":::"memory")
+
+/*
* Add a mask to cpl, and return the old value of cpl.
*/
static __inline int
@@ -89,6 +99,7 @@
register int ocpl = cpl;
cpl = ocpl | ncpl;
+ __splbarrier();
return (ocpl);
}
@@ -101,6 +112,7 @@
register int ncpl;
{
+ __splbarrier();
cpl = ncpl;
if (ipending & ~ncpl)
Xspllower();
Home |
Main Index |
Thread Index |
Old Index