Update Exception To Debug Shared files, w/ G
This commit is contained in:
@@ -176,24 +176,29 @@ try_fetch_page (void *upage, bool write)
|
|||||||
/* Check if the page is in the supplemental page table. That is, it is a page
|
/* Check if the page is in the supplemental page table. That is, it is a page
|
||||||
that is expected to be in memory. */
|
that is expected to be in memory. */
|
||||||
struct page_entry *page = page_get (upage);
|
struct page_entry *page = page_get (upage);
|
||||||
|
printf ("Hiiii 1!\n");
|
||||||
if (page == NULL)
|
if (page == NULL)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
printf ("Hiiii 2!\n");
|
||||||
/* An attempt to write to a non-writeable should fail. */
|
/* An attempt to write to a non-writeable should fail. */
|
||||||
if (write && !page->writable)
|
if (write && !page->writable)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
printf ("FUCK PINTOS!\n");
|
||||||
|
|
||||||
/* Load the page into memory based on the type of data it is expecting. */
|
/* Load the page into memory based on the type of data it is expecting. */
|
||||||
bool success = false;
|
bool success = false;
|
||||||
switch (page->type) {
|
switch (page->type) {
|
||||||
case PAGE_EXECUTABLE:
|
case PAGE_EXECUTABLE:
|
||||||
success = page_load (page, page->writable);
|
success = page_load (page, write);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
printf ("what the heck\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (success && page->writable &&
|
if (success && write &&
|
||||||
!pagedir_is_writable(thread_current()->pagedir, upage))
|
!pagedir_is_writable(thread_current()->pagedir, upage))
|
||||||
pagedir_set_writable(thread_current()->pagedir, upage, true);
|
pagedir_set_writable(thread_current()->pagedir, upage, true);
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#include "page.h"
|
#include "page.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
#include "filesys/file.h"
|
#include "filesys/file.h"
|
||||||
#include "threads/malloc.h"
|
#include "threads/malloc.h"
|
||||||
#include "threads/palloc.h"
|
#include "threads/palloc.h"
|
||||||
@@ -76,20 +77,23 @@ page_get (void *upage)
|
|||||||
bool
|
bool
|
||||||
page_load (struct page_entry *page, bool writable)
|
page_load (struct page_entry *page, bool writable)
|
||||||
{
|
{
|
||||||
|
printf ("WE IN PAGE LOAD NOW %p %d\n", page->file, page->offset);
|
||||||
/* If the page is read-only, we want to check if it is a shared page already
|
/* If the page is read-only, we want to check if it is a shared page already
|
||||||
loaded into memory. If it is, we can just map the page to the frame. */
|
loaded into memory. If it is, we can just map the page to the frame. */
|
||||||
if (!page->writable)
|
if (!page->writable && !writable)
|
||||||
{
|
{
|
||||||
ASSERT (page->read_bytes == PGSIZE);
|
printf ("Hi 0! %d %d\n", page->offset, file_length (page->file));
|
||||||
|
|
||||||
struct shared_page_entry *shared_page =
|
struct shared_page_entry *shared_page =
|
||||||
shared_page_get (page->file, page->upage);
|
shared_page_get (page->file, page->upage);
|
||||||
|
|
||||||
if (shared_page != NULL)
|
if (shared_page != NULL)
|
||||||
{
|
{
|
||||||
|
printf ("Hi 0.1!\n");
|
||||||
/* Map the page to the shared frame for this read-only portion. */
|
/* Map the page to the shared frame for this read-only portion. */
|
||||||
if (!install_page (page->upage, shared_page->frame, false))
|
if (!install_page (page->upage, shared_page->frame, false))
|
||||||
return false;
|
return false;
|
||||||
|
printf ("Hi 0.2!\n");
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,9 +108,11 @@ page_load (struct page_entry *page, bool writable)
|
|||||||
if (!install_page (page->upage, frame, page->writable))
|
if (!install_page (page->upage, frame, page->writable))
|
||||||
{
|
{
|
||||||
frame_free (frame);
|
frame_free (frame);
|
||||||
|
printf ("Hi 2!\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printf ("UR MAMA SO FAT");
|
||||||
/* Move the file pointer to the correct location in the file. Then, read the
|
/* Move the file pointer to the correct location in the file. Then, read the
|
||||||
data from the file into the frame. Checks that we were able to read the
|
data from the file into the frame. Checks that we were able to read the
|
||||||
expected number of bytes. */
|
expected number of bytes. */
|
||||||
@@ -114,6 +120,7 @@ page_load (struct page_entry *page, bool writable)
|
|||||||
if (file_read (page->file, frame, page->read_bytes) != (int) page->read_bytes)
|
if (file_read (page->file, frame, page->read_bytes) != (int) page->read_bytes)
|
||||||
{
|
{
|
||||||
frame_free (frame);
|
frame_free (frame);
|
||||||
|
printf ("Hi 3!\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,6 +133,7 @@ page_load (struct page_entry *page, bool writable)
|
|||||||
if (shared_page_insert (page->file, page->upage, frame) == NULL)
|
if (shared_page_insert (page->file, page->upage, frame) == NULL)
|
||||||
{
|
{
|
||||||
frame_free (frame);
|
frame_free (frame);
|
||||||
|
printf ("Hi 4!\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user