From: David Howells <dhowells@redhat.com>
To: Ravi Gupta <dceravigupta@gmail.com>
Cc: linuxppc-dev@lists.ozlabs.org
Subject: Re: Memory Mapping a char array in User Space
Date: Mon, 26 Jul 2010 20:42:01 +0100 [thread overview]
Message-ID: <918.1280173321@redhat.com> (raw)
In-Reply-To: <AANLkTikJJYRP=5yPQ8dG9ofXz3HvWzfQU2kt4PDui7EF@mail.gmail.com>
Ravi Gupta <dceravigupta@gmail.com> wrote:
> My device gets memory map successfully but when I tried to read from it
> I get garbage value. Is there something that I am missing?
For starters, you really should allocate a page for your buffer rather than
using kernel static data. mmap() allows access to page-aligned data through
multiple-of-page-sized holes only[*]. Not only that, your kernel static map
buffer may not necessarily have a struct page covering it, in which case
virt_to_page() may not give you anything useful.
Furthermore, I don't think *you* should be calling remap_pfn_range().
I think you should be leaving the mapping to the core VM routines.
David
[*] unless your kernel is CONFIG_MMU=n
next prev parent reply other threads:[~2010-07-26 19:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-26 17:28 Memory Mapping a char array in User Space Ravi Gupta
2010-07-26 19:42 ` David Howells [this message]
2010-07-27 7:04 ` Ravi Gupta
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=918.1280173321@redhat.com \
--to=dhowells@redhat.com \
--cc=dceravigupta@gmail.com \
--cc=linuxppc-dev@lists.ozlabs.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).