That give me some hints that this works only for kernel memory and not for user memory. But I am still confused. And 0x00000000-oxc000000 is for user and kernel while oxc0000000-oxffffffff is only for kernel. What format is the virtual address (logical address), is it in the format of SEG:OFFSET, or others? I am still unclear about the layout difference between kernel memory and user memory. Is kernel memory just flat address mode? How big of it, 4G? What I am thinking is that 4G is application address space, and first 3G is for both kernel and user and the left 1G is only reserved for kernel. And these two parts are divided by PAGE_OFFSET. So how can x-PAGE_OFFSET get physical address? Thanks very much Noah Yan On Mon, 8 Sep 2003, Kirk True wrote: > Hi, > > > What is __pa(x) function, it said that it translates logical address to > > physical address by x-PAGE_OFFSET, PAGE_OFFSET is normally something > > like 0xc0000000, how can this translate? What is x input? > > x is a virtual address. Virtual addresses are the physical addresses > plus PAGE_OFFSET. So to go *back* to a virtual address from a physical > address as the __pa macro does, you simply do the reverse operation and > subtract PAGE_OFFSET. > __pa(x) gives the physical address of the given virtual address - x. this works only for kernel memory and not for user memory. Raghu > That's my understanding, anyway. I'm a newbie too and it might not be > that simple. > > Kirk > > -- > Kernelnewbies: Help each other learn about the Linux kernel. > Archive: http://mail.nl.linux.org/kernelnewbies/ > FAQ: http://kernelnewbies.org/faq/ > -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/