Commit 9f621b8a authored by hthyyds's avatar hthyyds
Browse files

modify trap.c of proc time update

parent fb2573e3
No related merge requests found
Showing with 4 additions and 1 deletion
+4 -1
......@@ -92,8 +92,10 @@ usertrap(void)
exit(-1);
// give up the CPU if this is a timer interrupt.
if(which_dev == 2)
if(which_dev == 2){
p->utime++;
yield();
}
usertrapret();
}
......@@ -171,6 +173,7 @@ kerneltrap() {
// give up the CPU if this is a timer interrupt.
if(which_dev == 2 && myproc() != 0 && myproc()->state == RUNNING) {
myproc()->stime++;
yield();
}
// the yield() may have caused some traps to occur,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment