-@@ -309,6 +419,7 @@ load_segment (struct file *file, const s
- {
- void *start, *end; /* Page-rounded segment start and end. */
- uint8_t *upage; /* Iterator from start to end. */
-+ off_t file_offset; /* Offset into file. */
- off_t filesz_left; /* Bytes left of file data (as opposed to
- zero-initialized bytes). */
-
-@@ -316,7 +427,7 @@ load_segment (struct file *file, const s
- commented out. You'll want to use it when implementing VM
- to decide whether to page the segment from its executable or
- from swap. */
-- //bool read_only = (phdr->p_flags & PF_W) == 0;
-+ bool read_only = (phdr->p_flags & PF_W) == 0;
-
- ASSERT (file != NULL);
- ASSERT (phdr != NULL);
-@@ -360,69 +471,129 @@ load_segment (struct file *file, const s
- return false;
- }
+@@ -387,79 +497,127 @@ load_segment (struct file *file, off_t o
+ ASSERT (pg_ofs (upage) == 0);
+ ASSERT (ofs % PGSIZE == 0);