diff --git a/hypervisor/arch/x86/irq.c b/hypervisor/arch/x86/irq.c index 91193c59a..4158c0459 100644 --- a/hypervisor/arch/x86/irq.c +++ b/hypervisor/arch/x86/irq.c @@ -480,16 +480,16 @@ void init_default_irqs(uint16_t cpu_id) static inline void fixup_idt(const struct host_idt_descriptor *idtd) { uint32_t i; - union idt_64_descriptor *idt_desc = (union idt_64_descriptor *)idtd->idt; + struct idt_64_descriptor *idt_desc = idtd->idt->host_idt_descriptors; uint32_t entry_hi_32, entry_lo_32; for (i = 0U; i < HOST_IDT_ENTRIES; i++) { - entry_lo_32 = idt_desc[i].fields.offset_63_32; - entry_hi_32 = idt_desc[i].fields.rsvd; - idt_desc[i].fields.rsvd = 0U; - idt_desc[i].fields.offset_63_32 = entry_hi_32; - idt_desc[i].fields.high32.bits.offset_31_16 = entry_lo_32 >> 16U; - idt_desc[i].fields.low32.bits.offset_15_0 = entry_lo_32 & 0xffffUL; + entry_lo_32 = idt_desc[i].offset_63_32; + entry_hi_32 = idt_desc[i].rsvd; + idt_desc[i].rsvd = 0U; + idt_desc[i].offset_63_32 = entry_hi_32; + idt_desc[i].high32.bits.offset_31_16 = entry_lo_32 >> 16U; + idt_desc[i].low32.bits.offset_15_0 = entry_lo_32 & 0xffffUL; } } diff --git a/hypervisor/include/arch/x86/idt.h b/hypervisor/include/arch/x86/idt.h index 9858df54d..2295b724f 100644 --- a/hypervisor/include/arch/x86/idt.h +++ b/hypervisor/include/arch/x86/idt.h @@ -19,33 +19,30 @@ /* * Definition of an 16 byte IDT selector. */ -union idt_64_descriptor { - uint64_t value; - struct { - union { - uint32_t value; - struct { - uint32_t offset_15_0:16; - uint32_t seg_sel:16; - } bits; - } low32; - union { - uint32_t value; - struct { - uint32_t ist:3; - uint32_t bit_3_clr:1; - uint32_t bit_4_clr:1; - uint32_t bits_5_7_clr:3; - uint32_t type:4; - uint32_t bit_12_clr:1; - uint32_t dpl:2; - uint32_t present:1; - uint32_t offset_31_16:16; - } bits; - } high32; - uint32_t offset_63_32; - uint32_t rsvd; - } fields; +struct idt_64_descriptor { + union { + uint32_t value; + struct { + uint32_t offset_15_0:16; + uint32_t seg_sel:16; + } bits; + } low32; + union { + uint32_t value; + struct { + uint32_t ist:3; + uint32_t bit_3_clr:1; + uint32_t bit_4_clr:1; + uint32_t bits_5_7_clr:3; + uint32_t type:4; + uint32_t bit_12_clr:1; + uint32_t dpl:2; + uint32_t present:1; + uint32_t offset_31_16:16; + } bits; + } high32; + uint32_t offset_63_32; + uint32_t rsvd; } __aligned(8); /***************************************************************************** @@ -54,7 +51,7 @@ union idt_64_descriptor { * *****************************************************************************/ struct host_idt { - union idt_64_descriptor host_idt_descriptors[HOST_IDT_ENTRIES]; + struct idt_64_descriptor host_idt_descriptors[HOST_IDT_ENTRIES]; } __aligned(8); /*