Bochs and interrupts (OHCI trouble)

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
losangelOS
Posts: 3
Joined: Wed Sep 12, 2012 1:12 pm

Bochs and interrupts (OHCI trouble)

Post 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
losangelOS
Posts: 3
Joined: Wed Sep 12, 2012 1:12 pm

Re: Bochs and interrupts (OHCI trouble)

Post 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.
sounds
Member
Member
Posts: 112
Joined: Sat Feb 04, 2012 5:03 pm

Re: Bochs and interrupts (OHCI trouble)

Post 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
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Bochs and interrupts (OHCI trouble)

Post 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.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
losangelOS
Posts: 3
Joined: Wed Sep 12, 2012 1:12 pm

Re: Bochs and interrupts (OHCI trouble)

Post 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.
Bietje
Member
Member
Posts: 100
Joined: Wed Apr 20, 2011 6:57 am

Re: Bochs and interrupts (OHCI trouble)

Post 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
Post Reply