jos/lib/pageref.c

15 lines
192 B
C
Raw Normal View History

2018-10-24 17:44:45 -07:00
#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;
}