Before we delve into the details of the new code that you'll be
working with, you should probably undo the test cases from project 1.
-All you need to do is make sure the original @file{threads/test.c} is
-in place. This will stop the tests from being run.
@menu
* Project 2 Code::
task switching. Pintos uses the TSS only for switching stacks when a
user process enters an interrupt handler, as does Linux. @strong{You
should not need to modify these files for any of the projects.}
-However, you can read the code if you're interested in how the GDT
+However, you can read the code if you're interested in how the TSS
works.
@end table
You need to be able to create and format simulated disks. The
@command{pintos} program provides this functionality with its
-@option{make-disk} command. From the @file{filesys/build} directory,
+@option{make-disk} command. From the @file{userprog/build} directory,
execute @code{pintos make-disk fs.dsk 2}. This command creates a 2 MB
simulated disk named @file{fs.dsk}. (It does not actually start
Pintos.) Then format the disk by passing the @option{-f} option to
@table @code
@item SYS_halt
@itemx void halt (void)
-Stops Pintos and prints out performance statistics. Note that this
-should be seldom used, since then you lose some information about
-possible deadlock situations, etc.
+Stops Pintos by calling @func{power_off} (declared in
+@file{threads/init.h}). Note that this should be seldom used, since
+then you lose some information about possible deadlock situations,
+etc.
@item SYS_exit
@itemx void exit (int @var{status})
be disrupted).
@item SYS_create
-@itemx bool create (const char *@var{file})
-Create a new file called @var{file}. Returns -1 if failed, 0 if OK.
+@itemx bool create (const char *@var{file}, unsigned @var{initial_size})
+Create a new file called @var{file} initially @var{initial_size} bytes
+in size. Returns -1 if failed, 0 if OK.
@item SYS_remove
@itemx bool remove (const char *@var{file})
implementing the join syscall, but besides that, you can use
the original code provided for project 1.
+@item
+@b{All my user programs die with page faults.}
+
+This will generally happen if you haven't implemented problem 2-1
+yet. The reason is that the basic C library for user programs tries
+to read @var{argc} and @var{argv} off the stack. Because the stack
+isn't properly set up yet, this causes a page fault.
+
@item
@b{Is there a way I can disassemble user programs?}
free.
@item
-@b{How do I compile new user programs? How do I make 'echo' compile?}
+@b{How do I compile new user programs?}
You need to modify @file{tests/Makefile}.
@item @t{0xbfffffe0} @tab @code{argv[2]} @tab @t{0xbffffff8}
@item @t{0xbfffffdc} @tab @code{argv[1]} @tab @t{0xbffffff5}
@item @t{0xbfffffd8} @tab @code{argv[0]} @tab @t{0xbfffffed}
-@item @t{0xbfffffd4} @tab @code{argv} @tab @t{0xbffffffd8}
+@item @t{0xbfffffd4} @tab @code{argv} @tab @t{0xbfffffd8}
@item @t{0xbfffffd0} @tab @code{argc} @tab 4
@item @t{0xbfffffcc} @tab ``return address'' @tab 0
@end multitable
@html
<CENTER>
@end html
-@multitable {Address} {Value}
+@multitable {@t{0xbffffe7c}} {Value}
@item Address @tab Value
@item @t{0xbffffe7c} @tab 3
@item @t{0xbffffe78} @tab 2