Received: from PACIFIC-CARRIER-ANNEX.MIT.EDU by po7.MIT.EDU (5.61/4.7) id AA28154; Tue, 19 Dec 95 16:06:21 EST
Received: from pain.lcs.mit.edu by MIT.EDU with SMTP
	id AA25445; Tue, 19 Dec 95 16:06:20 EST
Received: (from daemon@localhost) by pain.lcs.mit.edu (8.6.12/8.6.9) id PAA09992; Tue, 19 Dec 1995 15:34:02 -0500
Received: from slave.cygnus.com by pain.lcs.mit.edu (8.6.12/8.6.9) with ESMTP id PAA09841 for <netbsd-developers@netbsd.org>; Tue, 19 Dec 1995 15:19:59 -0500
Received: (from jtc@localhost) by slave.cygnus.com (8.6.12/8.6.11) id MAA02761; Tue, 19 Dec 1995 12:14:27 -0800
Date: Tue, 19 Dec 1995 12:14:27 -0800
Message-Id: <199512192014.MAA02761@slave.cygnus.com>
From: "J.T. Conklin" <jtc@slave.cygnus.com>
To: netbsd-developers@NetBSD.ORG
Subject: Re: i386 pio.h 2.7.2 lossage
Sender: owner-netbsd-developers@NetBSD.ORG
Precedence: first-class
X-Loop: netbsd-developers@NetBSD.ORG

A while back someone reported that the new constraint "N" was needed
for gcc 2.7.X, and that it simplified inb() and inw().  The enclosed
patch is based on the information in that message.  I haven't tested
it yet as I don't have access to a i386 machine at the moment, but 
you guys might find it useful anyway.

	--jtc

Index: pio.h
===================================================================
RCS file: /a/cvsroot/src/sys/arch/i386/include/pio.h,v
retrieving revision 1.11
diff -c -r1.11 pio.h
*** pio.h	1995/04/22 03:59:59	1.11
--- pio.h	1995/12/19 19:03:21
***************
*** 50,55 ****
--- 50,66 ----
  #endif
  
  
+ #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+ static __inline u_char
+ inb (int port)
+ {
+ 	u_char data;
+ 	__asm __volatile("inb %w1,%b0" : "=a" : "Nd" (port))
+ 	return data;
+ }
+ 
+ #else
+ 
  #define	inb(port) \
  	(__use_immediate_port(port) ? __inbc(port) : __inb(port))
  
***************
*** 68,73 ****
--- 79,85 ----
  	__asm __volatile("inb %%dx,%0" : "=a" (data) : "d" (port));
  	return data;
  }
+ #endif /* __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) */
  
  static __inline void
  insb(int port, void *addr, int cnt)
***************
*** 78,83 ****
--- 90,105 ----
  			 "%edi", "%ecx", "memory");
  }
  
+ #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+ static __inline u_short
+ inw (int port)
+ {
+ 	u_short data;
+ 	__asm __volatile("inb %w1,%w0" : "=a" : "Nd" (port))
+ 	return data;
+ }
+ #else
+ 
  #define	inw(port) \
  	(__use_immediate_port(port) ? __inwc(port) : __inw(port))
  
***************
*** 96,101 ****
--- 118,124 ----
  	__asm __volatile("inw %%dx,%0" : "=a" (data) : "d" (port));
  	return data;
  }
+ #endif /* __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) */
  
  static __inline void
  insw(int port, void *addr, int cnt)
