summary refs log tree commit diff stats
path: root/accel/hvf/hvf-all.c
diff options
context:
space:
mode:
Diffstat (limited to 'accel/hvf/hvf-all.c')
-rw-r--r--accel/hvf/hvf-all.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/accel/hvf/hvf-all.c b/accel/hvf/hvf-all.c
index b6075c036e..1fa07c8b69 100644
--- a/accel/hvf/hvf-all.c
+++ b/accel/hvf/hvf-all.c
@@ -251,7 +251,7 @@ static int hvf_accel_init(AccelState *as, MachineState *ms)
 {
     int x;
     hv_return_t ret;
-    HVFState *s;
+    HVFState *s = HVF_STATE(as);
     int pa_range = 36;
     MachineClass *mc = MACHINE_GET_CLASS(ms);
 
@@ -263,10 +263,13 @@ static int hvf_accel_init(AccelState *as, MachineState *ms)
     }
 
     ret = hvf_arch_vm_create(ms, (uint32_t)pa_range);
+    if (ret == HV_DENIED) {
+        error_report("Could not access HVF. Is the executable signed"
+                     " with com.apple.security.hypervisor entitlement?");
+        exit(1);
+    }
     assert_hvf_ok(ret);
 
-    s = g_new0(HVFState, 1);
-
     s->num_slots = ARRAY_SIZE(s->slots);
     for (x = 0; x < s->num_slots; ++x) {
         s->slots[x].size = 0;