LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Physical address on a x86 64-bit machine (https://www.linuxquestions.org/questions/linux-newbie-8/physical-address-on-a-x86-64-bit-machine-914751/)

dudeatul 11-21-2011 02:14 PM

Physical address on a x86 64-bit machine
 
Hi All,

I have been trying to run through an exercise to open a filepointer for /dev/mem in user space and navigate over all of the mem_map entries (struct page entries). In order to get started on this, I wrote a kernel module to display start of memmap logical address and also its physical address. I used the functions pfn_to_page(0) to get the logical address and __pa(pfn_to_page(0)) to get its corresponding physical address.
The output of this kernel module is something like this
MemMapLogicalAddress=ffffea0000000000
MemMapPhysicalAddress=0000620000000000
NumPhysicalPage=524288
PageSize=4096
PageOffset=ffff880000000000

When I try to use mmap to map to the physical address above it works fine but when I try to read values from that map_base, my process gets killed and when I look into /var/log/messages there is a message that says bad PGD.

My question is why is physical address (0000620000000000) beyond 4gb, I have only 2GB memory but its a 64 bit machine. Am I missing something here?

Tinkster 11-22-2011 10:47 AM

Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread is being closed because it is a duplicate.

In this case closing the original in favour of the more sensibly placed dupe:
http://www.linuxquestions.org/questi...1/#post4530118


All times are GMT -5. The time now is 10:15 AM.