I am writing a driver that maps kernel memory to user space using the
devmap() framework. This works well if the length parameter for mmap()
is page-aligned. If not, EINVAL is returned by mmap().
I am running SXCE snv_66. Looking at the current version of
uts/common/vm/seg_dev.c, where the device drivers devmap() callback is
called, I see:
if ((ret = cdev_devmap(dev, dhp, map_off,
resid_len, &map_len, get_udatamodel())) != 0) {
free_devmap_handle(dhp_head);
return (ENXIO);
}
if (map_len & PAGEOFFSET) {
free_devmap_handle(dhp_head);
return (EINVAL);
}
Why does map_len have to be page-aligned? devmap(9E) doesn't mention
this (says it has to be <= the mmap() len), and the example there does
no alignment, too. Also, I tried and returned ptob(btopr((len)), but it
did not fix the problem (and violated the maplen <= len constraint - but
ptob(btop((len)) wouldn't make sense, either).
The problem must be somewhere else in the path. Can anyone give me a
pointer?
thanks, Joachim
--
Joachim Worringen, Software Architect, Dolphin Interconnect Solutions
phone ++49/(0)228/324 08 17 - http://www.dolphinics.com
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code