Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


VM Reset Bugfixes
[palacios.git] / palacios / src / palacios / svm.c
index 15eed50..a007201 100644 (file)
@@ -12,6 +12,7 @@
  * All rights reserved.
  *
  * Author: Jack Lange <jarusl@cs.northwestern.edu>
+ *         Peter Dinda <jarusl@cs.northwestern.edu> (Reset)
  *
  * This is free software.  You are permitted to use,
  * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
@@ -463,12 +464,22 @@ static int svm_handle_standard_reset(struct guest_info *core)
     // I could be a ROS core, or I could be in a non-HVM 
     // either way, if I'm core 0, I'm the leader
     if (core->vcpu_id==0) {
+       uint64_t mem_size=core->vm_info->mem_size;
+
+#ifdef V3_CONFIG_HVM
+       // on a ROS reset, we should only 
+       // manipulate the part of the memory seen by
+       // the ROS
+       if (core->vm_info->hvm_state.is_hvm) { 
+           mem_size=v3_get_hvm_ros_memsize(core->vm_info);
+       }
+#endif
        core->vm_info->run_state = VM_RESETTING;
        // copy bioses again because some, 
        // like seabios, assume
        // this should also blow away the BDA and EBDA
        PrintDebug(core->vm_info,core,"Clear memory (%p bytes)\n",(void*)core->vm_info->mem_size);
-       if (v3_set_gpa_memory(core, 0, core->vm_info->mem_size, 0)!=core->vm_info->mem_size) { 
+       if (v3_set_gpa_memory(core, 0, mem_size, 0)!=mem_size) { 
            PrintError(core->vm_info,core,"Clear of memory failed\n");
        }
        PrintDebug(core->vm_info,core,"Copying bioses\n");
@@ -484,7 +495,7 @@ static int svm_handle_standard_reset(struct guest_info *core)
     core->cpl = 0;
     core->cpu_mode = REAL;
     core->mem_mode = PHYSICAL_MEM;
-    core->num_exits=0;
+    //core->num_exits=0;
 
     PrintDebug(core->vm_info,core,"Machine reset to REAL/PHYSICAL\n");
 
@@ -683,6 +694,8 @@ static int update_irq_entry_state(struct guest_info * info) {
 
                info->intr_core_state.irq_pending = 1;
                info->intr_core_state.irq_vector = irq;
+
+               break;
                
            }
            case V3_NMI:
@@ -751,7 +764,6 @@ int v3_svm_enter(struct guest_info * info) {
     vmcb_saved_state_t * guest_state = GET_VMCB_SAVE_STATE_AREA((vmcb_t*)(info->vmm_data)); 
     addr_t exit_code = 0, exit_info1 = 0, exit_info2 = 0;
     uint64_t guest_cycles = 0;
-    struct Interrupt_Info exit_int_info;
 
 
     // Conditionally yield the CPU if the timeslice has expired
@@ -923,7 +935,6 @@ int v3_svm_enter(struct guest_info * info) {
     exit_code = guest_ctrl->exit_code;
     exit_info1 = guest_ctrl->exit_info1;
     exit_info2 = guest_ctrl->exit_info2;
-    exit_int_info = guest_ctrl->exit_int_info;
 
 #ifdef V3_CONFIG_SYMCALL
     if (info->sym_core_state.symcall_state.sym_call_active == 0) {
@@ -952,8 +963,6 @@ int v3_svm_enter(struct guest_info * info) {
            PrintError(info->vm_info, info, "Error in SVM exit handler (ret=%d)\n", ret);
            PrintError(info->vm_info, info, "  last Exit was %d (exit code=0x%llx)\n", v3_last_exit, (uint64_t) exit_code);
 
-           //V3_Sleep(5*1000000);
-    
            return -1;
        }
     }
@@ -1166,7 +1175,6 @@ int v3_reset_svm_vm_core(struct guest_info * core, addr_t rip) {
     // So the selector needs to be VV00
     // and the base needs to be VV000
     //
-    V3_Print(core->vm_info,core,"SVM Reset to RIP %p\n",(void*)rip);
     core->rip = 0;
     core->segments.cs.selector = rip << 8;
     core->segments.cs.limit = 0xffff;