imx6获取中断号_如何在Linux上获得中断向量号?

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

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

解决方案

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.

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.

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.

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.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值