#pragma once
#include <stdint.h>

#define IDT_TA_InterruptGate 0b10001110
#define IDT_TA_CallGate      0b10001100
#define IDT_TA_TrapGate      0b10001111

struct IDTDescEntry {
	uint16_t offset0; // lower 16 bits of offset
	uint16_t selector; // segment selector
	uint8_t ist; // interrupt stack table offset
	uint8_t type_attr; // interrupt gate, trap gate, etc...
	uint16_t offset1; // upper 16 bits of offset
	uint32_t offset2; // upper 32 bits of offset
	uint32_t ignore; // unused

	void SetOffset(uint64_t offset);
	uint64_t GetOffset();
};

struct IDTR {
	uint16_t Limit;
	uint64_t Offset;
}__attribute__((packed));