mirror of
https://github.com/SmallPond/MIT6.828_OS.git
synced 2026-05-03 09:50:32 +08:00
my solution to lab5
This commit is contained in:
14
lab/lib/pageref.c
Normal file
14
lab/lib/pageref.c
Normal file
@@ -0,0 +1,14 @@
|
||||
#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;
|
||||
}
|
||||
Reference in New Issue
Block a user