x86 64 - vmalloc_to_pfn returns 32 bit address on Linux 32 system. Why does it chop off higher bits of PAE physical address? -


I'm using vmalloc_to_pfn () to get a physical address on 32-bit PAE Linux I'm the system It seems that vmalloc_to_pfn () returns a "unsigned long" which means that it is 32 bit system on 64 bit 64-bit system on 32-bit systems, 64-bit Linux is unsigned long 64 bit and I have there is no problem.

Problem: Use this function to convert virtual to physical:

VA: 0xf8ab87fc using vmalloc_to_pfn: 0x36f7f7fc < / Strong>. But I really expect: 0x136f7f7fc .

The physical address is between 4 and 5 GB, but I can not find the exact physical address, I only have 32-bit addresses cut off. What is another way to get a real physical address?

I'm reading myself, and am 32 bit - so it's absolutely There is no answer. But digging through the same stuff, I can see the source for vmalloc_to_pfn :

  / * * map vmalloc () - the location for the physical page frame Virtual address number * / Unsigned long vmalloc_to_pfn (cost watched * vmalloc_addr) {return page_to_pfn (vmalloc_to_page (vmalloc_addr)); } EXPORT_SYMBOL (vmalloc_to_pfn);   

Therefore, it should not really return an address - it should return "Page Frame Number" (PFN). In relation to this:

Using the example given above, Y's virtual page frame number 1 is mapped to physical page frame number 4 which is 0x8000 ( 4 x 0x2000). Adding the 0x194 byte offset gives us the last physical address of 0x8194

So, to get a real address, you should multiply PFN by PAGE_SIZE - which makes you awkward again, how do you get "32 bit returns"> to work on "address on the Linux 32 system" (but again, I'm not an expert - PFN 32 Is the address equivalent to the bit?). Probably at least an example of a module in OP OP and output on both platforms, in order to compare.

In any case, I have seen what you have - physical address extension (PAE) can make a difference in paging; Apparently, the stored value of PFN in the Page Global Directorate (PGD) is architecture-specific, and is defined separately on its basis:

  typedef unsigned long pgdval_t; // arch / x86 / include / asm / pgtable-2level_types.h typedef u64 pgdval_t; // arch / x86 / include / asm / pgtable-3level_types.h typedef unsigned long pgdval_t; / Arch / x86 / include / asm / pgtable_64_types.h   

To summarize - not just the whole story in getting a physical address using vmalloc_to_pfn () is .

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -