🆕 实现简单的读取键盘数据的功能

This commit is contained in:
fslongjin 2022-01-29 15:12:34 +08:00
parent 8ab02c496c
commit 39ddc21ca5
3 changed files with 25 additions and 14 deletions

View File

@ -360,7 +360,6 @@ static int vsprintf(char *buf, const char *fmt, va_list args)
precision = 3;
str = write_float_point_num(str, va_arg(args, double), field_width, precision, flags);
break;
//对于不识别的控制符,直接输出
@ -407,7 +406,6 @@ static char *write_num(char *str, ull num, int base, int field_width, int precis
// 设置填充元素
pad = (flags & PAD_ZERO) ? '0' : ' ';
sign = 0;
if (flags & SIGN && num < 0)
{

View File

@ -126,6 +126,20 @@ void init_irq()
*/
void do_IRQ(ul rsp, ul number)
{
unsigned char x;
switch (number)
{
case 0x20: // 时钟中断信号
break;
case 0x21: // 键盘中断
x = io_in8(0x60);
printk_color(ORANGE, BLACK, "Received key irq, key code:%#018lx\n", x);
break;
default:
break;
}
if(number!=0x20)
printk_color(ORANGE, BLACK, "Received irq:%#018x\n", number);

View File

@ -116,7 +116,6 @@ void Start_Kernel(void)
test_mm();
//test_printk();
//int t = 1 / 0; // 测试异常处理模块能否正常工作 触发除法错误
// int t = *(int *)0xffff80000aa00000; // 触发页故障