简体   繁体   English

如果我在 kernel 中添加一个 while 循环,Qemu 会重新启动

[英]Qemu restarts if I add a while loop in my kernel

I wrote a while loop that hangs when the keyboard controller is not ready:我写了一个当键盘 controller 未准备好时挂起的 while 循环:

while(inb(0x64)!=0){

  }

However now qemu restarts everytime I attempt to boot the kernel.但是现在每次我尝试启动 kernel 时 qemu 都会重新启动。 Sometimes I can see the vga output for a really short time.有时我可以在很短的时间内看到 vga output。 I tried to remove the inb, and it still restarts unless I remove it我试图删除 inb,它仍然会重新启动,除非我删除它

EDIT:编辑:

Here's the complete code:这是完整的代码:

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 thrown this error when I try to run my kernel in it:当我尝试在其中运行 kernel 时,bochs 引发了此错误:

00096454180e[CPU0  ] exception(): 3rd (13) exception with no resolution, shutdown status is 00h, resetting

Also INT32 is from here: https://gist.github.com/carlosascari/35dba95ee3118ebf61f4bd1625f4fa11 INT32 也来自这里: https://gist.github.com/carlosascari/35dba95ee3118ebf61f4bd1625f4fa11

Works now by removing sti in int32.现在可以通过删除 int32 中的 sti 来工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM