I know that if page is not in main memory, CPU will bring it from swap file. So if a virtual address does not have its physical address counterpart in place, CPU will bring it from disk. So mapping to virtual address can be in one of two places: its either in physical memory or in disk. My question is where does virtual address itself reside? Because CPU needs this virtual address in order to perform the mapping. Where does CPU get this address? and when we use gdb to look at virtual address space, where does gdb take all this virutal adresses?
For ex:
Virtual address 0x420000
Page Table 20
RAM 0x800000
Here 20 (Page table entry) resides in RAM. 0x800000 (physical address) resides in RAM. Where does 0x420000 information reside? CPU needs this information from somewhere, otherwise how it would perform address translation?
now I think I know hwere virtual address information comes from. It is come from application program itself from pc counter at which point it passes it to CPU and then CPU does the translation.