X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fgeekos%2Fsvm_handler.c;fp=palacios%2Fsrc%2Fgeekos%2Fsvm_handler.c;h=ea2a7b874feeec6420aaf4cc1eb2d80344549be5;hb=158640d601f6c710cfce7bc4a6bd8f7e7847b7a3;hp=0000000000000000000000000000000000000000;hpb=04fc4c8fbac29e04f0d0817a2906687c2c972559;p=palacios.releases.git diff --git a/palacios/src/geekos/svm_handler.c b/palacios/src/geekos/svm_handler.c new file mode 100644 index 0000000..ea2a7b8 --- /dev/null +++ b/palacios/src/geekos/svm_handler.c @@ -0,0 +1,59 @@ +#include +#include + + + + +int handle_svm_exit(guest_info_t * info) { + vmcb_ctrl_t * guest_ctrl = 0; + vmcb_saved_state_t * guest_state = 0; + ulong_t exit_code = 0; + + guest_ctrl = GET_VMCB_CTRL_AREA((vmcb_t*)(info->vmm_data)); + guest_state = GET_VMCB_SAVE_STATE_AREA((vmcb_t*)(info->vmm_data)); + + PrintDebug("SVM Returned: (Exit Code=%x) (VMCB=%x)\n",&(guest_ctrl->exit_code), info->vmm_data); + PrintDebug("RIP: %x\n", guest_state->rip); + + + exit_code = guest_ctrl->exit_code; + + // PrintDebugVMCB((vmcb_t*)(info->vmm_data)); + PrintDebug("SVM Returned: Exit Code: %x\n",exit_code); + PrintDebug("io_info1 low = 0x%.8x\n", *(uint_t*)&(guest_ctrl->exit_info1)); + PrintDebug("io_info1 high = 0x%.8x\n", *(uint_t *)(((uchar_t *)&(guest_ctrl->exit_info1)) + 4)); + + PrintDebug("io_info2 low = 0x%.8x\n", *(uint_t*)&(guest_ctrl->exit_info2)); + PrintDebug("io_info2 high = 0x%.8x\n", *(uint_t *)(((uchar_t *)&(guest_ctrl->exit_info2)) + 4)); + if (exit_code == VMEXIT_IOIO) { + handle_svm_io(info); + } + + + return 0; +} + + + +// This should package up an IO request and call vmm_handle_io +int handle_svm_io(guest_info_t * info) { + vmcb_ctrl_t * ctrl_area = GET_VMCB_CTRL_AREA((vmcb_t *)(info->vmm_data)); + vmcb_saved_state_t * guest_state = GET_VMCB_SAVE_STATE_AREA((vmcb_t*)(info->vmm_data)); + + PrintDebug("Ctrl Area=%x\n", ctrl_area); + + // struct svm_io_info * io_info = (struct svm_io_info *)&(ctrl_area->exit_info1); + + + + // PrintDebugVMCB((vmcb_t*)(info->vmm_data)); + + guest_state->rip = ctrl_area->exit_info2; + + + + + // PrintDebug("Exit On Port %d\n", io_info->port); + + return 0; +}