rulimine/common/sys/idt.h

60 lines
892 B
C
Raw Normal View History

2021-03-13 05:21:01 +03:00
#ifndef __SYS__IDT_H__
#define __SYS__IDT_H__
#include <stdint.h>
#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));
#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
enum {
IRQ_NO_FLUSH,
IRQ_PIC_ONLY_FLUSH,
IRQ_PIC_APIC_FLUSH
};
extern int irq_flush_type;
void init_flush_irqs(void);
void flush_irqs(void);
2021-03-13 05:21:01 +03:00
#endif