The lock functions don't really need to disable interrupts themselves,
[pintos-anon] / solutions / p2.patch
index e1d72745b617dd3186bcfa4772d9f08bb67271f3..9022ac98b9eebaced38d2e77e4dfa40a1efcf8dd 100644 (file)
@@ -313,14 +313,14 @@ diff -u src/userprog/process.c~ src/userprog/process.c
       to the kernel-only page directory. */
    pd = cur->pagedir;
 @@ -193,7 +284,7 @@ struct Elf32_Phdr
+ #define PF_W 2          /* Writable. */
  #define PF_R 4          /* Readable. */
  
- static bool load_segment (struct file *, const struct Elf32_Phdr *);
 -static bool setup_stack (void **esp);
 +static bool setup_stack (const char *cmd_line, void **esp);
- /* Loads an ELF executable from FILENAME into the current thread.
-    Stores the executable's entry point into *EIP
+ static bool validate_segment (const struct Elf32_Phdr *, struct file *);
+ static bool load_segment (struct file *file, off_t ofs, uint8_t *upage,
+                           bool writable);
 @@ -209,13 +300,15 @@ static bool setup_stack (void **esp);
     and its initial stack pointer into *ESP.
     Returns true if successful, false otherwise. */
@@ -479,11 +479,11 @@ diff -u src/userprog/process.c~ src/userprog/process.c
    kpage = palloc_get_page (PAL_USER | PAL_ZERO);
    if (kpage != NULL) 
      {
--      success = install_page (((uint8_t *) PHYS_BASE) - PGSIZE, kpage);
+-      success = install_page (((uint8_t *) PHYS_BASE) - PGSIZE, kpage, true);
 -      if (success)
 -        *esp = PHYS_BASE;
 +      uint8_t *upage = ((uint8_t *) PHYS_BASE) - PGSIZE;
-+      if (install_page (upage, kpage))
++      if (install_page (upage, kpage, true))
 +        success = init_cmd_line (kpage, upage, cmd_line, esp);
        else
          palloc_free_page (kpage);