Page 1 of 1

Bochs and interrupts (OHCI trouble)

Posted: Wed Sep 12, 2012 1:27 pm
by losangelOS
Hi,

My first post here. I am having fun writing a kernel, and I use Bochs and Virtualbox to emulate hardware. I have written an OHCI driver which works on VirtualBox, but when I try the same thing on Bochs it hangs right after i enable all interrupts (except SOF, like explained in 5.1.1.4 in the OHCI definition). It works in VirtualBox.
Even stranger: When I don't enable the interrupts it works in Bochs, but now HcInterruptStatus never changes in VirtualBox, so then it doesn't work there. I don't understand this either, as I understand that HcInterruptEnable is not needed for HcInterruptStatus to be set, it just means that if it is set a hardware interrupt is generated.
(From 7.1.4:
When a bit becomes set, a
hardware interrupt is generated if the interrupt is enabled in the HcInterruptEnable register (see
Section 7.1.5) and the MasterInterruptEnable bit is set
)

My conclusion is that I am doing something wrong, but I have followed the specification close (I think), and it actually works on both Bochs and VB - but not with the same kernel! Any suggestions from more experienced os developers out there?

Edit: Changed HcInterruptStatus to HcInterruptEnable

Re: Bochs and interrupts (OHCI trouble)

Posted: Wed Sep 12, 2012 1:34 pm
by losangelOS
Just to add something that might be important: The host machine running VB and Bochs is an old laptop, so it could of course be some sort of performance issue. But it runs smooth in VB when it works.

Re: Bochs and interrupts (OHCI trouble)

Posted: Wed Sep 12, 2012 11:34 pm
by sounds
How attached are you to bochs?

I suggest you try two approaches, depending on what you feel is more important for your OS:
  1. Use VirtualBox's OHCI and QEMU's OHCI implementation, but not the Bochs OHCI implementation
  2. Write a UHCI driver for the Bochs UHCI implementation, and disable the Bochs OHCI implementation in your bochsrc

Re: Bochs and interrupts (OHCI trouble)

Posted: Thu Sep 13, 2012 12:48 am
by Combuster
sounds wrote:[*]Use VirtualBox's OHCI and QEMU's OHCI implementation, but not the Bochs OHCI implementation
How do you think your driver will fare on real hardware when you're only able to support one specific (and pretty much guaranteed to be incomplete because its an emulator) implementation of OHCI?

If it's provably broken, report a bug with the project. At any rate, you ought to test real hardware to find out what a proper implementation is up to.

Re: Bochs and interrupts (OHCI trouble)

Posted: Thu Sep 13, 2012 1:35 am
by losangelOS
sounds wrote:How attached are you to bochs?

I suggest you try two approaches, depending on what you feel is more important for your OS:
  1. Use VirtualBox's OHCI and QEMU's OHCI implementation, but not the Bochs OHCI implementation
  2. Write a UHCI driver for the Bochs UHCI implementation, and disable the Bochs OHCI implementation in your bochsrc
I am not attached to Bochs, but I suspect that _I_ am doing something wrong - not Bochs. Which is why I am asking; have anyone encountered similar problems? I love Bochs, and I have no indication that it is a bug.

Re: Bochs and interrupts (OHCI trouble)

Posted: Sun Sep 16, 2012 7:08 pm
by Bietje
As Combuster already mentioned, have you tried it on real hardware, and if so, what was the result? I had some issues on other topics with Bochs too and sometimes it also seems to be that Bochs doesn't emulate everything the way it should.

Grtz,
Bietje