diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2009-10-23 09:59:45 +0100 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2009-10-23 09:59:45 +0100 |
commit | bee72b5893bfbffed54a1b3db46a99f4cb95f040 (patch) | |
tree | 3f4df0b09759595e07f6b616975d09e8367de9c4 /extras | |
parent | 05ec439680ec0c24900fd1515fee293752f69ee8 (diff) | |
download | xen-bee72b5893bfbffed54a1b3db46a99f4cb95f040.tar.gz xen-bee72b5893bfbffed54a1b3db46a99f4cb95f040.tar.bz2 xen-bee72b5893bfbffed54a1b3db46a99f4cb95f040.zip |
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>
Diffstat (limited to 'extras')
-rw-r--r-- | extras/mini-os/lib/sys.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/extras/mini-os/lib/sys.c b/extras/mini-os/lib/sys.c index 1284f5a714..6e12be0f4a 100644 --- a/extras/mini-os/lib/sys.c +++ b/extras/mini-os/lib/sys.c @@ -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); } |