Cannot get periodic APIC timer interrupt
Posted: Tue Mar 23, 2010 7:17 am
I follow AMD's system programming guide and try to enable APIC timer. I only the a one-shot interrupt, although I set bit 17 of the APIC timer register.
This is my APIC initialization code, and the attached is a screen shot of qemu. The line "APIC Tick: 1" is from my timer interrupt handler. What is wrong with my initialization code?
Cheers
--torshie
This is my APIC initialization code, and the attached is a screen shot of qemu. The line "APIC Tick: 1" is from my timer interrupt handler. What is wrong with my initialization code?
Code: Select all
InterruptController::InterruptController() {
Processor& processor = getProcessorInstance<Processor>();
Address physical = processor.getModelSpecificRegister(MSR_APIC_BASE_ADDRES_REGISTER);
physical = (physical >> 12) << 12;
PageMap::embedPhysicalMemory(physical, CONTROLLER_BASE_ADDRESS, PAGE_SIZE);
Message::brief << "APIC ID: " << Register<APIC_REGISTER_ID>::reference() << "\n";
Message::brief << "APIC Version: " << Register<APIC_REGISTER_VERSION>::reference() << "\n";
U32& initialCount = Register<APIC_REGISTER_TIMER_INITIAL_COUNT>::reference() ;
U32& timer = Register<APIC_REGISTER_ENTRY_TIMER>::reference();
U32& timerDevideConfig = Register<APIC_REGISTER_TIMER_DIVIDE_CONFIGURATION>::reference();
timerDevideConfig = 10;
initialCount = 0xffffff;
timer = InterruptDescriptorTable::APIC_INTERRUPT_TIMER | (1 << 17);
for (;;) {
volatile int i = 0;
Message::brief << "Timer: " << timer << " Initial Count: "
<< Register<APIC_REGISTER_TIMER_CURRENT_COUNT>::reference() << "\n";
for (; i < 100000000; ++i) {
}
}
}
--torshie