summaryrefslogtreecommitdiff
path: root/debian/patches/40_iopl_mmap.patch
blob: 9398a457820e67e7663edbd4267f8a972e5726b5 (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
100
101
102
103
104
105
106
107
Index: i386/Makefrag.am
===================================================================
RCS file: /cvsroot/hurd/gnumach/i386/Attic/Makefrag.am,v
retrieving revision 1.1.2.10
diff -u -p -r1.1.2.10 Makefrag.am
--- i386/Makefrag.am	7 May 2007 22:04:53 -0000	1.1.2.10
+++ i386/Makefrag.am	9 May 2007 16:09:12 -0000
@@ -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: i386/i386at/conf.c
===================================================================
RCS file: /cvsroot/hurd/gnumach/i386/i386at/Attic/conf.c,v
retrieving revision 1.4.2.15
diff -u -p -r1.4.2.15 conf.c
--- i386/i386at/conf.c	1 Apr 2007 22:10:40 -0000	1.4.2.15
+++ i386/i386at/conf.c	9 May 2007 16:09:16 -0000
@@ -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: i386/i386at/iopl.c
===================================================================
RCS file: i386/i386at/iopl.c
diff -N i386/i386at/iopl.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ i386/i386at/iopl.c	9 May 2007 16:09:16 -0000
@@ -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));
+}