阅读:1807回复:0
键盘中断向量的获取
#define IO_APIC_BASE 0xFEC00000 // I/O APIC Physical Base Address
PHYSICAL_ADDRESS IOAPIC_AREA; // i/o apic mapped pointer // // Connect physical memory 0xfec00000 to [MappedVirtualVariable] // IOAPIC_AREA = RtlConvertLongToLargeInteger(IO_APIC_BASE);//物理地址0xFEC00000处储存着IDT的,硬编码 PULONG IOAPICGate = MmMapIoSpace(IOAPIC_AREA, 0x40, MmNonCached); //******************************************************************************************** IOAPICGate[0] = 0x10 + 2 * IRQ + 1; Buffer = IOAPICGate[4]; IOAPICOldHighbyte = Buffer; // save it for clean-up Buffer = 0; // Physical Destination APIC ID with 0x00 IOAPICGate[0] = 0x10 + 2 * IRQ + 1; IOAPICGate[4] = Buffer; // write IOAPICGate[0] = 0x10 + 2 * IRQ; Buffer = IOAPICGate[4]; IOAPICOldLowbyte = Buffer; Buffer &= 0xFF; // now buffer has the vector value IOAPICKeyboardVector = Buffer; DbgPrint("Keyboard Vector :: 0x%x\n", Buffer); // Delivery Mode [10:8] to 111b (ExtINT) // Destination Mode [11] to 0 (Physical) // Buffer = Buffer | 0x700; // Vector(may be 0x93) + ExtINT + Physical Destination + High active + Edge sensitive + non masked IOAPICGate[0] = 0x10 + 2 * IRQ; IOAPICGate[4] = Buffer; // write 上面的这些代码,我基本能猜到是什么意思。但是我没有相关的manual。其实我找到了manual,不过是过时的,与上面的不符。 对IOAPICGate[0]的写入,对IOAPICGate[4]的读取究竟是怎么回事,请高手来解释一下,做好提供inlel的manual。 |
|