From c2e63e6e7f14d2ce25791aeff2ef592a4cd51663 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Wed, 20 Oct 2004 06:12:36 +0000 Subject: [PATCH] Fix bug in pagedir_get_page(): didn't apply uaddr page offset to kaddr return value (!) --- src/userprog/pagedir.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/userprog/pagedir.c b/src/userprog/pagedir.c index fa8f244..937f433 100644 --- a/src/userprog/pagedir.c +++ b/src/userprog/pagedir.c @@ -121,7 +121,9 @@ void * pagedir_get_page (uint32_t *pd, const void *uaddr) { uint32_t *pte = lookup_page (pd, (void *) uaddr, false); - return pte != NULL && *pte != 0 ? pte_get_page (*pte) : NULL; + return (pte != NULL && *pte != 0 + ? (uint8_t *) pte_get_page (*pte) + pg_ofs (uaddr) + : NULL); } /* Clears any mapping for user virtual address UPAGE in page -- 2.30.2