🔧 将软中断更改为不可重入

This commit is contained in:
fslongjin
2022-07-11 10:24:35 +08:00
parent dcafbef4d4
commit f4891cc8a3
6 changed files with 72 additions and 35 deletions

View File

@ -479,9 +479,9 @@ void do_IRQ(struct pt_regs *rsp, ul number)
}
// kdebug("before softirq");
// 检测是否有未处理的软中断
if (softirq_status != 0)
do_softirq();
// 进入软中断处理程序
do_softirq();
// kdebug("after softirq");
// 检测当前进程是否持有自旋锁,若持有自旋锁,则不进行抢占式的进程调度
if (current_pcb->preempt_count > 0)

View File

@ -66,7 +66,7 @@ void HPET_handler(uint64_t number, uint64_t param, struct pt_regs *regs)
// 若当前时间比定时任务的时间间隔大,则进入中断下半部
if (container_of(list_next(&timer_func_head.list), struct timer_func_list_t, list)->expire_jiffies <= timer_jiffies)
set_softirq_status((1 << TIMER_SIRQ));
raise_softirq((1 << TIMER_SIRQ));
// if (current_pcb->pid == 2)
// kwarn("timer_jiffies = %ld video_refresh_expire_jiffies=%ld", timer_jiffies, video_refresh_expire_jiffies);

View File

@ -27,22 +27,19 @@ void timer_init()
void do_timer_softirq(void *data)
{
// if(current_pcb->pid==3)
// kdebug("pid3 timer irq");
struct timer_func_list_t *tmp = container_of(list_next(&timer_func_head.list), struct timer_func_list_t, list);
while ((!list_empty(&timer_func_head.list)) && (tmp->expire_jiffies <= timer_jiffies))
{
if (current_pcb->pid == 2)
kdebug("pid2 timer do");
timer_func_del(tmp);
tmp->func(tmp->data);
kfree(tmp);
tmp = container_of(list_next(&timer_func_head.list), struct timer_func_list_t, list);
}
softirq_ack(TIMER_SIRQ);
// printk_color(ORANGE, BLACK, "(HPET%ld)", timer_jiffies);
}
/**

View File

@ -78,7 +78,6 @@ void video_refresh_framebuffer(void *data)
// 暂时设置一个很大的值作为屏障,防止二次进入该区域(造成#GP
video_refresh_expire_jiffies = timer_jiffies + 100000;
video_last_refresh_pid = current_pcb->pid;
softirq_ack(VIDEO_REFRESH_SIRQ);
memcpy((void *)sc_info.fb_vaddr, (void *)sc_info.double_fb_vaddr, (sc_info.length << 2));
video_refresh_expire_jiffies = cal_next_n_ms_jiffies(REFRESH_INTERVAL);