#ifndef _VISOR_IDT_H_ #define _VISOR_IDT_H_ #include __attribute__ ((packed)) struct intdescr { uint16_t offset0; uint16_t seg; uint8_t ist; uint8_t access; uint16_t offset1; uint32_t offset2; uint32_t reserved; }; __attribute__ ((packed)) struct IDTR { uint16_t limit; uint64_t base; }; static inline struct IDTR storeidt(void) { struct IDTR idtr; __asm__ ("sidt %0\n\t" : "=m"(idtr)); return idtr; } static inline void setintdescr(struct intdescr *descr, uint64_t offset, uint16_t seg, uint8_t ist, uint8_t access) { descr->offset0 = offset; descr->seg = seg; descr->ist = ist; descr->access = access; descr->offset1 = offset >> 16; descr->offset2 = offset >> 32; descr->reserved = 0; } #endif