nits
This commit is contained in:
parent
3bee885ed7
commit
c5163e4a42
1 changed files with 15 additions and 17 deletions
|
@ -287,7 +287,7 @@ use only one CPU, which you can do by running
|
||||||
are passing test0(), and should proceed to the next section.
|
are passing test0(), and should proceed to the next section.
|
||||||
do they need to make sure at this point that they see multiple
|
do they need to make sure at this point that they see multiple
|
||||||
alarm! printouts? or is it OK if they see one alarm! and
|
alarm! printouts? or is it OK if they see one alarm! and
|
||||||
then a crash?</b>
|
then a crash? may need to fix the sample ...alarm! output shown above</b>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
@ -301,35 +301,33 @@ about it, and hint or say why they are not done even though
|
||||||
test0() works.</b>
|
test0() works.</b>
|
||||||
|
|
||||||
<p>Test0 doesn't test whether the handler returns correctly to
|
<p>Test0 doesn't test whether the handler returns correctly to
|
||||||
the interrupted instruction. If you didn't get this right, it
|
the user instruction that was interrupted by the timer.
|
||||||
is likely that test1 will fail (the program crashes or the program
|
The previous section didn't require you to get this right.
|
||||||
|
If you didn't, test0 will probably succeed anyway, but
|
||||||
|
test1 will likely fail (the program crashes or the program
|
||||||
goes into an infinite loop).
|
goes into an infinite loop).
|
||||||
|
Another challenge is that the register contents need to be
|
||||||
<p>A main challenge is to arrange that when the handler returns, it
|
correct when control returns to the interrupted user instruction.
|
||||||
returns to the instruction where the program was interrupted. Which
|
|
||||||
register contains the return address of a function? When the kernel
|
|
||||||
receives an interrupt, which register contains the address of the
|
|
||||||
interrupted instruction?
|
|
||||||
|
|
||||||
<p>Your solution is likely to require you to save and restore
|
<p>Your solution is likely to require you to save and restore
|
||||||
registers---what registers do you need to save and restore to resume
|
registers---what registers do you need to save and restore to resume
|
||||||
the interrupted code correctly? (Hint: it will be many). There are
|
the interrupted code correctly? (Hint: it will be many). There are
|
||||||
several ways to do this, but one convenient way is to add another
|
several ways to restore the registers; one convenient plan is to add another
|
||||||
system call <tt>sigreturn</tt> that the handler calls when it is
|
system call <tt>sigreturn</tt> that the handler calls when it is
|
||||||
done. Your job is to arrange that <tt>sigreturn</tt> returns to the
|
done, and which restores registers and returns to the original
|
||||||
interrupted code.
|
interrupted user instruction.
|
||||||
|
|
||||||
Some hints:
|
Some hints:
|
||||||
<ul>
|
<ul>
|
||||||
<li>Add the <tt>sigreturn</tt> system call, following the changes
|
<li>Add a new <tt>sigreturn</tt> system call.
|
||||||
you made to support <tt>sigalarm</tt>.
|
|
||||||
|
|
||||||
<li>Save enough state when the timer goes in the <tt>struct
|
<li>Have <tt>usertrap</tt> save enough state in
|
||||||
proc</tt> so that <tt>sigreturn</tt> can return to the
|
<tt>struct proc</tt> when the timer goes off
|
||||||
|
that <tt>sigreturn</tt> can correctly return to the
|
||||||
interrupted code.
|
interrupted code.
|
||||||
|
|
||||||
<li>Prevent re-entrant calls to the handler----if a handler hasn't
|
<li>Prevent re-entrant calls to the handler----if a handler hasn't
|
||||||
returned yet, don't call it again.
|
returned yet, the kernel shouldn't call it again.
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<p>Once you pass <tt>test0</tt> and <tt>test1</tt>, run usertests to
|
<p>Once you pass <tt>test0</tt> and <tt>test1</tt>, run usertests to
|
||||||
|
|
Loading…
Reference in a new issue