Received: from PACIFIC-CARRIER-ANNEX.MIT.EDU by po7.MIT.EDU (5.61/4.7) id AA08383; Wed, 20 Dec 95 16:32:10 EST
Received: from pain.lcs.mit.edu by MIT.EDU with SMTP
	id AA18174; Wed, 20 Dec 95 16:32:09 EST
Received: (from daemon@localhost) by pain.lcs.mit.edu (8.6.12/8.6.9) id PAA29756; Wed, 20 Dec 1995 15:41:00 -0500
Received: from deshaw.com by pain.lcs.mit.edu (8.6.12/8.6.9) with ESMTP id OAA28606 for <netbsd-developers@NetBSD.ORG>; Wed, 20 Dec 1995 14:54:15 -0500
Received: from cs1.boston.deshaw.com (mycroft@cs1.boston.deshaw.com [149.77.131.41])
 by deshaw.com (8.6.12/8.7.Alpha.4/1.33.kim) with ESMTP id MAA22388
 for <netbsd-developers@NetBSD.ORG>; Wed, 20 Dec 1995 12:25:51 -0500
Received: (from mycroft@localhost)
 by cs1.boston.deshaw.com (8.6.12/8.7.Alpha.4/1.33.kim) id MAA03103;
 Wed, 20 Dec 1995 12:24:02 -0500
Date: Wed, 20 Dec 1995 12:24:02 -0500
From: Charles Hannum <Charles-Hannum@deshaw.com>
Message-Id: <199512201724.MAA03103@cs1.boston.deshaw.com>
To: jtc@slave.cygnus.com
Cc: netbsd-developers@NetBSD.ORG
In-Reply-To: <199512192014.MAA02761@slave.cygnus.com> (jtc@slave.cygnus.com)
Subject: Re: i386 pio.h 2.7.2 lossage
Sender: owner-netbsd-developers@NetBSD.ORG
Precedence: first-class
X-Loop: netbsd-developers@NetBSD.ORG


   + #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
   + 

I did that already, and it worked, but it has two problems:

1) You still need the old code for older versions of GCC.

2) It's conceptually wrong, since the `%w1' would expand to a byte
value in the case of a constant.  I think there's a way to put
alternatives in a template, but I don't know what it is.  e.g.:

	__asm __volatile("inb {%b1,%w1},%0" : "=a,a" (data) : "N,d" (port))

The change I made (based on looking at the Linux source) should work
for both version of GCC.  I actually have no idea why adding the `d'
constraint would fix it; this seems like a bug in GCC.

