[PATCH v2] NOMMU: implement vmap/vunmap with kmalloc
From: Mike Frysinger
Date: Tue Mar 09 2010 - 11:08:19 EST
Signed-off-by: Mike Frysinger <vapier@xxxxxxxxxx>
---
v2
- fix up changelog
mm/nommu.c | 18 +++++++++++++++---
1 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/mm/nommu.c b/mm/nommu.c
index b9b5cce..61a68d5 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -360,14 +360,26 @@ EXPORT_SYMBOL(vmalloc_32_user);
void *vmap(struct page **pages, unsigned int count, unsigned long flags, pgprot_t prot)
{
- BUG();
- return NULL;
+ unsigned int i;
+ void *new_map, *page_data;
+
+ new_map = kmalloc(count << PAGE_SHIFT, GFP_KERNEL);
+ if (!new_map)
+ return NULL;
+
+ for (i = 0; i < count; ++i) {
+ page_data = kmap(pages[i]);
+ memcpy(new_map + (i << PAGE_SHIFT), page_data, PAGE_SIZE);
+ kunmap(page_data);
+ }
+
+ return new_map;
}
EXPORT_SYMBOL(vmap);
void vunmap(const void *addr)
{
- BUG();
+ kfree(addr);
}
EXPORT_SYMBOL(vunmap);
--
1.7.0.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/