Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/uvm modify udv_attach() and its caller (uvm_mmap()) so t...
details: https://anonhg.NetBSD.org/src/rev/982b7f7cfce2
branches: trunk
changeset: 467391:982b7f7cfce2
user: cgd <cgd%NetBSD.org@localhost>
date: Wed Mar 24 03:52:41 1999 +0000
description:
modify udv_attach() and its caller (uvm_mmap()) so that it's passed the
offset and size of the requested region to be mapped, so that the
udv_attach() can use the device d_mmap() entry to check mappability
of the requested region.
diffstat:
sys/uvm/uvm_device.c | 22 +++++++++++++++++++---
sys/uvm/uvm_device.h | 4 ++--
sys/uvm/uvm_mmap.c | 4 ++--
3 files changed, 23 insertions(+), 7 deletions(-)
diffs (87 lines):
diff -r f8ca8cbeaabe -r 982b7f7cfce2 sys/uvm/uvm_device.c
--- a/sys/uvm/uvm_device.c Wed Mar 24 03:48:04 1999 +0000
+++ b/sys/uvm/uvm_device.c Wed Mar 24 03:52:41 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_device.c,v 1.12 1999/03/24 03:45:27 cgd Exp $ */
+/* $NetBSD: uvm_device.c,v 1.13 1999/03/24 03:52:41 cgd Exp $ */
/*
* XXXCDC: "ROUGH DRAFT" QUALITY UVM PRE-RELEASE FILE!
@@ -74,7 +74,7 @@
*/
static void udv_init __P((void));
-struct uvm_object *udv_attach __P((void *, vm_prot_t));
+struct uvm_object *udv_attach __P((void *, vm_prot_t, vaddr_t, vsize_t));
static void udv_reference __P((struct uvm_object *));
static void udv_detach __P((struct uvm_object *));
static int udv_fault __P((struct uvm_faultinfo *, vaddr_t,
@@ -135,9 +135,11 @@
* => in fact, nothing should be locked so that we can sleep here.
*/
struct uvm_object *
-udv_attach(arg, accessprot)
+udv_attach(arg, accessprot, off, size)
void *arg;
vm_prot_t accessprot;
+ vaddr_t off; /* used only for access check */
+ vsize_t size; /* used only for access check */
{
dev_t device = *((dev_t *) arg);
struct uvm_device *udv, *lcv;
@@ -157,6 +159,20 @@
return(NULL);
/*
+ * Check that the specified range of the device allows the
+ * desired protection.
+ *
+ * XXX assumes VM_PROT_* == PROT_*
+ * XXX clobbers off and size, but nothing else here needs them.
+ */
+
+ while (size != 0) {
+ if ((*mapfn)(device, off, accessprot) == -1)
+ return (NULL);
+ off += PAGE_SIZE, size -= PAGE_SIZE;
+ }
+
+ /*
* keep looping until we get it
*/
diff -r f8ca8cbeaabe -r 982b7f7cfce2 sys/uvm/uvm_device.h
--- a/sys/uvm/uvm_device.h Wed Mar 24 03:48:04 1999 +0000
+++ b/sys/uvm/uvm_device.h Wed Mar 24 03:52:41 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_device.h,v 1.5 1998/03/09 00:58:56 mrg Exp $ */
+/* $NetBSD: uvm_device.h,v 1.6 1999/03/24 03:52:41 cgd Exp $ */
/*
* XXXCDC: "ROUGH DRAFT" QUALITY UVM PRE-RELEASE FILE!
@@ -71,6 +71,6 @@
* prototypes
*/
-struct uvm_object *udv_attach __P((void *, vm_prot_t));
+struct uvm_object *udv_attach __P((void *, vm_prot_t, vaddr_t, vsize_t));
#endif /* _UVM_UVM_DEVICE_H_ */
diff -r f8ca8cbeaabe -r 982b7f7cfce2 sys/uvm/uvm_mmap.c
--- a/sys/uvm/uvm_mmap.c Wed Mar 24 03:48:04 1999 +0000
+++ b/sys/uvm/uvm_mmap.c Wed Mar 24 03:52:41 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_mmap.c,v 1.17 1999/03/09 12:18:23 kleink Exp $ */
+/* $NetBSD: uvm_mmap.c,v 1.18 1999/03/24 03:52:41 cgd Exp $ */
/*
* XXXCDC: "ROUGH DRAFT" QUALITY UVM PRE-RELEASE FILE!
@@ -904,7 +904,7 @@
} else {
uobj = udv_attach((void *) &vp->v_rdev,
(flags & MAP_SHARED) ?
- maxprot : (maxprot & ~VM_PROT_WRITE));
+ maxprot : (maxprot & ~VM_PROT_WRITE), foff, size);
advice = UVM_ADV_RANDOM;
}
Home |
Main Index |
Thread Index |
Old Index