I am confused about the following comment:
/* Looks up the physical address that corresponds to user virtual
address UADDR in PD. Returns the kernel virtual address
corresponding to that physical address, or a null pointer if
UADDR is unmapped. */
I understand the first sentence which is to find the actual physical address, however, I don't understand why the kernel virtual address correspond to that address is returned. In short, since uaddr is a user virtual address, then why is it related to kernel virtual address?
void *
pagedir_get_page (uint32_t *pd, const void *uaddr)
{
uint32_t *pte;
ASSERT (is_user_vaddr (uaddr));
pte = lookup_page (pd, uaddr, false);
if (pte != NULL && (*pte & PTE_P) != 0)
return pte_get_page (*pte) + pg_ofs (uaddr);
else
return NULL;
}
Thanks in advance.