2021-03-13 05:21:01 +03:00
|
|
|
#ifndef __SYS__IDT_H__
|
|
|
|
#define __SYS__IDT_H__
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
2021-09-21 18:28:32 +03:00
|
|
|
#if defined (__i386__)
|
2021-03-13 05:21:01 +03:00
|
|
|
|
|
|
|
struct idtr {
|
|
|
|
uint16_t limit;
|
|
|
|
uint32_t ptr;
|
|
|
|
} __attribute__((packed));
|
|
|
|
|
|
|
|
struct idt_entry {
|
|
|
|
uint16_t offset_lo;
|
|
|
|
uint16_t selector;
|
|
|
|
uint8_t unused;
|
|
|
|
uint8_t type_attr;
|
|
|
|
uint16_t offset_hi;
|
|
|
|
} __attribute__((packed));
|
|
|
|
|
2021-09-21 18:28:32 +03:00
|
|
|
#elif defined (__x86_64__)
|
|
|
|
|
|
|
|
struct idtr {
|
|
|
|
uint16_t limit;
|
|
|
|
uint64_t ptr;
|
|
|
|
} __attribute__((packed));
|
|
|
|
|
|
|
|
struct idt_entry {
|
|
|
|
uint16_t offset_lo;
|
|
|
|
uint16_t selector;
|
|
|
|
uint8_t ist;
|
|
|
|
uint8_t type_attr;
|
|
|
|
uint16_t offset_mid;
|
|
|
|
uint32_t offset_hi;
|
|
|
|
uint32_t reserved;
|
|
|
|
} __attribute__((packed));
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if bios == 1
|
|
|
|
|
2021-03-13 05:21:01 +03:00
|
|
|
extern struct idtr idt;
|
|
|
|
|
|
|
|
void init_idt(void);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2021-09-22 13:33:56 +03:00
|
|
|
enum {
|
|
|
|
IRQ_NO_FLUSH,
|
|
|
|
IRQ_PIC_ONLY_FLUSH,
|
|
|
|
IRQ_PIC_APIC_FLUSH
|
|
|
|
};
|
|
|
|
|
|
|
|
extern int irq_flush_type;
|
|
|
|
|
2021-09-21 18:28:32 +03:00
|
|
|
void init_flush_irqs(void);
|
|
|
|
void flush_irqs(void);
|
|
|
|
|
2021-03-13 05:21:01 +03:00
|
|
|
#endif
|