linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: uclinux-dev@uclinux.org, David Howells <dhowells@redhat.com>,
	David McCullough <davidm@snapgear.com>,
	Greg Ungerer <gerg@uclinux.org>, Paul Mundt <lethal@linux-sh.org>
Cc: linux-kernel@vger.kernel.org, uclinux-dist-devel@blackfin.uclinux.org
Subject: [PATCH v2] NOMMU: implement vmap/vunmap with kmalloc
Date: Tue,  9 Mar 2010 11:11:21 -0500	[thread overview]
Message-ID: <1268151081-28307-1-git-send-email-vapier@gentoo.org> (raw)
In-Reply-To: <1261413866-30634-1-git-send-email-vapier@gentoo.org>

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
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


  parent reply	other threads:[~2010-03-09 16:08 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-06  4:25 userspace firmware loader, vmap, and nommu Mike Frysinger
2009-10-06  4:38 ` David Woodhouse
2009-10-06  4:56   ` Mike Frysinger
2009-12-21 16:44 ` [PATCH] nommu: implement vmap/vunmap with kmalloc Mike Frysinger
2010-01-07  6:49   ` [uClinux-dev] " Mike Frysinger
2010-03-09 16:11   ` Mike Frysinger [this message]
2010-03-31 17:11   ` [PATCH v2] NOMMU: " David Howells
2010-03-31 19:54     ` Mike Frysinger
2010-03-31 23:06     ` David Howells
2010-03-31 23:07     ` David Howells
2010-03-31 23:10       ` Mike Frysinger
2010-01-16 15:57 ` [PATCH] nommu: " David Howells

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1268151081-28307-1-git-send-email-vapier@gentoo.org \
    --to=vapier@gentoo.org \
    --cc=davidm@snapgear.com \
    --cc=dhowells@redhat.com \
    --cc=gerg@uclinux.org \
    --cc=lethal@linux-sh.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=uclinux-dev@uclinux.org \
    --cc=uclinux-dist-devel@blackfin.uclinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).