added div error ISR...

merge-requests/1/head
_xeroxz 4 years ago
parent a475ced8b9
commit a891f907f1

@ -49,6 +49,7 @@ auto drv_entry(PDRIVER_OBJECT driver_object, PUNICODE_STRING registry_path) -> N
// change gp, pf, and de to vmxroot handlers... // change gp, pf, and de to vmxroot handlers...
idt::table[general_protection] = idt::create_entry(hv::idt_addr_t{ __gp_handler }, idt::ist_idx::gp); idt::table[general_protection] = idt::create_entry(hv::idt_addr_t{ __gp_handler }, idt::ist_idx::gp);
idt::table[page_fault] = idt::create_entry(hv::idt_addr_t{ __pf_handler }, idt::ist_idx::pf); idt::table[page_fault] = idt::create_entry(hv::idt_addr_t{ __pf_handler }, idt::ist_idx::pf);
idt::table[divide_error] = idt::create_entry(hv::idt_addr_t{ __de_handler }, idt::ist_idx::de);
// used for SEH in vmxroot fault handler... // used for SEH in vmxroot fault handler...
idt::image_base = driver_object->DriverStart; idt::image_base = driver_object->DriverStart;

@ -6,6 +6,7 @@
#pragma section(".idt", read, write) #pragma section(".idt", read, write)
extern "C" void __gp_handler(void); extern "C" void __gp_handler(void);
extern "C" void __pf_handler(void); extern "C" void __pf_handler(void);
extern "C" void __de_handler(void);
extern "C" void seh_handler(hv::pidt_regs_t regs); extern "C" void seh_handler(hv::pidt_regs_t regs);
namespace idt namespace idt

@ -1,6 +1,7 @@
extern seh_handler : proc extern seh_handler : proc
.code .code
__de_handler proc
__pf_handler proc __pf_handler proc
__gp_handler proc __gp_handler proc
push rax push rax
@ -80,4 +81,5 @@ __gp_handler proc
iretq iretq
__gp_handler endp __gp_handler endp
__pf_handler endp __pf_handler endp
__de_handler endp
end end

@ -50,8 +50,6 @@ namespace vmcs
tr.request_privilege_level = NULL; tr.request_privilege_level = NULL;
tr.table = NULL; tr.table = NULL;
__vmx_vmwrite(VMCS_HOST_TR_SELECTOR, tr.flags); __vmx_vmwrite(VMCS_HOST_TR_SELECTOR, tr.flags);
} }
auto setup_guest() -> void auto setup_guest() -> void

@ -29,6 +29,10 @@ auto vmxlaunch::init_vmcs(cr3 cr3_value) -> void
reinterpret_cast<u64>(ExAllocatePool(NonPagedPool, reinterpret_cast<u64>(ExAllocatePool(NonPagedPool,
PAGE_SIZE * HOST_STACK_PAGES)) + (PAGE_SIZE * HOST_STACK_PAGES); PAGE_SIZE * HOST_STACK_PAGES)) + (PAGE_SIZE * HOST_STACK_PAGES);
vcpu->tss.interrupt_stack_table[idt::ist_idx::de] =
reinterpret_cast<u64>(ExAllocatePool(NonPagedPool,
PAGE_SIZE * HOST_STACK_PAGES)) + (PAGE_SIZE * HOST_STACK_PAGES);
vcpu->gdt[segment_selector{ readtr() }.idx].base_address_upper = tss.upper; vcpu->gdt[segment_selector{ readtr() }.idx].base_address_upper = tss.upper;
vcpu->gdt[segment_selector{ readtr() }.idx].base_address_high = tss.high; vcpu->gdt[segment_selector{ readtr() }.idx].base_address_high = tss.high;
vcpu->gdt[segment_selector{ readtr() }.idx].base_address_middle = tss.middle; vcpu->gdt[segment_selector{ readtr() }.idx].base_address_middle = tss.middle;

Loading…
Cancel
Save