+ return simcall_vm_set_bound(vm, bound);
+}
+
+
+/** @brief Set the CPU affinity of a given VM.
+ * @ingroup msg_VMs
+ *
+ * This function changes the CPU affinity of a given VM. Usage is the same as
+ * MSG_task_set_affinity(). See the MSG_task_set_affinity() for details.
+ */
+void MSG_vm_set_affinity(msg_vm_t vm, msg_host_t pm, unsigned long mask)
+{
+ msg_host_priv_t priv = msg_host_resource_priv(vm);
+
+ if (mask == 0)
+ xbt_dict_remove_ext(priv->affinity_mask_db, (char *) pm, sizeof(pm));
+ else
+ xbt_dict_set_ext(priv->affinity_mask_db, (char *) pm, sizeof(pm), (void *) mask, NULL);
+
+ msg_host_t pm_now = MSG_vm_get_pm(vm);
+ if (pm_now == pm) {
+ XBT_INFO("set affinity(0x%04lx@%s) for %s", mask, MSG_host_get_name(pm), MSG_host_get_name(vm));
+ simcall_vm_set_affinity(vm, pm, mask);
+ } else
+ XBT_INFO("set affinity(0x%04lx@%s) for %s (not active now)", mask, MSG_host_get_name(pm), MSG_host_get_name(vm));