Пример #1
0
void handle_interrupt() {
	uint8_t scan_code = kbd_read();
	char character = kbd_scan_code_to_ascii(scan_code);
    char message2[2] = { character, '\0' };
    write(message2);
    pic_acknowledge();
}
Пример #2
0
static void interrupt_acknowledge(int i) {
    if (i < 32) {
        /* do nothing */
    } else {
        pic_acknowledge(i - 32);
    }
}
Пример #3
0
static void scheduler_handle_pit_interrupt(cpu_state_t cpu, idt_info_t info,
                                           stack_state_t stack)
{
    UNUSED_ARGUMENT(info);
    ms += SCHEDULER_PIT_INTERVAL;

    if (ms >= SCHEDULER_TIME_SLICE) {
        ms = 0;
        scheduler_schedule_on_intterupt(&cpu, &stack);
    } else {
        pic_acknowledge();
    }
}
Пример #4
0
/* Called from our ASM interrupt handler stub */
void irq_handler(struct registers_t regs) {
	if (regs.int_no != 32 && regs.int_no != 33) {
		debug("isr", "Calling isr_handler() for IRQ %d!", regs.int_no - 32);
	}

	/* Send an EOI (end of interrupt) signal to the PICs. */
	pic_acknowledge(regs.int_no);

    if (irq_handlers[regs.int_no] != 0) {
        isr_t handler = irq_handlers[regs.int_no];
        handler(&regs);
    }
}
Пример #5
0
void trap_irq5(void)
{
	debug_set_lights(0x07);

	isr_spinlock_lock(&dev_isr_lock);

	pic_acknowledge(5);
	
	debug_check_stack(0x100);
	
	isr_context_signal(dev_isr_ctx);

	isr_spinlock_unlock(&dev_isr_lock);
}
Пример #6
0
static void scheduler_schedule_on_intterupt(cpu_state_t const *cpu,
                                            stack_state_t const *stack)
{
    disable_interrupts();
    ps_t *ps = scheduler_get_current_process();
    if (stack->cs == (SEGSEL_USER_SPACE_CS | 0x03)) {
        scheduler_update_user_registers(ps, cpu, stack);
    } else {
        scheduler_update_kernel_registers(ps, cpu, stack);
    }

    pic_acknowledge();

    scheduler_schedule();
}
Пример #7
0
// Name: interrupt_request_handler
// Description: This function is interrupt request handler for the PIC interrupts.
// Parameter: state - This has the cpu and stack state information at the time of interrupt occurance
// Return: -
void interrupt_request_handler(struct cpu_stack_state state)
{
	//puts("Enterred interrupt request handler\n", 35 );
	void (*irqHandler)(struct cpu_stack_state);

	//puts(interrupt_messags[state.interrupt_no], 32);
	//putc(state.interrupt_no+'0');

	irqHandler = irq_handlers[state.interrupt_no - 32];

	if(irqHandler != 0)
		irqHandler(state);

	pic_acknowledge(state.interrupt_no);

	//puts("Leaving interrupt request handler\n", 34);
}
Пример #8
0
/*
 * trap_irq0()
 */
void trap_irq0(void)
{
	debug_set_lights(0x03);
(*((u8_t *)0xb8000 + 140))++;
	
	isr_spinlock_lock(&timer_isr_lock);

	pic_acknowledge(IRQ_TIMER);
				
	isr_ticks++;

	debug_check_stack(0x100);

	ldavg_runnable = isr_thread_get_run_queue_len();
			
	isr_context_signal(timer_isr_ctx);

	isr_spinlock_unlock(&timer_isr_lock);

	/*
	 * Check if we need to re-schedule.
	 */
	isr_thread_schedule();
}