Is there any suitable way to get the physical address by the logical one except to walk through page directory entries by hand? I’ve looked for this functionality in kernel’s sources and found that there is a follow_page function that do it well with built-in huge and transparent-huge pages support. But it’s not exported to kernel modules (why???)…
So, I don’t want to invent the wheel and I think that it’s not very good to reimplement the follow_page functionality by hand.
Well, it might looks as something like that (follow PTE from an virtual address):