2015-08-17 16:41:38 +00:00
|
|
|
#ifndef ISR_H
|
|
|
|
#define ISR_H
|
|
|
|
|
2015-08-18 08:31:28 +00:00
|
|
|
#include <stdint.h>
|
2015-08-17 16:41:38 +00:00
|
|
|
|
|
|
|
/* ISRs reserved for CPU exceptions */
|
|
|
|
extern void isr0();
|
|
|
|
extern void isr1();
|
|
|
|
extern void isr2();
|
|
|
|
extern void isr3();
|
|
|
|
extern void isr4();
|
|
|
|
extern void isr5();
|
|
|
|
extern void isr6();
|
|
|
|
extern void isr7();
|
|
|
|
extern void isr8();
|
|
|
|
extern void isr9();
|
|
|
|
extern void isr10();
|
|
|
|
extern void isr11();
|
|
|
|
extern void isr12();
|
|
|
|
extern void isr13();
|
|
|
|
extern void isr14();
|
|
|
|
extern void isr15();
|
|
|
|
extern void isr16();
|
|
|
|
extern void isr17();
|
|
|
|
extern void isr18();
|
|
|
|
extern void isr19();
|
|
|
|
extern void isr20();
|
|
|
|
extern void isr21();
|
|
|
|
extern void isr22();
|
|
|
|
extern void isr23();
|
|
|
|
extern void isr24();
|
|
|
|
extern void isr25();
|
|
|
|
extern void isr26();
|
|
|
|
extern void isr27();
|
|
|
|
extern void isr28();
|
|
|
|
extern void isr29();
|
|
|
|
extern void isr30();
|
|
|
|
extern void isr31();
|
|
|
|
/* IRQ definitions */
|
|
|
|
extern void irq0();
|
|
|
|
extern void irq1();
|
|
|
|
extern void irq2();
|
|
|
|
extern void irq3();
|
|
|
|
extern void irq4();
|
|
|
|
extern void irq5();
|
|
|
|
extern void irq6();
|
|
|
|
extern void irq7();
|
|
|
|
extern void irq8();
|
|
|
|
extern void irq9();
|
|
|
|
extern void irq10();
|
|
|
|
extern void irq11();
|
|
|
|
extern void irq12();
|
|
|
|
extern void irq13();
|
|
|
|
extern void irq14();
|
|
|
|
extern void irq15();
|
|
|
|
|
|
|
|
#define IRQ0 32
|
|
|
|
#define IRQ1 33
|
|
|
|
#define IRQ2 34
|
|
|
|
#define IRQ3 35
|
|
|
|
#define IRQ4 36
|
|
|
|
#define IRQ5 37
|
|
|
|
#define IRQ6 38
|
|
|
|
#define IRQ7 39
|
|
|
|
#define IRQ8 40
|
|
|
|
#define IRQ9 41
|
|
|
|
#define IRQ10 42
|
|
|
|
#define IRQ11 43
|
|
|
|
#define IRQ12 44
|
|
|
|
#define IRQ13 45
|
|
|
|
#define IRQ14 46
|
|
|
|
#define IRQ15 47
|
|
|
|
|
2015-08-28 08:52:05 +00:00
|
|
|
/* Struct which aggregates many registers.
|
|
|
|
* It matches exactly the pushes on interrupt.asm. From the bottom:
|
|
|
|
* - Pushed by the processor automatically
|
|
|
|
* - `push byte`s on the isr-specific code: error code, then int number
|
|
|
|
* - All the registers by pusha
|
|
|
|
* - `push eax` whose lower 16-bits contain DS
|
|
|
|
*/
|
2015-08-17 16:41:38 +00:00
|
|
|
typedef struct {
|
2015-08-18 08:31:28 +00:00
|
|
|
uint32_t ds; /* Data segment selector */
|
2015-08-18 09:44:24 +00:00
|
|
|
uint32_t edi, esi, ebp, useless, ebx, edx, ecx, eax; /* Pushed by pusha. */
|
2015-08-18 08:31:28 +00:00
|
|
|
uint32_t int_no, err_code; /* Interrupt number and error code (if applicable) */
|
2015-08-18 09:44:24 +00:00
|
|
|
uint32_t eip, cs, eflags, esp, ss; /* Pushed by the processor automatically */
|
2015-08-17 16:41:38 +00:00
|
|
|
} registers_t;
|
|
|
|
|
|
|
|
void isr_install();
|
2015-08-28 08:52:05 +00:00
|
|
|
void isr_handler(registers_t *r);
|
2015-08-17 16:41:38 +00:00
|
|
|
void irq_install();
|
|
|
|
|
2015-08-28 08:52:05 +00:00
|
|
|
typedef void (*isr_t)(registers_t*);
|
2015-08-18 08:31:28 +00:00
|
|
|
void register_interrupt_handler(uint8_t n, isr_t handler);
|
2015-08-17 16:41:38 +00:00
|
|
|
|
|
|
|
#endif
|