Reputation: 649
How do I convert physical address to kernel page structure inside kernel module? (only for x86-64 arch).
following is what I have so far:
void *kernel_logical_address = phys_to_virt(physical_address);
Now, how do I get struct page
for this kernel_logical_address?
Why do I need it?
In the kernel module I am working on, it maintains a list of free pages
struct page *pages
I want to add this special page (the one points to physical_address) to this particular list. How do I do this?
Upvotes: 0
Views: 512
Reputation: 5285
No, you can't. there is no trivial way other than lock and traversal all mapped pages.
Because the same page may be mapped multiple time at different linear address or isn't mapped at all.
Upvotes: 1