当前位置: 首页>>代码示例>>C++>>正文


C++ set_intr_gate函数代码示例

本文整理汇总了C++中set_intr_gate函数的典型用法代码示例。如果您正苦于以下问题:C++ set_intr_gate函数的具体用法?C++ set_intr_gate怎么用?C++ set_intr_gate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了set_intr_gate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ttyinit

void ttyinit(int dev)
{
  int baseport, ret;                        /* initialize baseport and return val variable for queue operations*/
  struct tty *tty;		                      /* ptr to tty software params/data block */
  baseport = devtab[dev].dvbaseport;        /* pick up hardware addr */
  tty = (struct tty *)devtab[dev].dvdata;   /* and software params struct */
  cli();
  if (baseport == COM1_BASE) 
  {
                                            /* arm interrupts by installing interrupt vector address */
    set_intr_gate(COM1_IRQ+IRQ_TO_INT_N_SHIFT, &irq4inthand);
    pic_enable_irq(COM1_IRQ);
  } 
  else if (baseport == COM2_BASE) 
  {
                                            /* arm interrupts by installing interrupt vector address */
    set_intr_gate(COM2_IRQ+IRQ_TO_INT_N_SHIFT, &irq3inthand);
    pic_enable_irq(COM2_IRQ);
  } 
  else 
  {
    kprintf("Bad TTY device table entry, dev %d\n", dev);
    return;			                            /* give up */
  }
  tty->echoflag = 1;	                                   /* default to echoing */
  ret = init_queue((tty->rqu), MAXQ);                    /* init RX queue */
  ret = init_queue((tty->tqu), MAXQ);                    /* init  TX queue */
                                                         
  outpt(baseport+UART_IER, UART_IER_RDI|UART_IER_THRI);  /* enable interrupts on receiver and transmitter */
}
开发者ID:AnoopaChandrasekharan,项目名称:sapc,代码行数:30,代码来源:tty.c

示例2: init_irq

void init_irq(void)
{
	int	i;

	init_pic();
	
	for( i = 0; i < MAX_IRQ; i++ )
		irqhandler[i]	= _ignore_irq;

	set_intr_gate(IRQ_VECTOR+0, _irq_0);
	set_intr_gate(IRQ_VECTOR+1, _irq_1);
	// IRQ2~15 is implemented later
	/*set_intr_gate(IRQ_VECTOR+2, _irq_2);
	set_intr_gate(IRQ_VECTOR+3, _irq_3);
	set_intr_gate(IRQ_VECTOR+4, _irq_4);
	set_intr_gate(IRQ_VECTOR+5, _irq_5);
	set_intr_gate(IRQ_VECTOR+6, _irq_6);
	set_intr_gate(IRQ_VECTOR+7, _irq_7);
	set_intr_gate(IRQ_VECTOR+8, _irq_8);
	set_intr_gate(IRQ_VECTOR+9, _irq_9);
	set_intr_gate(IRQ_VECTOR+10, _irq_10);
	set_intr_gate(IRQ_VECTOR+11, _irq_11);
	set_intr_gate(IRQ_VECTOR+12, _irq_12);
	set_intr_gate(IRQ_VECTOR+13, _irq_13);
	set_intr_gate(IRQ_VECTOR+14, _irq_14);
	set_intr_gate(IRQ_VECTOR+15, _irq_15);*/

}
开发者ID:gurugio,项目名称:gurugio,代码行数:28,代码来源:init_irq.c

示例3: irqaction

/* 注册中断 */
int irqaction(unsigned int irq, struct sigaction * new_sa)
{
	struct sigaction * sa;
	unsigned long flags;

	if (irq > 15)
		return -EINVAL;
	sa = irq + irq_sigaction;
	if (sa->sa_mask)
		return -EBUSY;
	if (!new_sa->sa_handler)
		return -EINVAL;
	save_flags(flags);
	cli();
	*sa = *new_sa;
	sa->sa_mask = 1;
	if (sa->sa_flags & SA_INTERRUPT)
		set_intr_gate(0x20+irq,fast_interrupt[irq]);
	else
		set_intr_gate(0x20+irq,interrupt[irq]);
	if (irq < 8) {
		cache_21 &= ~(1<<irq);
		outb(cache_21,0x21);
	} else {
		cache_21 &= ~(1<<2);
		cache_A1 &= ~(1<<(irq-8));
		outb(cache_21,0x21);
		outb(cache_A1,0xA1);
	}
	restore_flags(flags);
	return 0;
}
开发者ID:wanggx,项目名称:Linux1.0,代码行数:33,代码来源:irq.c

示例4: rs_init

void rs_init(void) {
    set_intr_gate(0x24,rs1_interrupt);  // set up serial port 1 interruption
    set_intr_gate(0x23,rs2_interrupt);  // serial port 2 interruption
    init(tty_table[1].read_q.data);     // initialize serial port 1
    init(tty_table[2].read_q.data);     // initialize serial port 2
    outb(inb_p(0x21)&0xE7,0x21);        // Allow IRQ3 and IRQ4
}
开发者ID:litao91,项目名称:linux0.11,代码行数:7,代码来源:serial.c

示例5: idt_init

/* Initialize the IDT table */
void idt_init()
{
	/* Initialize Exception Gates */
	set_trap_gate(0, &divide_error_wrapper);
	set_trap_gate(1, &debug);
	set_trap_gate(2, &nmi);
	set_system_gate(3, &int3);
	set_system_gate(4, &overflow);
	set_system_gate(5, &bounds);
	set_trap_gate(6, &invalid_op);
	set_trap_gate(7, &device_not_available);
	set_trap_gate(8, &double_fault);
	set_trap_gate(9, &coprocessor_segment_overrun);
	set_trap_gate(10, &invalid_TSS);
	set_trap_gate(11, &segment_not_present);
	set_trap_gate(12, &stack_segment);
	set_trap_gate(13, &general_protection);
	set_trap_gate(14, &page_fault_wrapper);
	set_trap_gate(16, &coprocessor_error);
	set_trap_gate(17, &alignment_check);


	
	/* Initialize Interrupt Gates */
	// refer to student-notes.pdf P29
	set_intr_gate(0x20, &PIT_wrapper);
	set_intr_gate(0x21, &keyboard_wrapper);			// Initialize keyboard entry
	set_intr_gate(0x28, &rtc_wrapper);				// Initialize the RTC entry


	
	
	/* Initialize system call gates*/
	set_system_gate(0x80, &syscall_linkage);
}
开发者ID:tielong,项目名称:ece391,代码行数:36,代码来源:idt.c

示例6: rs_init

void rs_init(void)
{
	set_intr_gate(0x24,rs1_interrupt);
	set_intr_gate(0x23,rs2_interrupt);
	init(tty_table[1].read_q.data); /* data = 0x3f8, rs1 */
	init(tty_table[2].read_q.data); /* data = 0x2f8, rs2 */
	outb(inb_p(0x21)&0xE7,0x21);
}
开发者ID:CarterTsai,项目名称:linux-kernel-0.12-study-version,代码行数:8,代码来源:serial.c

示例7: rs_init

//// 初始化串行中断程序和串行接口。
void
rs_init (void)
{
	set_intr_gate (0x24, rs1_interrupt);	// 设置串行口1 的中断门向量(硬件IRQ4 信号)。
	set_intr_gate (0x23, rs2_interrupt);	// 设置串行口2 的中断门向量(硬件IRQ3 信号)。
	init (tty_table[1].read_q.data);	// 初始化串行口1(.data 是端口号)。
	init (tty_table[2].read_q.data);	// 初始化串行口2。
	outb (inb_p (0x21) & 0xE7, 0x21);	// 允许主8259A 芯片的IRQ3,IRQ4 中断信号请求。
}
开发者ID:TakiJoe,项目名称:kernel-0.11,代码行数:10,代码来源:serial.c

示例8: setup_idt

static void setup_idt(void)
{
	for (int i = 0; i < EXCEPTION_GATES; i ++)
		set_intr_gate(i, &idt_exception_stubs[i]);

	set_intr_gate(HALT_CPU_IPI_VECTOR, halt_cpu_ipi_handler);

	load_idt(&idtdesc);
}
开发者ID:a-darwish,项目名称:cuteOS,代码行数:9,代码来源:main.c

示例9: traps_init

void traps_init(void)
{
	int i;

	for (i = 0; i < VALID_ISR+2; ++i)
		set_intr_gate(i, (unsigned int)isr_table[(i << 1) + 1]);
	for (; i < 256; ++i)
		set_intr_gate(i, (unsigned int)isr_table[(i << 1) + 1]);
}
开发者ID:blessed,项目名称:blessOS,代码行数:9,代码来源:exceptions.c

示例10: native_init_IRQ

void __init native_init_IRQ(void)
{
	int i;

	/* Execute any quirks before the call gates are initialised: */
	/* 这里又是执行x86_init结构中的初始化函数,pre_vector_init()指向 init_ISA_irqs  */
	x86_init.irqs.pre_vector_init();

	/* 初始化中断描述符表中的中断控制器中特定的一些中断门初始化 */
	apic_intr_init();

	/*
	 * Cover the whole vector space, no vector can escape
	 * us. (some of these will be overridden and become
	 * 'special' SMP interrupts)
	 */
	/* 第一个外部中断,默认是32 */
	i = FIRST_EXTERNAL_VECTOR;
	/* 在used_vectors变量中找出所有没有置位的中断向量,我们知道,在trap_init()中对所有异常和陷阱和系统调用中断都置位了used_vectors,没有置位的都为中断
	 * 这里就是对所有中断设置门描述符
	 */
	for_each_clear_bit_from(i, used_vectors, NR_VECTORS) {
		/* IA32_SYSCALL_VECTOR could be used in trap_init already. */
		/* interrupt[]数组保存的是外部中断的中断门信息
		 * 这里就是将空闲的中断设置为外部中断,interrupt是一个函数指针数组,其将31~255数组元素指向common_interrupt函数
		 */
		set_intr_gate(i, interrupt[i - FIRST_EXTERNAL_VECTOR]);
	}
开发者ID:tolimit,项目名称:linux-comment-cn,代码行数:28,代码来源:irqinit.c

示例11: free_irq

void free_irq(unsigned int irq)
{
	struct irqaction * action = irq + irq_action;
	unsigned long flags;

	if (irq > 15) {
		printk("Trying to free IRQ%d\n",irq);
		return;
	}
	if (!action->handler) {
		printk("Trying to free free IRQ%d\n",irq);
		return;
	}
	save_flags(flags);
	cli();
	if (irq < 8) {
		cache_21 |= 1 << irq;
		outb(cache_21,0x21);
	} else {
		cache_A1 |= 1 << (irq-8);
		outb(cache_A1,0xA1);
	}
	set_intr_gate(0x20+irq,bad_interrupt[irq]);
	action->handler = NULL;
	action->flags = 0;
	action->mask = 0;
	action->name = NULL;
	restore_flags(flags);
}
开发者ID:TaoAndHua,项目名称:linux-1.2.13,代码行数:29,代码来源:irq.c

示例12: free_irq

void free_irq(unsigned int irq)
{
	struct sigaction * sa = irq + irq_sigaction;
	unsigned long flags;

	if (irq > 15) {
		printk("Trying to free IRQ%d\n",irq);
		return;
	}
	if (!sa->sa_mask) {
		printk("Trying to free free IRQ%d\n",irq);
		return;
	}
	save_flags(flags);
	cli();
	if (irq < 8) {
		cache_21 |= 1 << irq;
		outb(cache_21,0x21);
	} else {
		cache_A1 |= 1 << (irq-8);
		outb(cache_A1,0xA1);
	}
	set_intr_gate(0x20+irq,bad_interrupt[irq]);
	sa->sa_handler = NULL;
	sa->sa_flags = 0;
	sa->sa_mask = 0;
	sa->sa_restorer = NULL;
	restore_flags(flags);
}
开发者ID:wanggx,项目名称:Linux1.0,代码行数:29,代码来源:irq.c

示例13: smp_intr_init

static void __init smp_intr_init(void)
{
#ifdef CONFIG_SMP
	/*
	 * The reschedule interrupt is a CPU-to-CPU reschedule-helper
	 * IPI, driven by wakeup.
	 */
	alloc_intr_gate(RESCHEDULE_VECTOR, reschedule_interrupt);

	/* IPIs for invalidation */
	alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+0, invalidate_interrupt0);
	alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+1, invalidate_interrupt1);
	alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+2, invalidate_interrupt2);
	alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+3, invalidate_interrupt3);
	alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+4, invalidate_interrupt4);
	alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+5, invalidate_interrupt5);
	alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+6, invalidate_interrupt6);
	alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+7, invalidate_interrupt7);

	/* IPI for generic function call */
	alloc_intr_gate(CALL_FUNCTION_VECTOR, call_function_interrupt);

	/* IPI for generic single function call */
	alloc_intr_gate(CALL_FUNCTION_SINGLE_VECTOR,
			call_function_single_interrupt);

	/* Low priority IPI to cleanup after moving an irq */
	set_intr_gate(IRQ_MOVE_CLEANUP_VECTOR, irq_move_cleanup_interrupt);
	set_bit(IRQ_MOVE_CLEANUP_VECTOR, used_vectors);
#endif
}
开发者ID:10x-Amin,项目名称:x10_Th_kernel,代码行数:31,代码来源:irqinit_64.c

示例14: x86_64_start_kernel

void __init x86_64_start_kernel(char * real_mode_data)
{
	int i;

	/* clear bss before set_intr_gate with early_idt_handler */
	clear_bss();

	/* Make NULL pointers segfault */
	zap_identity_mappings();

	for (i = 0; i < IDT_ENTRIES; i++)
		set_intr_gate(i, early_idt_handler);
	load_idt((const struct desc_ptr *)&idt_descr);

	early_printk("Kernel alive\n");

 	for (i = 0; i < NR_CPUS; i++)
 		cpu_pda(i) = &boot_cpu_pda[i];

	pda_init(0);
	copy_bootdata(__va(real_mode_data));
#ifdef CONFIG_SMP
	cpu_set(0, cpu_online_map);
#endif
	start_kernel();
}
开发者ID:AmesianX,项目名称:winkvm,代码行数:26,代码来源:head64.c

示例15: native_init_IRQ

void __init native_init_IRQ(void)
{
	int i;

	/* Execute any quirks before the call gates are initialised: */
	x86_init.irqs.pre_vector_init();

	apic_intr_init();

	/*
	 * Cover the whole vector space, no vector can escape
	 * us. (some of these will be overridden and become
	 * 'special' SMP interrupts)
	 */
	for (i = FIRST_EXTERNAL_VECTOR; i < NR_VECTORS; i++) {
		/* IA32_SYSCALL_VECTOR could be used in trap_init already. */
		if (!test_bit(i, used_vectors))
			set_intr_gate(i, interrupt[i-FIRST_EXTERNAL_VECTOR]);
	}

	if (!acpi_ioapic && !of_ioapic)
		setup_irq(2, &irq2);

#ifdef CONFIG_X86_32
	/*
	 * 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());
#endif
}
开发者ID:WhiteBearSolutions,项目名称:WBSAirback,代码行数:34,代码来源:irqinit.c


注:本文中的set_intr_gate函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。