[SOLVED] Booting ElTorito ISO in Qemu

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
ghartshaw
Posts: 7
Joined: Thu May 05, 2011 9:58 pm

[SOLVED] Booting ElTorito ISO in Qemu

Post by ghartshaw »

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.
User avatar
xenos
Member
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

Post by xenos »

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.
Programmers' Hardware Database // GitHub user: xenos1984; OS project: NOS
ghartshaw
Posts: 7
Joined: Thu May 05, 2011 9:58 pm

Re: Booting ElTorito ISO in Qemu

Post by ghartshaw »

I have interrupts on and end with

Code: Select all

1:    hlt
      jmp 1b
User avatar
xenos
Member
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

Post by xenos »

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?
Programmers' Hardware Database // GitHub user: xenos1984; OS project: NOS
ghartshaw
Posts: 7
Joined: Thu May 05, 2011 9:58 pm

Re: Booting ElTorito ISO in Qemu

Post by ghartshaw »

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)?
User avatar
xenos
Member
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

Post by xenos »

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.
Programmers' Hardware Database // GitHub user: xenos1984; OS project: NOS
ghartshaw
Posts: 7
Joined: Thu May 05, 2011 9:58 pm

Re: Booting ElTorito ISO in Qemu

Post by ghartshaw »

Ok, that is good to know. That was it, so I think I should be able to sort it out now.
Post Reply