Bochs and interrupts

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
DarylD

Bochs and interrupts

Post by DarylD »

First off, after a pause due to a change in personal circumstances I am back and so I have started coding my OS again (of course!).

Okay, more of a question for those who have a working kernel under bochs.

I am having some strange behaviour under bochs most likely due to disabling/enabling interrupts. It looks like IRQ 0 is triggering quite strangely. Does anybody know how this varies to the timer triggering on a "real" computer. My code works perfectly on a regular PC but causes odd register corruption under bochs.

Now, I haven't discounted the fact I have a bug somewhere. But I have written some code with three threads that constantly relinquish CPU and cause a task switch. This should in theory hammer the task switching code and increase the possibility of an IRQ 0 during the task switch code. Now this runs for 24Hrs+ (until I stopped it) on my real pc but bochs will exhibit strange behaviour within seconds.

PS. I have my timer running at 10Hz, which should be slow enough for it to cope okay.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Bochs and interrupts

Post by Pype.Clicker »

bochs is known to have quite a weird IRQ0 behaviour (i.e. irregular and non-realtime interrupts raising).

Moreover, if you have quite much code in the timer IRQ, it may occur that BOCHS actually triggers another IRQ0 while the first one was still being handled -- a thing that is unlikely to happen on real hardware ...)
DarylD

Re:Bochs and interrupts

Post by DarylD »

How did you get around this behaviour?

I am obviously masking the IRQ 0 interrupt on entry, but I don't think it's really working very well.

Thanks for the advice.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Bochs and interrupts

Post by Pype.Clicker »

either make your ISR smaller (if it is possibly too long) or check you have CLIs everytime you need them for protection against task switches. There may also be a "realtime" option in Bochs 2.0 configuration ....

hope it'll help.

btw, nice 2 see u back ;)
User avatar
Neo
Member
Member
Posts: 842
Joined: Wed Oct 18, 2006 9:01 am

Re:Bochs and interrupts

Post by Neo »

i don't know if this will help but you can use the 'pit' option in BOCHS to get a 'real-time' response. The line in your bochsrc file should be

Code: Select all

pit: realtime=1
Only Human
Post Reply