如何获得中断向量? [英] How to get the interrupt vector?

查看:506
本文介绍了如何获得中断向量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我运行猫的/ proc /中断,我可以得到如下:

When I run "cat /proc/interrupts", I can get the following:

           CPU0       CPU1
  0:        253       1878   IO-APIC-edge      timer
  1:          3          0   IO-APIC-edge      i8042
  7:          1          0   IO-APIC-edge      parport0
  8:          0          1   IO-APIC-edge      rtc0
  9:          0          0   IO-APIC-fasteoi   acpi
 12:          1          3   IO-APIC-edge      i8042
 16:     681584         60   IO-APIC-fasteoi   uhci_hcd:usb3, nvidia
 17:          0          0   IO-APIC-fasteoi   uhci_hcd:usb4, uhci_hcd:usb7
 18:          0          0   IO-APIC-fasteoi   uhci_hcd:usb8
 22:          2          1   IO-APIC-fasteoi   ehci_hcd:usb1, uhci_hcd:usb5
 23:         17         17   IO-APIC-fasteoi   ehci_hcd:usb2, uhci_hcd:usb6
 44:     146232     472747   PCI-MSI-edge      ahci
 45:        118        115   PCI-MSI-edge      snd_hda_intel
 46:   10038650        842   PCI-MSI-edge      eth1
NMI:      44479      43798   Non-maskable interrupts
LOC:   19025635   29426776   Local timer interrupts
SPU:          0          0   Spurious interrupts
PMI:      44479      43798   Performance monitoring interrupts
IWI:          0          0   IRQ work interrupts
RES: 3442001789 3442627214   Rescheduling interrupts
CAL:       1406       1438   Function call interrupts
TLB:     781318     792403   TLB shootdowns
TRM:          0          0   Thermal event interrupts
THR:          0          0   Threshold APIC interrupts
MCE:          0          0   Machine check exceptions
MCP:       2063       2063   Machine check polls
ERR:          0
MIS:          0

如何能得到NMILOCSPUPMI,等等。

How can I get the interrupt number of "NMI" "LOC" "SPU" "PMI", etc.

推荐答案

在86 国家计量总是在中断向量2号是硬codeD刚常见的异常(除以0,缺页等)。您可以从英特尔/ AMD CPU的文档中找到。

On x86 NMIs are always on interrupt vector 2. The number is hard-coded just as common exceptions (division by 0, page fault, etc). You can find this in the CPU documentation from Intel/AMD.

如果在 APIC 被启用(如在在问题psented转储$ P $的情况),可以从APIC的<得到伪中断的中断向量编号code> SVR 注册。再次,看到了同一个CPU的文档。

If the APIC is enabled (as is the case in the dump presented in the question), Spurious Interrupt's interrupt vector number can be obtained from APIC's SVR register. Again, see the same CPU documentation on that.

如果在 APIC 未启用,而是在 PIC 正在被使用,那么假中断的交付 IRQ7 (请参阅 8259 PIC芯片规格为)。在 BIOS 程序PIC在这样一种方式,IRQ7的中断向量的0Fh ,但Windows和Linux改变这种映射避免共用同一个中断向量的IRQ和CPU例外。看起来这映射不能从PIC质疑,但它通过发送初始化控制字2( ICW2 )的PIC确立。下面是<一个有关Linux的一块code的href=\"http://lxr.free-electrons.com/source/arch/x86/kernel/i8259.c#L299\"><$c$c>init_8259A():

If the APIC isn't enabled and instead the PIC is being used, then Spurious Interrupts are delivered as IRQ7 (see the 8259A PIC chip spec for that). The BIOS programs the PIC in such a way that IRQ7 is interrupt vector 0Fh, but Windows and Linux change this mapping to avoid sharing the same interrupt vectors for IRQs and CPU exceptions. It seems like this mapping can't be queried from the PIC, but it's established via sending the Initialization Control Word 2 (ICW2) to the PIC. Here's the relevant piece of Linux code in init_8259A():

    /* ICW2: 8259A-1 IR0-7 mapped to 0x30-0x37 on x86-64,
       to 0x20-0x27 on i386 */
    outb_pic(IRQ0_VECTOR, PIC_MASTER_IMR);

这应该回答的伪中断向量部分。

That should answer the Spurious Interrupt vector part.

至于 LOC PMI ,我认为,这些都是本地APIC的中断,你可以找到自己的中断向量从APIC就像上面的伪中断。

As for LOC and PMI, I think, these are local APIC's interrupts and you can find their interrupt vectors from the APIC just like with the Spurious Interrupt above.

这篇关于如何获得中断向量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆