alarm task finished

This commit is contained in:
2025-06-18 16:02:24 +08:00
parent 4c08583743
commit c7c962ffef
10 changed files with 60 additions and 3 deletions

View File

@ -77,8 +77,15 @@ usertrap(void)
exit(-1);
// give up the CPU if this is a timer interrupt.
if(which_dev == 2)
yield();
if(which_dev == 2){
p->inter_cnt++;
if (p->inter_cnt == p->alarm_cnt && 0 < p->alarm_cnt) {
*p->pre_trapframe = *p->trapframe;
p->trapframe->epc = p->handler;
} else {
yield();
}
}
usertrapret();
}