diff --git a/exit.c b/exit.c index 27e1b88..d4e7c79 100644 --- a/exit.c +++ b/exit.c @@ -2084,17 +2084,11 @@ static inline void vcpu_sync_idt(struct vcpu *vcpu, struct gdtr *idt) * entries that we set, by simply just discarding them. */ size_t entries = min((size_t)idt->limit, (PAGE_SIZE - 1)) / sizeof(struct kidt_entry64); - struct kidt_entry64 *current_idt; + struct kidt_entry64 current_idt[256]; struct kidt_entry64 *shadow = (struct kidt_entry64 *)vcpu->idt.base; - current_idt = mm_alloc_page(); - if (!current_idt) - return; - - if (!ksm_read_virt(vcpu, idt->base, (u8 *)current_idt, idt->limit)) { - mm_free_pool(current_idt, PAGE_SIZE); + if (!ksm_read_virt(vcpu, idt->base, (u8 *)current_idt, idt->limit)) return vcpu_inject_pf(vcpu, idt->base, PGF_PRESENT); - } KSM_DEBUG("Loading new IDT (new size: %d old size: %d) Copying %d entries\n", idt->limit, vcpu->idt.limit, (int)entries); @@ -2105,7 +2099,6 @@ static inline void vcpu_sync_idt(struct vcpu *vcpu, struct gdtr *idt) if (!idte_present(&vcpu->shadow_idt[n])) memcpy(&shadow[n], ¤t_idt[n], sizeof(*shadow)); vcpu_flush_idt(vcpu); - mm_free_page(current_idt); } static bool vcpu_handle_gdt_idt_access(struct vcpu *vcpu)