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