Thread (5 messages) 5 messages, 3 authors, 2012-06-22

explanation of __va() and __pa() macros.

From: Vlad Dogaru <hidden>
Date: 2012-06-22 12:06:26

On Fri, Jun 22, 2012 at 2:49 PM, AFT [off-list ref] 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help