[SOLVED] Booting ElTorito ISO in Qemu
[SOLVED] Booting ElTorito ISO in Qemu
When I try to boot my kernel (from a grub ElTorito iso image) in QEMU, it hangs on the initial GRUB boot screen. It used to work, but suddenly it stopped (I only added a invlpg instruction to my paging code, so how does that affect GRUB).
Last edited by ghartshaw on Fri May 06, 2011 11:50 pm, edited 1 time in total.
- xenos
- Member
- Posts: 1121
- Joined: Thu Aug 11, 2005 11:00 pm
- Libera.chat IRC: xenos1984
- Location: Tartu, Estonia
- Contact:
Re: Booting ElTorito ISO in Qemu
Does your kernel run into a "hlt" instruction with interrupts turned off? In that case, QEMU does not update the screen anymore and it seems to "freeze". This screen freezing may also happen a while before the hlt instruction is encountered. In order to avoid this effect, you need to terminate your code with an endliess loop ("jmp ." or "jmp $") instead of a hlt.
Re: Booting ElTorito ISO in Qemu
I have interrupts on and end with
Code: Select all
1: hlt
jmp 1b
- xenos
- Member
- Posts: 1121
- Joined: Thu Aug 11, 2005 11:00 pm
- Libera.chat IRC: xenos1984
- Location: Tartu, Estonia
- Contact:
Re: Booting ElTorito ISO in Qemu
Have you tried using QEMU's debugging monitor to figure out where it hangs? Or booting your kernel with some other simulator, like Bochs, to see whether it hangs only in QEMU?
Re: Booting ElTorito ISO in Qemu
The monitor says that %eip=0xfff0 which isn't my code (either GRUB or the BIOS). I haven't been able to try it elsewhere though. Is there anything else I can check in QEMU to see if it is even getting to my code (I don't think it is, which is strange)?
- xenos
- Member
- Posts: 1121
- Joined: Thu Aug 11, 2005 11:00 pm
- Libera.chat IRC: xenos1984
- Location: Tartu, Estonia
- Contact:
Re: Booting ElTorito ISO in Qemu
That should be the BIOS reset entry point, so it looks like the CPU is resetting. I usually start qemu with command line arguments -d cpu_reset, so it prints a CPU register dump to /tmp/qemu.log when the CPU resets. Then you can see where the reset occurs (EIP before the reset), set a breakpoint at that point, and so on.
Re: Booting ElTorito ISO in Qemu
Ok, that is good to know. That was it, so I think I should be able to sort it out now.