🐛 修复了进程由于异常被捕获后,其他进程无法被正常调度的问题

This commit is contained in:
fslongjin 2022-06-01 17:13:12 +08:00
parent e2a59dbd43
commit b97aaee746
3 changed files with 24 additions and 23 deletions

View File

@ -53,7 +53,7 @@ Restore_all:
popq %rax popq %rax
addq $0x10, %rsp // FUNCerrcode addq $0x10, %rsp // FUNCerrcode
sti // sti
iretq iretq
ret_from_exception: ret_from_exception:

View File

@ -9,8 +9,8 @@
void do_divide_error(struct pt_regs *regs, unsigned long error_code) void do_divide_error(struct pt_regs *regs, unsigned long error_code)
{ {
//kerror("do_divide_error(0)"); //kerror("do_divide_error(0)");
kerror("do_divide_error(0),\tError Code:%#18lx,\tRSP:%#18lx,\tRIP:%#18lx\t CPU:%d\n", error_code, regs->rsp, regs->rip, proc_current_cpu_id); 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);
current_pcb->state = PROC_STOPPED;
while (1) while (1)
hlt(); hlt();
} }
@ -285,27 +285,27 @@ void do_virtualization_exception(struct pt_regs *regs, unsigned long error_code)
void sys_vector_init() void sys_vector_init()
{ {
set_trap_gate(0, 1, divide_error); set_trap_gate(0, 0, divide_error);
set_trap_gate(1, 1, debug); set_trap_gate(1, 0, debug);
set_intr_gate(2, 1, nmi); set_intr_gate(2, 0, nmi);
set_system_trap_gate(3, 1, int3); set_system_trap_gate(3, 0, int3);
set_system_trap_gate(4, 1, overflow); set_system_trap_gate(4, 0, overflow);
set_system_trap_gate(5, 1, bounds); set_system_trap_gate(5, 0, bounds);
set_trap_gate(6, 1, undefined_opcode); set_trap_gate(6, 0, undefined_opcode);
set_trap_gate(7, 1, dev_not_avaliable); set_trap_gate(7, 0, dev_not_avaliable);
set_trap_gate(8, 1, double_fault); set_trap_gate(8, 0, double_fault);
set_trap_gate(9, 1, coprocessor_segment_overrun); set_trap_gate(9, 0, coprocessor_segment_overrun);
set_trap_gate(10, 1, invalid_TSS); set_trap_gate(10, 0, invalid_TSS);
set_trap_gate(11, 1, segment_not_exists); set_trap_gate(11, 0, segment_not_exists);
set_trap_gate(12, 1, stack_segment_fault); set_trap_gate(12, 0, stack_segment_fault);
set_trap_gate(13, 1, general_protection); set_trap_gate(13, 0, general_protection);
set_trap_gate(14, 1, page_fault); set_trap_gate(14, 0, page_fault);
// 中断号15由Intel保留不能使用 // 中断号15由Intel保留不能使用
set_trap_gate(16, 1, x87_FPU_error); set_trap_gate(16, 0, x87_FPU_error);
set_trap_gate(17, 1, alignment_check); set_trap_gate(17, 0, alignment_check);
set_trap_gate(18, 1, machine_check); set_trap_gate(18, 0, machine_check);
set_trap_gate(19, 1, SIMD_exception); set_trap_gate(19, 0, SIMD_exception);
set_trap_gate(20, 1, virtualization_exception); set_trap_gate(20, 0, virtualization_exception);
// 中断号21-31由Intel保留不能使用 // 中断号21-31由Intel保留不能使用

View File

@ -75,6 +75,7 @@ void sched_cfs()
} }
} }
// kdebug("before switch, next.rip = %#018lx\tnext->gs=%#018lx", proc->thread->rip, proc->thread->gs); // kdebug("before switch, next.rip = %#018lx\tnext->gs=%#018lx", proc->thread->rip, proc->thread->gs);
// kdebug("currentpcb=%#018lx", (uint64_t)current_pcb);
process_switch_mm(proc); process_switch_mm(proc);
switch_proc(current_pcb, proc); switch_proc(current_pcb, proc);
} }