🔧 将部分中断信息显示,统一到kprint

This commit is contained in:
fslongjin 2022-02-22 20:54:31 +08:00
parent 3961c0e1be
commit fa273198b3
3 changed files with 20 additions and 46 deletions

View File

@ -705,6 +705,9 @@ int do_scroll(bool direction, int pixels)
* @param pixels
* @param animation
*/
// @todo: 修复用户态触发键盘中断时产生#UD错误
// @todo采用双缓冲区防止画面撕裂
int scroll(bool direction, int pixels, bool animation)
{
// 暂时不支持反方向滚动

View File

@ -1,6 +1,7 @@
#include "trap.h"
#include "gate.h"
#include "../process/ptrace.h"
#include"../common/kprint.h"
void init_sys_vector()
{
@ -34,9 +35,7 @@ void init_sys_vector()
void do_divide_error(struct pt_regs * regs, unsigned long error_code)
{
printk("[ ");
printk_color(RED, BLACK, "ERROR");
printk(" ] do_divide_error(0),\tError Code:%#18lx,\tRSP:%#18lx,\tRIP:%#18lx\n", error_code, regs->rsp, regs->rip);
kerror("do_divide_error(0),\tError Code:%#18lx,\tRSP:%#18lx,\tRIP:%#18lx\n", error_code, regs->rsp, regs->rip);
while (1)
;
@ -94,9 +93,7 @@ void do_overflow(struct pt_regs * regs, unsigned long error_code)
void do_bounds(struct pt_regs * regs, unsigned long error_code)
{
printk("[ ");
printk_color(RED, BLACK, "ERROR");
printk(" ] do_bounds(5),\tError Code:%#18lx,\tRSP:%#18lx,\tRIP:%#18lx\n", error_code, regs->rsp, regs->rip);
kerror("do_bounds(5),\tError Code:%#18lx,\tRSP:%#18lx,\tRIP:%#18lx\n", error_code, regs->rsp, regs->rip);
while (1)
;
@ -106,9 +103,7 @@ void do_bounds(struct pt_regs * regs, unsigned long error_code)
void do_undefined_opcode(struct pt_regs * regs, unsigned long error_code)
{
printk("[ ");
printk_color(RED, BLACK, "ERROR");
printk(" ] do_undefined_opcode(6),\tError Code:%#18lx,\tRSP:%#18lx,\tRIP:%#18lx\n", error_code, regs->rsp, regs->rip);
kerror("do_undefined_opcode(6),\tError Code:%#18lx,\tRSP:%#18lx,\tRIP:%#18lx", error_code, regs->rsp, regs->rip);
while (1)
;
@ -118,9 +113,7 @@ void do_undefined_opcode(struct pt_regs * regs, unsigned long error_code)
void do_dev_not_avaliable(struct pt_regs * regs, unsigned long error_code)
{
printk("[ ");
printk_color(RED, BLACK, "ERROR");
printk(" ] do_dev_not_avaliable(7),\tError Code:%#18lx,\tRSP:%#18lx,\tRIP:%#18lx\n", error_code, regs->rsp, regs->rip);
kerror("do_dev_not_avaliable(7),\tError Code:%#18lx,\tRSP:%#18lx,\tRIP:%#18lx\n", error_code, regs->rsp, regs->rip);
while (1)
;
@ -142,9 +135,7 @@ void do_double_fault(struct pt_regs * regs, unsigned long error_code)
void do_coprocessor_segment_overrun(struct pt_regs * regs, unsigned long error_code)
{
printk("[ ");
printk_color(RED, BLACK, "ERROR");
printk(" ] do_coprocessor_segment_overrun(9),\tError Code:%#18lx,\tRSP:%#18lx,\tRIP:%#18lx\n", error_code, regs->rsp, regs->rip);
kerror("do_coprocessor_segment_overrun(9),\tError Code:%#18lx,\tRSP:%#18lx,\tRIP:%#18lx\n", error_code, regs->rsp, regs->rip);
while (1)
;
@ -185,9 +176,7 @@ void do_invalid_TSS(struct pt_regs * regs, unsigned long error_code)
void do_segment_not_exists(struct pt_regs * regs, unsigned long error_code)
{
printk("[ ");
printk_color(RED, BLACK, "ERROR");
printk(" ] do_segment_not_exists(11),\tError Code:%#18lx,\tRSP:%#18lx,\tRIP:%#18lx\n", error_code, regs->rsp, regs->rip);
kerror("do_segment_not_exists(11),\tError Code:%#18lx,\tRSP:%#18lx,\tRIP:%#18lx\n", error_code, regs->rsp, regs->rip);
while (1)
;
@ -197,9 +186,7 @@ void do_segment_not_exists(struct pt_regs * regs, unsigned long error_code)
void do_stack_segment_fault(struct pt_regs * regs, unsigned long error_code)
{
printk("[ ");
printk_color(RED, BLACK, "ERROR");
printk(" ] do_stack_segment_fault(12),\tError Code:%#18lx,\tRSP:%#18lx,\tRIP:%#18lx\n", error_code, regs->rsp, regs->rip);
kerror("do_stack_segment_fault(12),\tError Code:%#18lx,\tRSP:%#18lx,\tRIP:%#18lx\n", error_code, regs->rsp, regs->rip);
while (1)
;
@ -209,9 +196,7 @@ void do_stack_segment_fault(struct pt_regs * regs, unsigned long error_code)
void do_general_protection(struct pt_regs * regs, unsigned long error_code)
{
printk("[ ");
printk_color(RED, BLACK, "ERROR");
printk(" ] do_general_protection(13),\tError Code:%#18lx,\tRSP:%#18lx,\tRIP:%#18lx\n", error_code, regs->rsp, regs->rip);
kerror("do_general_protection(13),\tError Code:%#18lx,\tRSP:%#18lx,\tRIP:%#18lx\n", error_code, regs->rsp, regs->rip);
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");
@ -241,9 +226,7 @@ void do_page_fault(struct pt_regs * regs, unsigned long error_code)
: "=r"(cr2)::"memory");
printk("[ ");
printk_color(RED, BLACK, "ERROR");
printk(" ] do_page_fault(14),\tError Code:%#18lx,\tRSP:%#18lx,\tRIP:%#18lx\tCR2:%#18lx\n", error_code, regs->rsp, regs->rip, cr2);
kerror("do_page_fault(14),\tError Code:%#18lx,\tRSP:%#18lx,\tRIP:%#18lx\tCR2:%#18lx\n", error_code, regs->rsp, regs->rip, cr2);
printk_color(YELLOW, BLACK, "Information:\n");
if (!(error_code & 0x01))
@ -275,9 +258,7 @@ void do_page_fault(struct pt_regs * regs, unsigned long error_code)
void do_x87_FPU_error(struct pt_regs * regs, unsigned long error_code)
{
printk("[ ");
printk_color(RED, BLACK, "ERROR");
printk(" ] do_x87_FPU_error(16),\tError Code:%#18lx,\tRSP:%#18lx,\tRIP:%#18lx\n", error_code, regs->rsp, regs->rip);
kerror("do_x87_FPU_error(16),\tError Code:%#18lx,\tRSP:%#18lx,\tRIP:%#18lx\n", error_code, regs->rsp, regs->rip);
while (1)
;
@ -287,9 +268,7 @@ void do_x87_FPU_error(struct pt_regs * regs, unsigned long error_code)
void do_alignment_check(struct pt_regs * regs, unsigned long error_code)
{
printk("[ ");
printk_color(RED, BLACK, "ERROR");
printk(" ] do_alignment_check(17),\tError Code:%#18lx,\tRSP:%#18lx,\tRIP:%#18lx\n", error_code, regs->rsp, regs->rip);
kerror("do_alignment_check(17),\tError Code:%#18lx,\tRSP:%#18lx,\tRIP:%#18lx\n", error_code, regs->rsp, regs->rip);
while (1)
;
@ -299,9 +278,7 @@ void do_alignment_check(struct pt_regs * regs, unsigned long error_code)
void do_machine_check(struct pt_regs * regs, unsigned long error_code)
{
printk("[ ");
printk_color(RED, BLACK, "ERROR");
printk(" ] do_machine_check(18),\tError Code:%#18lx,\tRSP:%#18lx,\tRIP:%#18lx\n", error_code, regs->rsp, regs->rip);
kerror("do_machine_check(18),\tError Code:%#18lx,\tRSP:%#18lx,\tRIP:%#18lx\n", error_code, regs->rsp, regs->rip);
while (1)
;
@ -311,9 +288,7 @@ void do_machine_check(struct pt_regs * regs, unsigned long error_code)
void do_SIMD_exception(struct pt_regs * regs, unsigned long error_code)
{
printk("[ ");
printk_color(RED, BLACK, "ERROR");
printk(" ] do_SIMD_exception(19),\tError Code:%#18lx,\tRSP:%#18lx,\tRIP:%#18lx\n", error_code, regs->rsp, regs->rip);
kerror("do_SIMD_exception(19),\tError Code:%#18lx,\tRSP:%#18lx,\tRIP:%#18lx\n", error_code, regs->rsp, regs->rip);
while (1)
;
@ -323,9 +298,7 @@ void do_SIMD_exception(struct pt_regs * regs, unsigned long error_code)
void do_virtualization_exception(struct pt_regs * regs, unsigned long error_code)
{
printk("[ ");
printk_color(RED, BLACK, "ERROR");
printk(" ] do_virtualization_exception(20),\tError Code:%#18lx,\tRSP:%#18lx,\tRIP:%#18lx\n", error_code, regs->rsp, regs->rip);
kerror("do_virtualization_exception(20),\tError Code:%#18lx,\tRSP:%#18lx,\tRIP:%#18lx\n", error_code, regs->rsp, regs->rip);
while (1)
;

View File

@ -85,7 +85,7 @@ void system_initialize()
// 先初始化系统调用模块
syscall_init();
while(1);
// 再初始化进程模块。顺序不能调转
process_init();
@ -106,8 +106,6 @@ void Start_Kernel(void)
void ignore_int()
{
printk("[");
printk_color(YELLOW, BLACK, "WARN");
printk("] Unknown interrupt or fault at RIP.\n");
kwarn("Unknown interrupt or fault at RIP.\n");
return;
}