vm.c
//PAGEBREAK!
// Map user virtual address to kernel address.
PAGEBREAK.
Map user virtual address to kernel address.
PAGEBREAK . Map user virtual address to kernel address .
char*
uva2ka(pde_t *pgdir, char *uva)
{
  pte_t *pte;
  pte = walkpgdir(pgdir, uva, 0);
  if((*pte & PTE_P) == 0)
    return 0;
  if((*pte & PTE_U) == 0)
    return 0;
  return (char*)p2v(PTE_ADDR(*pte));
}
char * uva2ka ( pde_t * pgdir , char * uva ) { pte_t * pte ; pte = walkpgdir ( pgdir , uva , 0 ) ; if ( ( * pte & PTE_P ) == 0 ) return 0 ; if ( ( * pte & PTE_U ) == 0 ) return 0 ; return ( char * ) p2v ( PTE_ADDR ( * pte ) ) ; }
PAGEBREAK!
PAGEBREAK!