Subject: how to avoid re-ordering?
To: None <tech-kern@netbsd.org>
From: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
List: tech-kern
Date: 12/05/2001 12:03:37
----Next_Part(Wed_Dec__5_12:03:37_2001_507)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

hi.

I noticed that spl*/splx are inlined and re-orderd
with "-O3 -march=pentium", and it produce bad codes as a result.
I actually experienced panics due to this.

attached patch solve this. although it's very ugly.
is it acceptable?

I post to tech-kern instead of port-i386
since the problem itsself isn't port-specific.

---
YAMAMOTO Takashi<yamt@mwd.biglobe.ne.jp>

----Next_Part(Wed_Dec__5_12:03:37_2001_507)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="intr.h.diff"

Index: intr.h
===================================================================
RCS file: /cvs/cvsroot/syssrc/sys/arch/i386/include/intr.h,v
retrieving revision 1.22
diff -u -p -r1.22 intr.h
--- intr.h	2001/07/16 16:53:00	1.22
+++ intr.h	2001/12/05 02:53:15
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.h,v 1.22 2001/07/16 16:53:00 thorpej Exp $	*/
+/*	$NetBSD: intr.h,v 1.21 2001/05/21 04:47:35 perry Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -89,6 +89,7 @@ splraise(ncpl)
 	register int ocpl = cpl;
 
 	cpl = ocpl | ncpl;
+	__asm __volatile ("");
 	return (ocpl);
 }
 
@@ -101,6 +102,7 @@ spllower(ncpl)
 	register int ncpl;
 {
 
+	__asm __volatile ("");
 	cpl = ncpl;
 	if (ipending & ~ncpl)
 		Xspllower();

----Next_Part(Wed_Dec__5_12:03:37_2001_507)----