diff options
author | Robert Morris <[email protected]> | 2019-08-02 16:22:56 -0400 |
---|---|---|
committer | Robert Morris <[email protected]> | 2019-08-02 16:22:56 -0400 |
commit | c5163e4a4244c5834971bd2b285205205439dbd3 (patch) | |
tree | 5564fbc8a6d0c52e48b62c8786e86f141f46c2a6 /labs | |
parent | 3bee885ed7b5d39341a24a7d64959f54ddf45bab (diff) | |
download | xv6-labs-c5163e4a4244c5834971bd2b285205205439dbd3.tar.gz xv6-labs-c5163e4a4244c5834971bd2b285205205439dbd3.tar.bz2 xv6-labs-c5163e4a4244c5834971bd2b285205205439dbd3.zip |
nits
Diffstat (limited to 'labs')
-rw-r--r-- | labs/syscall.html | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/labs/syscall.html b/labs/syscall.html index 26cb573..835e510 100644 --- a/labs/syscall.html +++ b/labs/syscall.html @@ -287,7 +287,7 @@ use only one CPU, which you can do by running are passing test0(), and should proceed to the next section. 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 -then a crash?</b> +then a crash? may need to fix the sample ...alarm! output shown above</b> </ul> @@ -301,35 +301,33 @@ about it, and hint or say why they are not done even though test0() works.</b> <p>Test0 doesn't test whether the handler returns correctly to - the interrupted instruction. If you didn't get this right, it - is likely that test1 will fail (the program crashes or the program + the user instruction that was interrupted by the timer. + 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). - -<p>A main challenge is to arrange that when the handler returns, it - 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? + Another challenge is that the register contents need to be + correct when control returns to the interrupted user instruction. <p>Your solution is likely to require you to save and restore registers---what registers do you need to save and restore to resume 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 - done. Your job is to arrange that <tt>sigreturn</tt> returns to the - interrupted code. + done, and which restores registers and returns to the original + interrupted user instruction. Some hints: <ul> - <li>Add the <tt>sigreturn</tt> system call, following the changes - you made to support <tt>sigalarm</tt>. + <li>Add a new <tt>sigreturn</tt> system call. - <li>Save enough state when the timer goes in the <tt>struct - proc</tt> so that <tt>sigreturn</tt> can return to the + <li>Have <tt>usertrap</tt> save enough state in + <tt>struct proc</tt> when the timer goes off + that <tt>sigreturn</tt> can correctly return to the interrupted code. <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> <p>Once you pass <tt>test0</tt> and <tt>test1</tt>, run usertests to |