Search code examples
systemqemubochs

how get the qemu reboot reason like bochs


I wrote a simple os which constituted by mbr.bin、loader.bin and kernel.bin. here is my main.c which is used for creating kernel.bin

#include "print.h" 
void main(void) 
{
     put_str("I am kernel\n");
     while(1);
}

here is my bochsrc file:

# 机器内存: 32MB
megs: 32

# 启动方式
boot: disk

# 关闭鼠标
mouse: enabled=0

# 硬盘设置 
ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
ata0-master: type=disk, path="image/hd60M.img", mode=flat, cylinders=121, heads=16, spt=63


when I use bochs to run the image/hd60M.img everything works well,but when I used qemu-system-i386 ./image/hd60M.img command, the qemu jump into kernel and show "I am kernel" too, but after that the qemu reboot without logs, I want to get the qemu reboot reason, if it's in bochs,bochs will show the reboot reason automatically.

so, how get the qemu reboot reason, thanks a lot!


Solution

  • QEMU doesn't generally give that kind of guest-debugging information: it is aimed more at running correct guest code quickly than at diagnosing errors in incorrect guest code.

    The debugging facilities we do provide are:

    • the gdbstub, which lets you connect a guest-architecture gdb to do system-level debugging including single-stepping and breakpoints. This is the most-user-friendly debugging option.
    • the '-d' option which emits debug logging of emulation activities. This is primarily intended for debugging of QEMU itself, and to interpret its output you often need to have some awareness of how QEMU itself works internally as well as of the way the guest CPU works. The -d flags 'int,cpu_reset,guest_errors' might be useful here, but their output is likely to be a bit cryptic.