corrected wrong statement about content of f->esp when page fault
[pintos-anon] / doc / vm.texi
index 2376aa1392ef73521a04ec79789aac75dc37bd2c..3210bbcc83dd021a16f48ad78f7a9284ead20f21 100644 (file)
@@ -313,10 +313,12 @@ implementation, be sure to retain the distinction between the two pools.
 
 The most important operation on the frame table is obtaining an unused
 frame.  This is easy when a frame is free.  When none is free, a frame
-must be made free by evicting some page from its frame.  If no frame can
-be evicted without allocating a swap slot, but swap is full, some
-process must be killed to free memory (the choice of process to kill is
-up to you).
+must be made free by evicting some page from its frame.
+
+If no frame can be evicted without allocating a swap slot, but swap is
+full, panic the kernel.  Real OSes apply a wide range of policies to
+recover from or prevent such situations, but these policies are beyond
+the scope of this project.
 
 The process of eviction comprises roughly the following steps:
 
@@ -580,11 +582,13 @@ by a user program, you can retrieve it from @code{esp} member of the
 accessing them (@pxref{Accessing User Memory}), these are the only cases
 you need to handle.  On the other hand, if you depend on page faults to
 detect invalid memory access, you will need to handle another case,
-where a page fault occurs in the kernel.  Reading @code{esp} out of the
-@struct{intr_frame} passed to @func{page_fault} in that case will obtain
-the kernel stack pointer, not the user stack pointer.  You will need to
-arrange another way, e.g.@: by saving @code{esp} into @struct{thread} on
-the initial transition from user to kernel mode.
+where a page fault occurs in the kernel.  Since the processor only 
+saves the stack pointer when an exception causes a switch from user
+to kernel mode, reading @code{esp} out of the @struct{intr_frame} 
+passed to @func{page_fault} would yield an undefined value, not the 
+user stack pointer.  You will need to arrange another way, such as 
+saving @code{esp} into @struct{thread} on the initial transition 
+from user to kernel mode.
 
 You may impose some absolute limit on stack size, as do most OSes.
 Some OSes make the limit user-adjustable, e.g.@: with the