diff options
Diffstat (limited to 'vm/page.c')
| -rw-r--r-- | vm/page.c | 6 |
1 files changed, 4 insertions, 2 deletions
| @@ -1,10 +1,11 @@ | |||
| 1 | #include <string.h> | 1 | #include <string.h> |
| 2 | #include "filesys/file.h" | 2 | #include "filesys/file.h" |
| 3 | #include "userprog/process.h" | ||
| 4 | #include "threads/thread.h" | 3 | #include "threads/thread.h" |
| 5 | #include "threads/vaddr.h" | 4 | #include "threads/vaddr.h" |
| 6 | #include "threads/malloc.h" | 5 | #include "threads/malloc.h" |
| 7 | #include "threads/palloc.h" | 6 | #include "threads/palloc.h" |
| 7 | #include "userprog/pagedir.h" | ||
| 8 | #include "userprog/process.h" | ||
| 8 | #include "vm/page.h" | 9 | #include "vm/page.h" |
| 9 | 10 | ||
| 10 | static unsigned page_table_hash (const struct hash_elem *e, void *aux UNUSED); | 11 | static unsigned page_table_hash (const struct hash_elem *e, void *aux UNUSED); |
| @@ -52,6 +53,7 @@ static void | |||
| 52 | page_table_entry_free (struct hash_elem *e, void *aux UNUSED) | 53 | page_table_entry_free (struct hash_elem *e, void *aux UNUSED) |
| 53 | { | 54 | { |
| 54 | struct page_table_entry *pte = hash_entry (e, struct page_table_entry, elem); | 55 | struct page_table_entry *pte = hash_entry (e, struct page_table_entry, elem); |
| 56 | pagedir_clear_page (thread_current ()->pagedir, pte->upage); | ||
| 55 | free (pte); | 57 | free (pte); |
| 56 | } | 58 | } |
| 57 | 59 | ||
| @@ -97,7 +99,7 @@ page_table_fetch (struct hash *ht, void *upage) | |||
| 97 | } | 99 | } |
| 98 | 100 | ||
| 99 | /* remove an entry from the page table. returns the element or NULL if not found. | 101 | /* remove an entry from the page table. returns the element or NULL if not found. |
| 100 | the caller is responsible for freeing the element! */ | 102 | the caller is responsible for freeing the element and the associated page! */ |
| 101 | struct page_table_entry * | 103 | struct page_table_entry * |
| 102 | page_table_remove (struct hash *ht, void *upage) | 104 | page_table_remove (struct hash *ht, void *upage) |
| 103 | { | 105 | { |
