我写了一个当键盘控制器未准备好时挂起的while循环:
while(inb(0x64)!=0){
}
但是现在每次我尝试启动内核时 qemu 都会重新启动。有时我可以在很短的时间内看到 vga 输出。我试图删除 inb,它仍然会重新启动,除非我删除它
编辑:
这是完整的代码:
int *resolution_ptr;
void init_vbe(){
regs16_t vberegister;
vberegister.bx=0x4107;
vberegister.ax=0x4f02;
int32(0x10,&vberegister);
*resolution_ptr=1280;
}
void kernel_main(void)
{
resolution_ptr=(int*)0x2ff0; /*define the address of the resolution, so that the printstring function can draw the letter correctly*/
init_vbe ();
printstring("Kernel sucessfully loaded.");
while(inb(0x64)!=0){ /*code that cause qemu to restart*/
}
}
当我尝试在其中运行我的内核时,bochs 抛出了这个错误:
00096454180e[CPU0 ] exception(): 3rd (13) exception with no resolution, shutdown status is 00h, resetting
INT32 也来自这里:https ://gist.github.com/carlosascari/35dba95ee3118ebf61f4bd1625f4fa11