From: Peter Dinda Date: Wed, 16 Nov 2011 17:10:50 +0000 (-0600) Subject: Merge branch 'devel' of newskysaw.cs.northwestern.edu:/home/palacios/palacios into... X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=commitdiff_plain;h=5e3bb26339e3a3ca09c057b28ab24463669053c8;hp=bcab692b40b809c628eb365c199ffd3c757a6cc7 Merge branch 'devel' of newskysaw.cs.northwestern.edu:/home/palacios/palacios into devel --- diff --git a/palacios/src/palacios/svm_io.c b/palacios/src/palacios/svm_io.c index e273466..4ad954d 100644 --- a/palacios/src/palacios/svm_io.c +++ b/palacios/src/palacios/svm_io.c @@ -80,11 +80,10 @@ int v3_handle_svm_io_in(struct guest_info * core, struct svm_io_info * io_info) PrintDebug("IN of %d bytes on port %d (0x%x)\n", read_size, io_info->port, io_info->port); if (hook == NULL) { - PrintDebug("IN operation on unhooked IO port 0x%x\n", io_info->port); + PrintDebug("IN operation on unhooked IO port 0x%x - returning zero\n", io_info->port); + core->vm_regs.rax >>= 8*read_size; + core->vm_regs.rax <<= 8*read_size; - /* What are the HW semantics for an IN on an invalid port? - * Do we need to clear the register value or leave it untouched??? - */ } else { if (hook->read(core, io_info->port, &(core->vm_regs.rax), read_size, hook->priv_data) != read_size) { // not sure how we handle errors..... @@ -207,10 +206,9 @@ int v3_handle_svm_io_ins(struct guest_info * core, struct svm_io_info * io_info) } if (hook == NULL) { - PrintDebug("INS operation on unhooked IO port 0x%x\n", io_info->port); - /* What are the HW semantics for an INS on an invalid port? - * Do we need to clear the memory region or leave it untouched??? - */ + PrintDebug("INS operation on unhooked IO port 0x%x - returning zeros\n", io_info->port); + memset((char*)host_addr,0,read_size); + } else { if (hook->read(core, io_info->port, (char *)host_addr, read_size, hook->priv_data) != read_size) { // not sure how we handle errors..... @@ -246,7 +244,7 @@ int v3_handle_svm_io_out(struct guest_info * core, struct svm_io_info * io_info) PrintDebug("OUT of %d bytes on port %d (0x%x)\n", write_size, io_info->port, io_info->port); if (hook == NULL) { - PrintDebug("OUT operation on unhooked IO port 0x%x\n", io_info->port); + PrintDebug("OUT operation on unhooked IO port 0x%x - ignored\n", io_info->port); } else { if (hook->write(core, io_info->port, &(core->vm_regs.rax), write_size, hook->priv_data) != write_size) { // not sure how we handle errors..... @@ -365,7 +363,7 @@ int v3_handle_svm_io_outs(struct guest_info * core, struct svm_io_info * io_info } if (hook == NULL) { - PrintDebug("OUTS operation on unhooked IO port 0x%x\n", io_info->port); + PrintDebug("OUTS operation on unhooked IO port 0x%x - ignored\n", io_info->port); } else { if (hook->write(core, io_info->port, (char*)host_addr, write_size, hook->priv_data) != write_size) { // not sure how we handle errors..... diff --git a/palacios/src/palacios/vmm.c b/palacios/src/palacios/vmm.c index 5420759..855b11c 100644 --- a/palacios/src/palacios/vmm.c +++ b/palacios/src/palacios/vmm.c @@ -317,6 +317,7 @@ int v3_start_vm(struct v3_vm_info * vm, unsigned int cpu_mask) { PrintDebug("run: core=%u, func=0x%p, arg=0x%p, name=%s\n", core_idx, start_core, core, core->exec_name); + core->core_run_state = CORE_STOPPED; // core zero will turn itself on core->pcpu_id = core_idx; core->core_thread = V3_CREATE_THREAD_ON_CPU(core_idx, start_core, core, core->exec_name); diff --git a/palacios/src/palacios/vmm_msr.c b/palacios/src/palacios/vmm_msr.c index bb1b062..4163145 100644 --- a/palacios/src/palacios/vmm_msr.c +++ b/palacios/src/palacios/vmm_msr.c @@ -104,12 +104,15 @@ int v3_handle_msr_read(struct guest_info * info) { int v3_msr_unhandled_read(struct guest_info * core, uint32_t msr, struct v3_msr * dst, void * priv_data) { - V3_Print("Palacios: Unhandled MSR Read (MSR=0x%x)\n", msr); + V3_Print("Palacios: Unhandled MSR Read (MSR=0x%x) - returning zero\n", msr); + dst->lo=dst->hi=0; + // should produce GPF for unsupported msr return 0; } int v3_msr_unhandled_write(struct guest_info * core, uint32_t msr, struct v3_msr src, void * priv_data) { - V3_Print("Palacios: Unhandled MSR Write (MSR=0x%x)\n", msr); + V3_Print("Palacios: Unhandled MSR Write (MSR=0x%x) - ignored\n", msr); + // should produce GPF for unsupported msr return 0; } diff --git a/palacios/src/palacios/vmx_io.c b/palacios/src/palacios/vmx_io.c index 9b02a0a..46de7ca 100644 --- a/palacios/src/palacios/vmx_io.c +++ b/palacios/src/palacios/vmx_io.c @@ -75,11 +75,10 @@ int v3_handle_vmx_io_in(struct guest_info * core, struct vmx_exit_info * exit_in PrintDebug("IN of %d bytes on port %d (0x%x)\n", read_size, io_qual.port, io_qual.port); if (hook == NULL) { - PrintDebug("IN operation on unhooked IO port 0x%x\n", io_qual.port); + PrintDebug("IN operation on unhooked IO port 0x%x - returning zeros\n", io_qual.port); + core->vm_regs.rax >>= 8*read_size; + core->vm_regs.rax <<= 8*read_size; - /* What are the HW semantics for an IN on an invalid port? - * Do we need to clear the register value or leave it untouched??? - */ } else { if (hook->read(core, io_qual.port, &(core->vm_regs.rax), read_size, hook->priv_data) != read_size) { PrintError("Read failure for IN on port %x\n", io_qual.port); @@ -143,11 +142,10 @@ int v3_handle_vmx_io_ins(struct guest_info * core, struct vmx_exit_info * exit_i do { if (hook == NULL) { - PrintDebug("INS operation on unhooked IO port 0x%x\n", io_qual.port); + PrintDebug("INS operation on unhooked IO port 0x%x - returning zeros\n", io_qual.port); - /* What are the HW semantics for an INS on an invalid port? - * Do we need to clear the memory region or leave it untouched??? - */ + memset((char*)host_addr,0,read_size); + } else { if (hook->read(core, io_qual.port, (char *)host_addr, read_size, hook->priv_data) != read_size) { PrintError("Read Failure for INS on port 0x%x\n", io_qual.port); @@ -186,7 +184,7 @@ int v3_handle_vmx_io_out(struct guest_info * core, struct vmx_exit_info * exit_i PrintDebug("OUT of %d bytes on port %d (0x%x)\n", write_size, io_qual.port, io_qual.port); if (hook == NULL) { - PrintDebug("OUT operation on unhooked IO port 0x%x\n", io_qual.port); + PrintDebug("OUT operation on unhooked IO port 0x%x - ignored\n", io_qual.port); } else { if (hook->write(core, io_qual.port, &(core->vm_regs.rax), write_size, hook->priv_data) != write_size) { PrintError("Write failure for out on port %x\n",io_qual.port); @@ -251,7 +249,7 @@ int v3_handle_vmx_io_outs(struct guest_info * core, struct vmx_exit_info * exit_ do { if (hook == NULL) { - PrintDebug("OUTS operation on unhooked IO port 0x%x\n", io_qual.port); + PrintDebug("OUTS operation on unhooked IO port 0x%x - ignored\n", io_qual.port); } else { if (hook->write(core, io_qual.port, (char *)host_addr, write_size, hook->priv_data) != write_size) { PrintError("Read failure for INS on port 0x%x\n", io_qual.port);