feat: initial shared file page management and initialization
This commit is contained in:
@@ -292,6 +292,7 @@ fetch_page (void *upage, bool write)
|
||||
switch (page->type) {
|
||||
case PAGE_MMAP:
|
||||
case PAGE_FILE:
|
||||
case PAGE_SHARED:
|
||||
success = page_load_file (page);
|
||||
if (success && page->type == PAGE_FILE)
|
||||
{
|
||||
|
||||
@@ -2,9 +2,12 @@
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include "devices/swap.h"
|
||||
#include "threads/init.h"
|
||||
#include "threads/pte.h"
|
||||
#include "threads/palloc.h"
|
||||
#include "vm/frame.h"
|
||||
#include "vm/page.h"
|
||||
|
||||
static uint32_t *active_pd (void);
|
||||
|
||||
@@ -39,8 +42,14 @@ pagedir_destroy (uint32_t *pd)
|
||||
uint32_t *pte;
|
||||
|
||||
for (pte = pt; pte < pt + PGSIZE / sizeof *pte; pte++)
|
||||
if (*pte & PTE_P)
|
||||
palloc_free_page (pte_get_page (*pte));
|
||||
{
|
||||
if (page_is_shared_pte (pte))
|
||||
continue;
|
||||
if (page_in_swap_pte (pte))
|
||||
swap_drop (page_get_swap_pte (pte));
|
||||
if (*pte & PTE_P)
|
||||
frame_free (pte_get_page (*pte));
|
||||
}
|
||||
palloc_free_page (pt);
|
||||
}
|
||||
palloc_free_page (pd);
|
||||
|
||||
Reference in New Issue
Block a user