1 $NetBSD: patch-ab,v 1.3 2000/01/11 11:31:19 agc Exp $
3 Add NetBSD and Solaris platforms
4 Add inb() and outb() from XFree86 sources.
5 Add NetBSD/x86_64 support.
7 --- rio.cpp.orig 1999-06-11 12:26:46.000000000 -0400
8 +++ rio.cpp 2008-08-02 14:16:07.000000000 -0400
10 #define CLOCK_SECOND ((int)CLOCKS_PER_SEC)
11 #define DELETEARRAY delete
13 +#elif defined(__NetBSD__)
14 + // NetBSD/i386,amd64 g++
17 + #include <machine/sysarch.h>
18 + //#include <machine/cpufunc.h>
19 + #define OUTPORT(p,v) outb( p, v )
20 + #define INPORT(p) inb( p )
21 + #define CLOCK_SECOND CLOCKS_PER_SEC
22 + #define DELETEARRAY delete[]
24 +#elif defined(__sun__) && defined(__svr4__)
28 + #include <sys/cpupart.h>
29 + #include <sys/cpuvar.h>
30 + #include <sys/ddi.h>
31 + #include <sys/sunddi.h>
32 + #define OUTPORT(p,v) outb( p, v )
33 + #define INPORT(p) inb( p )
34 + #define CLOCK_SECOND CLOCKS_PER_SEC
35 + #define DELETEARRAY delete[]
39 #error ! ! compiler/platform not supported ! !
42 +#if defined(__NetBSD__)
43 +/* copied from the XFree86 sources */
44 +/* xc/programs/Xserver/hw/xfree86/common/compiler.h */
45 +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/compiler.h,v 3.24.2.4 1998/10/18 20:42:10 hohndel Exp $ */
47 + * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
49 + * Permission to use, copy, modify, distribute, and sell this software and its
50 + * documentation for any purpose is hereby granted without fee, provided that
51 + * the above copyright notice appear in all copies and that both that
52 + * copyright notice and this permission notice appear in supporting
53 + * documentation, and that the name of Thomas Roell not be used in
54 + * advertising or publicity pertaining to distribution of the software without
55 + * specific, written prior permission. Thomas Roell makes no representations
56 + * about the suitability of this software for any purpose. It is provided
57 + * "as is" without express or implied warranty.
59 + * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
60 + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
61 + * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
62 + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
63 + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
64 + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
65 + * PERFORMANCE OF THIS SOFTWARE.
68 +/* $XConsortium: compiler.h /main/16 1996/10/25 15:38:34 kaleb $ */
69 +/* also hacked by agc to do i386_iopl, and by dholland for x86_64_iopl */
70 +static int ports_enabled;
72 +static __inline__ unsigned int
73 +inb(unsigned short int port)
77 + if (!ports_enabled) {
86 + __asm__ __volatile__("inb %1,%0" :
92 +static __inline__ void
93 +outb(unsigned short int port, unsigned char val)
95 + if (!ports_enabled) {
104 + __asm__ __volatile__("outb %0,%1" : :"a" (val), "d" (port));
108 // port offset constants
109 #define OFFSET_PORT_DATA 0
110 #define OFFSET_PORT_STATUS 1