kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: aftnix@gmail.com (AFT)
To: kernelnewbies@lists.kernelnewbies.org
Subject: explanation of __va() and __pa() macros.
Date: Fri, 22 Jun 2012 20:38:57 +0600	[thread overview]
Message-ID: <r4t7fm2m.fsf@s1.test.com> (raw)
In-Reply-To: <CAA+rx9QDxMVScuS-ziQxg=aGksPrGOeFz=rZ+B-L6f1WOcnaXQ@mail.gmail.com> (Vlad Dogaru's message of "Fri, 22 Jun 2012 15:06:26 +0300")

Vlad Dogaru <ddvlad@rosedu.org> writes:

> On Fri, Jun 22, 2012 at 2:49 PM, AFT <aftnix@gmail.com> wrote:
>>
>> Hi,
>>
>> My source is from 2.6 git tree. In LDD3 its said that a logical address
>> is mapped to physical address and vice versa by the macros __va() and
>> __pa().
>>
>> In my source tree they are defined as follows:
>>
>> <include/asm-generic/page.h>
>>
>> #define __va(x) ((void *)((unsigned long) (x)))
>> #define __pa(x) ((unsigned long) (x))
>>
>>
>> I'm not actually understanding how these "cute" looking casting is
>> performing "address mapping". I thought address mapping involves more
>> complex operations.
>
> See the comments at the beginning of the file you quoted:
>
> /*
>  * Generic page.h implementation, for NOMMU architectures.
>  * This provides the dummy definitions for the memory management.
>  */
>
> For arch-specific code try looking, for instance, at
> arch/x86/include/asm/page.h .
>
> Hope this helps,
> Vlad
Hi Vlad,

Thanks for the explanation. I should lookout for embedded comments with
more attention from now.

cheers.
aft

  reply	other threads:[~2012-06-22 14:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-22 11:49 explanation of __va() and __pa() macros AFT
2012-06-22 12:06 ` Vlad Dogaru
2012-06-22 14:38   ` AFT [this message]
2012-06-22 12:12 ` Bjørn Mork
2012-06-22 14:45   ` AFT

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=r4t7fm2m.fsf@s1.test.com \
    --to=aftnix@gmail.com \
    --cc=kernelnewbies@lists.kernelnewbies.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).