I have a virtual address that lies in the kernel virtual address space i.e 3GB <= vaddr <= 4GB which I want to translate to a physical address.
Taking a look at the kernel source I can see virt_to_phys () function which in turn uses : __pa(x) ((unsigned long)(x) - VIRT_PHYS_OFFSET). So does this mean that any virtual address can be converted to a physical address by this equation ?
phys_addr = virt_addr - PAGE_OFFSET (where 3GB <= virt_addr <= 4GB) or does this address translation works for some different range of virt_addr.
Does this mean that if the address of the .text section of a dynamically loaded kernel module KMod 0xf23dc038, then the physical address at which the module symbols are available will be 0xf23dc038 - 0xc0000000 ?
If this is the case then what is the use of Kernel page tables ?
Thanks in advance.