summaryrefslogtreecommitdiff
path: root/libstore
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-03-05 21:19:55 +0000
committerRoland McGrath <roland@gnu.org>2002-03-05 21:19:55 +0000
commit0e534038fedc4c12150b73b86e7bd5478e466c88 (patch)
treeb3b2d77171bea89a46b749775267dee8d43d78b4 /libstore
parent1536fb3ea57668f41c8c160288b3daeab2163639 (diff)
2002-03-05 Roland McGrath <roland@frob.com>
* device.c (dev_map): Pass proper OFFSET and SIZE params to device_map.
Diffstat (limited to 'libstore')
-rw-r--r--libstore/device.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/libstore/device.c b/libstore/device.c
index ab8d0d42..014c815b 100644
--- a/libstore/device.c
+++ b/libstore/device.c
@@ -214,10 +214,18 @@ dev_map (const struct store *store, vm_prot_t prot, mach_port_t *memobj)
return EOPNOTSUPP;
else
{
- /* We pass in 0 for the OFFSET and SIZE argument because in many cases
- we can't supply them (devices that can't otherwise do I/O are often
- still mappable) and mach ignores them entirely. XXXX */
- error_t err = device_map (store->port, prot, 0, 0, memobj, 0);
+ /* Note that older Mach drivers (through GNU Mach 1.x) ignore
+ the OFFSET and SIZE parameters. The OSKit-Mach drivers obey
+ them, and so the size we pass must be large enough (or zero
+ only if the size is indeterminable). If using only the newer
+ drivers, we could remove the `start != 0' condition above and
+ support kernel mapping of partial devices. However, since
+ the older drivers silently ignore the OFFSET argument, that
+ would produce scrambled results on old kernels. */
+ error_t err = device_map (store->port, prot,
+ store->runs[0].start,
+ store->runs[0].length,
+ memobj, 0);
if (err == ED_INVALID_OPERATION)
err = EOPNOTSUPP; /* This device doesn't support paging. */
return err;