]> rtime.felk.cvut.cz Git - l4.git/blobdiff - kernel/fiasco/src/kern/ia32/vm_svm.cpp
update
[l4.git] / kernel / fiasco / src / kern / ia32 / vm_svm.cpp
index e16066513f0648b8adbf23ff0e8261cd0db5b2b1..f89770bdbebf510276d3b33ff64f243f5af88f16 100644 (file)
@@ -667,7 +667,10 @@ Vm_svm::resume_vcpu(Context *ctxt, Vcpu_state *vcpu, bool user_mode)
   assert_kdb (user_mode);
 
   if (EXPECT_FALSE(!(ctxt->state(true) & Thread_ext_vcpu_enabled)))
-    return -L4_err::EInval;
+    {
+      ctxt->arch_load_vcpu_kern_state(vcpu, true);
+      return -L4_err::EInval;
+    }
 
   Vmcb *vmcb_s = reinterpret_cast<Vmcb*>(reinterpret_cast<char *>(vcpu) + 0x400);
   for (;;)
@@ -678,6 +681,7 @@ Vm_svm::resume_vcpu(Context *ctxt, Vcpu_state *vcpu, bool user_mode)
          && (vcpu->sticky_flags & Vcpu_state::Sf_irq_pending))
        {
          vmcb_s->control_area.exitcode = 0x60;
+          ctxt->arch_load_vcpu_kern_state(vcpu, true);
          return 1; // return 1 to indicate pending IRQs (IPCs)
        }
 
@@ -685,7 +689,10 @@ Vm_svm::resume_vcpu(Context *ctxt, Vcpu_state *vcpu, bool user_mode)
 
       // test for error or non-IRQ exit reason
       if (r <= 0)
-       return r;
+        {
+          ctxt->arch_load_vcpu_kern_state(vcpu, true);
+          return r;
+        }
 
       // check for IRQ exits and allow to handle the IRQ
       if (r == 1)
@@ -699,8 +706,11 @@ Vm_svm::resume_vcpu(Context *ctxt, Vcpu_state *vcpu, bool user_mode)
       Thread *t = nonull_static_cast<Thread*>(ctxt);
 
       if (t->continuation_test_and_restore())
-        t->fast_return_to_user(vcpu->_entry_ip, vcpu->_entry_sp,
-                               t->vcpu_state().usr().get());
+        {
+          ctxt->arch_load_vcpu_kern_state(vcpu, true);
+          t->fast_return_to_user(vcpu->_entry_ip, vcpu->_entry_sp,
+                                 t->vcpu_state().usr().get());
+        }
     }
 }