From 734faa27acfe136f4cab3ea06e70193c0ecc5402 Mon Sep 17 00:00:00 2001 From: Frans Kaashoek Date: Fri, 26 Jul 2019 21:03:59 -0400 Subject: [PATCH] Pass over lab text --- labs/syscall.html | 110 +++++++++++++++++++++++++--------------------- 1 file changed, 60 insertions(+), 50 deletions(-) diff --git a/labs/syscall.html b/labs/syscall.html index dad86fe..1e6e504 100644 --- a/labs/syscall.html +++ b/labs/syscall.html @@ -8,10 +8,10 @@

Lab: system calls

This lab makes you familiar with the implementation of system calls. -In particular, you will implement a new system call: alarm. +In particular, you will implement a new system +calls: sigalarm and sigreturn. -Note: before this lab, it would be good to have recitation section - on gdb +Note: before this lab, it would be good to have recitation section on gdb and understanding assembly

Warmup: system call tracing

@@ -78,10 +78,9 @@ void main(void) { } -

Since you will be reading and writing RISC-V assembly code for xv6, - you should read through call.asm and understand it. The instruction - manual for RISC-V is in the doc directory (doc/riscv-spec-v2.2.pdf). - Here are some questions that you should answer for yourself: +

Read through call.asm and understand it. The instruction manual + for RISC-V is in the doc directory (doc/riscv-spec-v2.2.pdf). Here + are some questions that you should answer for yourself:

-

test1()

+

test1(): resume interrupted code

-

Test0 doesn't stress whether the handler returns correctly to +

Test0 doesn't tests whether the handler returns correctly to interrupted instruction in test0. If you didn't get this right, it is likely that test1 will fail (the program crashes or the program goes into an infinite loop). @@ -296,16 +292,30 @@ only one CPU, which you can do by running receives an interrupt, which register contains the address of the interrupted instruction? -

Your solution is likely to require you to save and restore a - register. There are several ways to do this. It is ok to change the - API of alarm() and have an alarm stub in user space that cooperates - with the kernel. +

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 + system call sigreturn that the handler calls when it is + done. Your job is to arrange that sigreturn returns to the + interrupted code. + + Some hints: +