minios: Optimize mmap(open("/dev/mem"))

Set map_frames_ex's stride parameter to 0 and increment to 1 to avoid
building an explicit list of mfns.

Signed-Off-By: Samuel Thibault <samuel.thibault@ens-lyon.org>
This commit is contained in:
Keir Fraser committed 2009-10-23 09:59:45 +01:00
1 parent 05ec439680
commit bee72b5893
1 file changed
+2 -5
+2 -5
View File
@@ -1256,11 +1256,8 @@ void *mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset
unsigned long zero = 0;
return map_frames_ex(&zero, n, 0, 0, 1, DOMID_SELF, 0, 0);
} else if (files[fd].type == FTYPE_MEM) {
int i;
unsigned long mfns[n];
for (i = 0; i < n; i++)
mfns[i] = ((unsigned long) offset + (i * PAGE_SIZE)) >> PAGE_SHIFT;
return map_frames_ex(mfns, n, 1, 0, 1, DOMID_IO, 0, _PAGE_PRESENT|_PAGE_RW);
unsigned long first_mfn = offset >> PAGE_SHIFT;
return map_frames_ex(&first_mfn, n, 0, 1, 1, DOMID_IO, 0, _PAGE_PRESENT|_PAGE_RW);
} else ASSERT(0);
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.