-void SIMIX_pre_vm_suspend(smx_simcall_t simcall, smx_host_t ind_vm){
- SIMIX_vm_suspend(ind_vm);
+void SIMIX_pre_vm_suspend(smx_simcall_t simcall, smx_host_t ind_vm)
+{
+ if (simcall->issuer->smx_host == ind_vm) {
+ XBT_ERROR("cannot suspend the VM where I run");
+ DIE_IMPOSSIBLE;
+ }
+
+ SIMIX_vm_suspend(ind_vm, simcall->issuer);
+
+ /* without this, simcall_vm_suspend() does not return to the userland. why? */
+ SIMIX_simcall_answer(simcall);
+
+ XBT_DEBUG("SIMIX_pre_vm_suspend done");