Ketan Mukadam <kmukadam@neomagic.com> writes: > Hi!! Hi. > > I am working on arm(926) linux(2.4). I have read the theory about > paging and PDTs etc... I also understand how a virtual address is > mapped on to a physical address. > > But when writing a device driver,i used a simple macro __va and __pa > which are used to convert the virtual to physical address or vice > versa. [these macros simply add or subtract PAGE_OFFSET to the > address] On some architectures, like i386. I don't know about arm. There's also virt_to_phys, which just uses __pa on i386. > I am unable to relate these macros with actual paging theory involving > the bit shifting and indexing into page tables..... > > Can any one clarify my doubts as to how these two things are related ?? To oversimplify a bit, the top gig of virtual memory is not used by any program in userland. It's used by the kernel and is basically a simple mapping to the first gig of physical memory. There is a thread in google about this, with more details and a diagram: http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&safe=off&selm=87r82q551t.fsf%40uga.edu&rnum=5 http://snipurl.com/71fy [same link but shorter] -- --Ed L Cashin | PGP public key: ecashin@uga.edu | http://noserose.net/e/pgp/ -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/