jos/lib/pageref.c
Anish Athalye c67463e23c Lab 5
2018-10-24 20:44:45 -04:00

15 lines
192 B
C

#include <inc/lib.h>
int
pageref(void *v)
{
pte_t pte;
if (!(uvpd[PDX(v)] & PTE_P))
return 0;
pte = uvpt[PGNUM(v)];
if (!(pte & PTE_P))
return 0;
return pages[PGNUM(pte)].pp_ref;
}