Add APIs to yield and get the ID of the VM.
Change-Id: I2e6340d200cfddc7ca9877e91d785c438620b6c6
diff --git a/src/api.c b/src/api.c
index 6be8702..7e6e4e6 100644
--- a/src/api.c
+++ b/src/api.c
@@ -101,6 +101,14 @@
}
/**
+ * Returns the ID of the VM.
+ */
+int64_t api_vm_get_id(const struct vcpu *current)
+{
+ return current->vm->id;
+}
+
+/**
* Returns the number of VMs configured to run.
*/
int64_t api_vm_get_count(void)
diff --git a/src/arch/aarch64/handler.c b/src/arch/aarch64/handler.c
index c15b550..990b212 100644
--- a/src/arch/aarch64/handler.c
+++ b/src/arch/aarch64/handler.c
@@ -217,6 +217,10 @@
}
switch ((uint32_t)arg0 & ~PSCI_CONVENTION_MASK) {
+ case HF_VM_GET_ID:
+ ret.user_ret = api_vm_get_id(current());
+ break;
+
case HF_VM_GET_COUNT:
ret.user_ret = api_vm_get_count();
break;
@@ -230,6 +234,11 @@
api_vcpu_run(arg1, arg2, current(), &ret.new));
break;
+ case HF_VCPU_YIELD:
+ ret.user_ret = 0;
+ ret.new = api_yield(current());
+ break;
+
case HF_VM_CONFIGURE:
ret.user_ret = api_vm_configure(ipa_init(arg1), ipa_init(arg2),
current());