summaryrefslogtreecommitdiff
path: root/debian/patches/40_iopl_mmap.patch
blob: 0dfc3402dd18b84a5390dfef1d166f051a13f704 (plain)
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
99
Index: b/i386/Makefrag.am
===================================================================
--- a/i386/Makefrag.am
+++ b/i386/Makefrag.am
@@ -31,6 +31,7 @@ libkernel_a_SOURCES += \
 	i386/i386at/immc.c \
 	i386/i386at/int_init.c \
 	i386/i386at/interrupt.S \
+	i386/i386at/iopl.c \
 	i386/i386at/kd.c \
 	i386/i386at/kd.h \
 	i386/i386at/kd_event.c \
Index: b/i386/i386at/conf.c
===================================================================
--- a/i386/i386at/conf.c
+++ b/i386/i386at/conf.c
@@ -58,6 +58,9 @@ extern int	kbdgetstat(), kbdsetstat();
 extern int	mouseopen(), mouseclose(), mouseread(), mousegetstat();
 #define	mousename		"mouse"
 
+extern vm_offset_t ioplmmap();
+#define	ioplname		"iopl"
+
 extern int	kmsgopen(), kmsgclose(), kmsgread(), kmsggetstat();
 #define kmsgname		"kmsg"
 
@@ -113,6 +116,11 @@ struct dev_ops	dev_name_list[] =
 	  nodev,	nulldev,	nulldev,	0,
 	  nodev },
 
+	{ ioplname,	nulldev,	nulldev,	nodev,
+	  nodev,	nodev,		nodev,		ioplmmap,
+	  nodev,	nulldev,	nulldev,	0,
+	  nodev },
+
 #ifdef	MACH_KMSG
         { kmsgname,     kmsgopen,       kmsgclose,       kmsgread,
           nodev,        kmsggetstat,    nodev,           nomap,
Index: b/i386/i386at/iopl.c
===================================================================
--- /dev/null
+++ b/i386/i386at/iopl.c
@@ -0,0 +1,56 @@
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+ 
+#include <device/io_req.h>
+
+/*ARGSUSED*/
+int iopl_all = 1;
+int
+ioplmmap(dev, off, prot)
+int		dev;
+vm_offset_t	off;
+vm_prot_t	prot;
+{
+    extern vm_offset_t phys_last_addr;
+
+    if (iopl_all) {
+	if (off == 0)
+		return 0;
+	else if (off < 0xa0000)
+		return -1;
+	else if (off >= 0x100000 && off <= phys_last_addr)
+		return -1;
+	else
+		return i386_btop(off);
+
+    }
+	if (off > 0x60000)
+		return(-1);
+
+	/* Get page frame number for the page to be mapped. */
+
+	return(i386_btop(0xa0000 + off));
+}