summaryrefslogtreecommitdiff
path: root/kernel/sysproc.c
diff options
context:
space:
mode:
authorMole Shang <[email protected]>2024-02-11 14:41:35 +0800
committerMole Shang <[email protected]>2024-02-11 14:41:35 +0800
commit48a5e34fcd07852b4a68825ce8e37feb6f6d04d7 (patch)
treeb6ec41ca1889db0122d754b0083c7d1d87cb0818 /kernel/sysproc.c
parent3673a2cdfb30e1e3936e695a3fb8adee74488d6b (diff)
downloadxv6-labs-48a5e34fcd07852b4a68825ce8e37feb6f6d04d7.tar.gz
xv6-labs-48a5e34fcd07852b4a68825ce8e37feb6f6d04d7.tar.bz2
xv6-labs-48a5e34fcd07852b4a68825ce8e37feb6f6d04d7.zip
lab traps: finishtraps
Diffstat (limited to 'kernel/sysproc.c')
-rw-r--r--kernel/sysproc.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/kernel/sysproc.c b/kernel/sysproc.c
index bd9d0f0..fac1d83 100644
--- a/kernel/sysproc.c
+++ b/kernel/sysproc.c
@@ -65,6 +65,9 @@ sys_sleep(void)
}
sleep(&ticks, &tickslock);
}
+
+ backtrace();
+
release(&tickslock);
return 0;
}
@@ -124,3 +127,26 @@ sys_sysinfo(void)
return sys_info(si);
}
+uint64
+sys_sigalarm(void)
+{
+ struct proc *p = myproc();
+ uint64 handler;
+
+ argint(0, &p->alarm_interval);
+ argaddr(1, &handler);
+ p->alarm_handler = handler;
+
+ return 0;
+}
+
+uint64 sys_sigreturn(void)
+{
+ struct proc *p = myproc();
+ // retore saved trapframe to resume
+ memmove(p->trapframe, p->atpfm, sizeof(struct trapframe));
+ p->alarm_tickspassed = 0;
+ p->alarm_caninvoke = 1;
+ // make sure return the original a0 in trapframe to pass test3
+ return p->trapframe->a0;
+}