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?
|