Implement SPCI_ID_GET, and a convenience wrapper for clients.
Change-Id: Ic85256bc71002380ff16ebc2af8206af00f66654
diff --git a/src/api.c b/src/api.c
index d11b305..5261688 100644
--- a/src/api.c
+++ b/src/api.c
@@ -210,9 +210,10 @@
/**
* Returns the ID of the VM.
*/
-spci_vm_id_t api_vm_get_id(const struct vcpu *current)
+struct spci_value api_spci_id_get(const struct vcpu *current)
{
- return current->vm->id;
+ return (struct spci_value){.func = SPCI_SUCCESS_32,
+ .arg2 = current->vm->id};
}
/**
diff --git a/src/arch/aarch64/hypervisor/handler.c b/src/arch/aarch64/hypervisor/handler.c
index c4719ab..bbb115f 100644
--- a/src/arch/aarch64/hypervisor/handler.c
+++ b/src/arch/aarch64/hypervisor/handler.c
@@ -316,6 +316,9 @@
case SPCI_VERSION_32:
*args = api_spci_version();
return true;
+ case SPCI_ID_GET_32:
+ *args = api_spci_id_get(current());
+ return true;
case SPCI_YIELD_32:
api_yield(current(), next);
@@ -425,10 +428,6 @@
}
switch (args.func) {
- case HF_VM_GET_ID:
- vcpu->regs.r[0] = api_vm_get_id(vcpu);
- break;
-
case HF_VM_GET_COUNT:
vcpu->regs.r[0] = api_vm_get_count();
break;