PERFORCE change 156012 for review
Nathan Whitehorn
nwhitehorn at FreeBSD.org
Mon Jan 12 07:57:19 PST 2009
http://perforce.freebsd.org/chv.cgi?CH=156012
Change 156012 by nwhitehorn at nwhitehorn_trantor on 2009/01/12 15:56:33
First crack at making /dev/mem work on systems without a direct map.
This is currently broken if you try to dd multiple consecutive pages,
but reading at a random offset does work, which is enough to make
X11 work on my iMac G5.
Affected files ...
.. //depot/projects/ppc-g5/sys/powerpc/powerpc/mem.c#3 edit
Differences ...
==== //depot/projects/ppc-g5/sys/powerpc/powerpc/mem.c#3 (text+ko) ====
@@ -64,6 +64,7 @@
#include <vm/vm.h>
#include <vm/pmap.h>
#include <vm/vm_extern.h>
+#include <vm/vm_page.h>
#include <machine/memdev.h>
@@ -77,6 +78,8 @@
int error = 0;
vm_offset_t va, eva, off, v;
vm_prot_t prot;
+ struct vm_page m;
+ vm_page_t marr;
vm_size_t cnt;
cnt = 0;
@@ -102,14 +105,18 @@
cnt = min(cnt, PAGE_SIZE - off);
cnt = min(cnt, iov->iov_len);
- if (mem_valid(v, cnt)
- && pmap_dev_direct_mapped(v, cnt)) {
+ if (mem_valid(v, cnt)) {
error = EFAULT;
break;
}
-
- uiomove((void *)v, cnt, uio);
- break;
+
+ if (!pmap_dev_direct_mapped(v, cnt)) {
+ error = uiomove((void *)v, cnt, uio);
+ } else {
+ m.phys_addr = trunc_page(v);
+ marr = &m;
+ error = uiomove_fromphys(&marr, off, cnt, uio);
+ }
}
else if (dev2unit(dev) == CDEV_MINOR_KMEM) {
va = uio->uio_offset;
More information about the p4-projects
mailing list