Compare commits

...

7 Commits

Author SHA1 Message Date
Saleh Bubshait
ad4eda5385 Merge branch 'vm/syscall-mmap/styling' into 'master'
Refactor page to follow pintos styling for indentation and add spacing for readability

See merge request lab2425_autumn/pintos_22!69
2024-12-06 18:37:18 +00:00
sBubshait
8d1b4c4994 Refactor page to follow pintos styling for indentation and add spacing for readability 2024-12-06 18:36:54 +00:00
Saleh Bubshait
07c0219058 Merge branch 'vm/syscall-mmap/styling' into 'master'
Refactor frame to add spacing and exception for indentation to follow pintos styling

See merge request lab2425_autumn/pintos_22!68
2024-12-06 18:28:39 +00:00
sBubshait
5fbabdcec9 Refactor frame to add spacing and exception for indentation to follow pintos styling 2024-12-06 18:27:50 +00:00
Saleh Bubshait
5e8bdc68e7 Merge branch 'vm/syscall-mmap/styling' into 'master'
Refactor mmap system call code to follow pintos style in indentation

See merge request lab2425_autumn/pintos_22!67
2024-12-06 18:15:47 +00:00
sBubshait
d039b59b7c Refactor mmap system call code to follow pintos style in indentation 2024-12-06 18:14:47 +00:00
Saleh Bubshait
29c0b93711 Merge branch 'vm/pagedir-spt-synch' into 'master'
fix: synchronise threads' SPTs with locks

See merge request lab2425_autumn/pintos_22!66
2024-12-06 17:44:33 +00:00
4 changed files with 36 additions and 29 deletions

View File

@@ -241,6 +241,7 @@ frame_owner_insert (void *frame, struct thread *owner)
struct frame_owner *frame_owner = malloc (sizeof (struct frame_owner));
if (frame_owner == NULL)
return false;
frame_owner->owner = owner;
list_push_back (&frame_metadata->owners, &frame_owner->elem);
return true;
@@ -263,6 +264,7 @@ frame_owner_remove (void *frame, struct thread *owner)
{
struct frame_owner *frame_owner
= list_entry (oe, struct frame_owner, elem);
oe = list_next (oe);
if (frame_owner->owner == owner)
{
@@ -284,6 +286,7 @@ frame_metadata_find (void *frame)
struct hash_elem *e = hash_find (&frame_table, &key_metadata.hash_elem);
if (e == NULL)
return NULL;
return hash_entry (e, struct frame_metadata, hash_elem);
}

View File

@@ -87,6 +87,7 @@ mmap_unmap (struct mmap_entry *mmap)
hash_delete (&thread_current ()->pages, &page->elem);
}
/* Close the file and free the mmap entry. */
file_close (mmap->file);
free (mmap);
}

View File

@@ -195,6 +195,7 @@ page_load_file (struct page_entry *page)
lock_acquire (&shared_file_pages_lock);
struct shared_file_page *sfp
= shared_file_page_get (page->file, page->upage);
if (sfp != NULL)
{
/* Frame exists, just install it. */
@@ -207,7 +208,8 @@ page_load_file (struct page_entry *page)
}
frame_owner_insert (sfp->frame, t);
}
/* Shared page is in swap. Load it. */
/* Otherwise, shared page is in swap. Load it. */
else
{
void *frame = frame_alloc (PAL_USER, page->upage, t);
@@ -223,6 +225,7 @@ page_load_file (struct page_entry *page)
return false;
}
}
page_flag_shared (t, page->upage, true);
if (page->type != PAGE_SHARED)
{