linux下IRQ和软中断处理函数定义

0~31是不可屏蔽的中断和异常

32~47是IRQ中断

48~255是软中断

0x80  系统调用的 

 

 

IRQ和软中断的定义如下:

 

在arch/x86_64/i8259.c中

void (*interrupt[NR_IRQS])(void) = {
 IRQLIST_16(0x0),

#ifdef CONFIG_X86_IO_APIC
    IRQLIST_16(0x1), IRQLIST_16(0x2), IRQLIST_16(0x3),
 IRQLIST_16(0x4), IRQLIST_16(0x5), IRQLIST_16(0x6), IRQLIST_16(0x7),
 IRQLIST_16(0x8), IRQLIST_16(0x9), IRQLIST_16(0xa), IRQLIST_16(0xb),
 IRQLIST_16(0xc), IRQLIST_16(0xd)

#ifdef CONFIG_PCI_MSI
 , IRQLIST_14(0xe)
#endif

#endif
};

 

#define IRQ(x,y) \
 IRQ##x##y##_interrupt

#define IRQLIST_16(x) \
 IRQ(x,0), IRQ(x,1), IRQ(x,2), IRQ(x,3), \
 IRQ(x,4), IRQ(x,5), IRQ(x,6), IRQ(x,7), \
 IRQ(x,8), IRQ(x,9), IRQ(x,a), IRQ(x,b), \
 IRQ(x,c), IRQ(x,d), IRQ(x,e), IRQ(x,f)

#define IRQLIST_14(x) \
 IRQ(x,0), IRQ(x,1), IRQ(x,2), IRQ(x,3), \
 IRQ(x,4), IRQ(x,5), IRQ(x,6), IRQ(x,7), \
 IRQ(x,8), IRQ(x,9), IRQ(x,a), IRQ(x,b), \
 IRQ(x,c), IRQ(x,d)

 

在i8259.c中中断初始化如下:

void __init init_IRQ(void)
{
 int i;

 /* all the set up before the call gates are initialised */
 pre_intr_init_hook();

 /*
  * Cover the whole vector space, no vector can escape
  * us. (some of these will be overridden and become
  * 'special' SMP interrupts)
  */
 for (i = 0; i < (NR_VECTORS - FIRST_EXTERNAL_VECTOR); i++) {
  int vector = FIRST_EXTERNAL_VECTOR + i;
  if (i >= NR_IRQS)
   break;
  if (vector != SYSCALL_VECTOR)
   set_intr_gate(vector, interrupt[i]);
 }

 /* setup after call gates are initialised (usually add in
  * the architecture specific gates)
  */
 intr_init_hook();

 /*
  * Set the clock to HZ Hz, we already have a valid
  * vector now:
  */
 setup_pit_timer();

 /*
  * External FPU? Set up irq13 if so, for
  * original braindamaged IBM FERR coupling.
  */
 if (boot_cpu_data.hard_math && !cpu_has_fpu)
  setup_irq(FPU_IRQ, &fpu_irq);

 irq_ctx_init(smp_processor_id());
}

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值