1 /* $NetBSD: pio.h,v 1.4 2005/12/24 22:45:35 perry Exp $ */ 2 3 /* 4 * Mach Operating System 5 * Copyright (c) 1990 Carnegie-Mellon University 6 * All rights reserved. The CMU software License Agreement specifies 7 * the terms and conditions for use and redistribution. 8 */ 9 10 #define inl(y) \ 11 ({ unsigned long _tmp__; \ 12 __asm volatile("inl %1, %0" : "=a" (_tmp__) : "d" ((unsigned short)(y))); \ 13 _tmp__; }) 14 15 #define inw(y) \ 16 ({ unsigned short _tmp__; \ 17 __asm volatile(".byte 0x66; inl %1, %0" : "=a" (_tmp__) : "d" ((unsigned short)(y))); \ 18 _tmp__; }) 19 20 #define inb(y) \ 21 ({ unsigned char _tmp__; \ 22 __asm volatile("inb %1, %0" : "=a" (_tmp__) : "d" ((unsigned short)(y))); \ 23 _tmp__; }) 24 25 26 #define outl(x, y) \ 27 { __asm volatile("outl %0, %1" : : "a" (y) , "d" ((unsigned short)(x))); } 28 29 30 #define outw(x, y) \ 31 {__asm volatile(".byte 0x66; outl %0, %1" : : "a" ((unsigned short)(y)) , "d" ((unsigned short)(x))); } 32 33 34 #define outb(x, y) \ 35 { __asm volatile("outb %0, %1" : : "a" ((unsigned char)(y)) , "d" ((unsigned short)(x))); } 36