fix: 进程异常退出后,屏幕不刷新的问题

This commit is contained in:
fslongjin 2022-07-30 12:59:49 +08:00
parent 10e8f9a752
commit 54f9d98f71

View File

@ -4,7 +4,7 @@
#include <common/kprint.h>
#include <process/process.h>
#include <debug/traceback/traceback.h>
#include <sched/sched.h>
// 0 #DE 除法错误
void do_divide_error(struct pt_regs *regs, unsigned long error_code)
{
@ -12,8 +12,7 @@ void do_divide_error(struct pt_regs *regs, unsigned long error_code)
kerror("do_divide_error(0),\tError Code:%#18lx,\tRSP:%#18lx,\tRIP:%#18lx\t CPU:%d\t pid=%d\n", error_code, regs->rsp, regs->rip, proc_current_cpu_id, current_pcb->pid);
traceback(regs);
current_pcb->state = PROC_STOPPED;
while (1)
hlt();
sched_cfs();
}
// 1 #DB 调试异常
@ -59,8 +58,8 @@ void do_overflow(struct pt_regs *regs, unsigned long error_code)
printk_color(YELLOW, BLACK, "TRAP");
printk(" ] do_overflow(4),\tError Code:%#18lx,\tRSP:%#18lx,\tRIP:%#18lx\t CPU:%d\n", error_code, regs->rsp, regs->rip, proc_current_cpu_id);
while (1)
hlt();
current_pcb->state = PROC_STOPPED;
sched_cfs();
}
// 5 #BR 越界异常
@ -79,8 +78,8 @@ void do_undefined_opcode(struct pt_regs *regs, unsigned long error_code)
kerror("do_undefined_opcode(6),\tError Code:%#18lx,\tRSP:%#18lx,\tRIP:%#18lx\t CPU:%d, pid:%ld", error_code, regs->rsp, regs->rip, proc_current_cpu_id, current_pcb->pid);
traceback(regs);
while (1)
hlt();
current_pcb->state = PROC_STOPPED;
sched_cfs();
}
// 7 #NM 设备异常FPU不存在
@ -89,8 +88,8 @@ void do_dev_not_avaliable(struct pt_regs *regs, unsigned long error_code)
kerror("do_dev_not_avaliable(7),\tError Code:%#18lx,\tRSP:%#18lx,\tRIP:%#18lx\t CPU:%d\n", error_code, regs->rsp, regs->rip, proc_current_cpu_id);
while (1)
hlt();
current_pcb->state = PROC_STOPPED;
sched_cfs();
}
// 8 #DF 双重错误
@ -101,8 +100,8 @@ void do_double_fault(struct pt_regs *regs, unsigned long error_code)
printk_color(RED, BLACK, "Terminate");
printk(" ] do_double_fault(8),\tError Code:%#18lx,\tRSP:%#18lx,\tRIP:%#18lx\t CPU:%d\n", error_code, regs->rsp, regs->rip, proc_current_cpu_id);
traceback(regs);
while (1)
hlt();
current_pcb->state = PROC_STOPPED;
sched_cfs();
}
// 9 协处理器越界(保留)
@ -111,8 +110,8 @@ void do_coprocessor_segment_overrun(struct pt_regs *regs, unsigned long error_co
kerror("do_coprocessor_segment_overrun(9),\tError Code:%#18lx,\tRSP:%#18lx,\tRIP:%#18lx\t CPU:%d\n", error_code, regs->rsp, regs->rip, proc_current_cpu_id);
while (1)
hlt();
current_pcb->state = PROC_STOPPED;
sched_cfs();
}
// 10 #TS 无效的TSS段
@ -142,8 +141,8 @@ void do_invalid_TSS(struct pt_regs *regs, unsigned long error_code)
printk("\n");
while (1)
hlt();
current_pcb->state = PROC_STOPPED;
sched_cfs();
}
// 11 #NP 段不存在
@ -152,8 +151,8 @@ void do_segment_not_exists(struct pt_regs *regs, unsigned long error_code)
kerror("do_segment_not_exists(11),\tError Code:%#18lx,\tRSP:%#18lx,\tRIP:%#18lx\t CPU:%d\n", error_code, regs->rsp, regs->rip, proc_current_cpu_id);
while (1)
hlt();
current_pcb->state = PROC_STOPPED;
sched_cfs();
}
// 12 #SS SS段错误
@ -162,15 +161,15 @@ void do_stack_segment_fault(struct pt_regs *regs, unsigned long error_code)
kerror("do_stack_segment_fault(12),\tError Code:%#18lx,\tRSP:%#18lx,\tRIP:%#18lx\t CPU:%d\n", error_code, regs->rsp, regs->rip, proc_current_cpu_id);
while (1)
hlt();
current_pcb->state = PROC_STOPPED;
sched_cfs();
}
// 13 #GP 通用保护性异常
void do_general_protection(struct pt_regs *regs, unsigned long error_code)
{
kerror("do_general_protection(13),\tError Code:%#18lx,\tRSP:%#18lx,\tRIP:%#18lx\t CPU:%d\n", error_code, regs->rsp, regs->rip, proc_current_cpu_id);
kerror("do_general_protection(13),\tError Code:%#18lx,\tRSP:%#18lx,\tRIP:%#18lx\t CPU:%d\tpid=%ld\n", error_code, regs->rsp, regs->rip, proc_current_cpu_id, current_pcb->pid);
if (error_code & 0x01)
printk_color(RED, BLACK, "The exception occurred during delivery of an event external to the program,such as an interrupt or an earlier exception.\n");
@ -187,8 +186,8 @@ void do_general_protection(struct pt_regs *regs, unsigned long error_code)
printk_color(RED, BLACK, "Segment Selector Index:%#010x\n", error_code & 0xfff8);
traceback(regs);
while (1)
hlt();
current_pcb->state = PROC_STOPPED;
sched_cfs();
}
// 14 #PF 页故障
@ -227,8 +226,7 @@ void do_page_fault(struct pt_regs *regs, unsigned long error_code)
traceback(regs);
current_pcb->state = PROC_STOPPED;
while (1)
hlt();
sched_cfs();
}
// 15 Intel保留请勿使用
@ -249,8 +247,8 @@ void do_alignment_check(struct pt_regs *regs, unsigned long error_code)
kerror("do_alignment_check(17),\tError Code:%#18lx,\tRSP:%#18lx,\tRIP:%#18lx\t CPU:%d\n", error_code, regs->rsp, regs->rip, proc_current_cpu_id);
while (1)
hlt();
current_pcb->state = PROC_STOPPED;
sched_cfs();
}
// 18 #MC 机器检测
@ -259,8 +257,8 @@ void do_machine_check(struct pt_regs *regs, unsigned long error_code)
kerror("do_machine_check(18),\tError Code:%#18lx,\tRSP:%#18lx,\tRIP:%#18lx\t CPU:%d\n", error_code, regs->rsp, regs->rip, proc_current_cpu_id);
while (1)
hlt();
current_pcb->state = PROC_STOPPED;
sched_cfs();
}
// 19 #XM SIMD浮点异常
@ -269,8 +267,8 @@ void do_SIMD_exception(struct pt_regs *regs, unsigned long error_code)
kerror("do_SIMD_exception(19),\tError Code:%#18lx,\tRSP:%#18lx,\tRIP:%#18lx\t CPU:%d\n", error_code, regs->rsp, regs->rip, proc_current_cpu_id);
while (1)
hlt();
current_pcb->state = PROC_STOPPED;
sched_cfs();
}
// 20 #VE 虚拟化异常
@ -279,8 +277,8 @@ void do_virtualization_exception(struct pt_regs *regs, unsigned long error_code)
kerror("do_virtualization_exception(20),\tError Code:%#18lx,\tRSP:%#18lx,\tRIP:%#18lx\t CPU:%d\n", error_code, regs->rsp, regs->rip, proc_current_cpu_id);
while (1)
hlt();
current_pcb->state = PROC_STOPPED;
sched_cfs();
}
// 21-21 Intel保留请勿使用