ISRs Don't working properly in VirtualBox

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
Partial
Posts: 2
Joined: Sat Apr 03, 2010 3:27 pm
Location: Bogota DC, Colombia

ISRs Don't working properly in VirtualBox

Post by Partial »

Hi! everyone... :)

I'm trying to make a simple game like "Multiboot Invaders"

I want to make Delays using the PIT. I'm using the IRQ0 for this.

Code: Select all

uint64 ticks = 0;

void irq_timer(registers_t regs) {
	++ticks;
}
The next implementation of delay function Don't work...

Code: Select all

void delay(uint64 total_ticks) {
	uint64 limit = ticks + total_ticks;
	while(ticks <= limit);
}
example:
- if i write the next code...

Code: Select all

int main() {
        // ... all initializing code timer, keyboard, irqs handlers and more goes here...

        frequency_timer(100);
        puts("Before Delay");
        delay(50);
        puts("After Delay");
}
the last call puts("After delay"); never execute...

but if i add the modification to Delay Function, It Works properly

Code: Select all

void delay(uint64 total_ticks) {
	uint64 limit = ticks + total_ticks;
	while(ticks <= limit) {
                outb(0x0, 0x0); // Or any Port and data
        }
}
Similar occurrs with the keyborad irq handler...
at the end of the handler function i've to add

Code: Select all

while(inb(0x64) & 2);
I know that these line waits to the keyborad controller process all data...

but in tutorials that i've seen these lines that i add are not necesary.

Anyone know whats happening.
Thanks!!.
I Speak Spanish, not English 8)
Last edited by Partial on Mon Dec 06, 2010 1:44 pm, edited 1 time in total.
I Speak Spanish, not English
Debian Squeeze running on Macbook Pro.
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: IRSs Don't working properly in VirtualBox

Post by Combuster »

"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 ]
Partial
Posts: 2
Joined: Sat Apr 03, 2010 3:27 pm
Location: Bogota DC, Colombia

Re: IRSs Don't working properly in VirtualBox

Post by Partial »

Thanks a lot...!!!
Now is working.
I Speak Spanish, not English
Debian Squeeze running on Macbook Pro.
Post Reply