Comments.
authorBen Pfaff <blp@cs.stanford.edu>
Mon, 20 Sep 2004 19:06:58 +0000 (19:06 +0000)
committerBen Pfaff <blp@cs.stanford.edu>
Mon, 20 Sep 2004 19:06:58 +0000 (19:06 +0000)
src/threads/mmu.h
src/userprog/exception.c

index 2af85bc335848d445c7b283c01983374b10e7c15..4d4aa6ac3ced70add98f368abdf0ce6a6c26e1b3 100644 (file)
@@ -93,6 +93,16 @@ static inline void *pg_round_down (const void *va) {
   return (void *) ((uintptr_t) va & ~PGMASK);
 }
 
   return (void *) ((uintptr_t) va & ~PGMASK);
 }
 
+/* Base address of the 1:1 physical-to-virtual mapping.  Physical
+   memory is mapped starting at this virtual address.  Thus,
+   physical address 0 is accessible at PHYS_BASE, physical
+   address address 0x1234 at (uint8_t *) PHYS_BASE + 0x1234, and
+   so on.
+
+   This address also marks the end of user programs' address
+   space.  Up to this point in memory, user programs are allowed
+   to map whatever they like.  At this point and above, the
+   virtual address space belongs to the kernel. */
 #define        PHYS_BASE ((void *) LOADER_PHYS_BASE)
 
 /* Returns kernel virtual address at which physical address PADDR
 #define        PHYS_BASE ((void *) LOADER_PHYS_BASE)
 
 /* Returns kernel virtual address at which physical address PADDR
index dead766fdbde82b736394f1fc4c8ab92d371ff37..4f3e4f9d120efcef5ddecf1fb845956e0e44f40d 100644 (file)
@@ -101,7 +101,8 @@ kill (struct intr_frame *f)
 #define PF_U 0x4    /* 0: kernel, 1: user process. */
 
 /* Page fault handler.  This is a skeleton that must be filled in
 #define PF_U 0x4    /* 0: kernel, 1: user process. */
 
 /* Page fault handler.  This is a skeleton that must be filled in
-   to implement virtual memory.
+   to implement virtual memory.  Some solutions to project 2 may
+   also require modifying this code.
 
    At entry, the address that faulted is in CR2 (Control Register
    2) and information about the fault, formatted as described in
 
    At entry, the address that faulted is in CR2 (Control Register
    2) and information about the fault, formatted as described in