-
Notifications
You must be signed in to change notification settings - Fork 71
Expand file tree
/
Copy pathhyperkit.c.patch
More file actions
101 lines (89 loc) · 2.25 KB
/
hyperkit.c.patch
File metadata and controls
101 lines (89 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
diff --git a/src/hyperkit.c b/src/hyperkit.c
index aaee5fb..7bc6e89 100644
--- a/src/hyperkit.c
+++ b/src/hyperkit.c
@@ -76,6 +76,7 @@ typedef int (*vmexit_handler_t)(struct vm_exit *, int *vcpu);
extern int vmexit_task_switch(struct vm_exit *, int *vcpu);
char *vmname = "vm";
+bool exit_mevent_dispatch_loop = FALSE;
int guest_ncpus;
int print_mac;
@@ -169,7 +169,7 @@ usage(int code)
__attribute__ ((noreturn)) static void
show_version()
{
- fprintf(stderr, "%s: %s\n\n%s\n",progname, VERSION,
+ fprintf(stderr, "%s: %s\n\n%s\n",progname, "VERSION",
"Homepage: https://github.com/docker/hyperkit\n"
"License: BSD\n");
exit(0);
@@ -265,8 +266,6 @@ vcpu_thread(void *param)
vcpu_loop(vcpu, vmexit[vcpu].rip);
- /* not reached */
- exit(1);
return (NULL);
}
@@ -521,16 +520,21 @@ vmexit_suspend(struct vm_exit *vme, int *pvcpu)
switch ((int) (how)) {
case VM_SUSPEND_RESET:
- exit(0);
+ goCallbackExit(0);
+ return 0;
case VM_SUSPEND_POWEROFF:
- exit(1);
+ goCallbackExit(1);
+ return 1;
case VM_SUSPEND_HALT:
- exit(2);
+ goCallbackExit(2);
+ return 2;
case VM_SUSPEND_TRIPLEFAULT:
- exit(3);
+ goCallbackExit(3);
+ return 3;
default:
fprintf(stderr, "vmexit_suspend: invalid reason %d\n", how);
- exit(100);
+ goCallbackExit(100);
+ return 100;
}
}
@@ -617,18 +621,22 @@ vcpu_loop(int vcpu, uint64_t startrip)
exit(1);
}
- rc = (*handler[exitcode])(&vmexit[vcpu], &vcpu);
+ rc = (*handler[exitcode])(&vmexit[vcpu], &vcpu);
switch (rc) {
case VMEXIT_CONTINUE:
break;
case VMEXIT_ABORT:
abort();
+ case VM_SUSPEND_HALT:
+ case VM_SUSPEND_POWEROFF:
+ case VM_SUSPEND_RESET:
+ break;
default:
+ fprintf(stderr, "vm_run error %d, errno %d\n", error, errno);
exit(1);
}
}
- fprintf(stderr, "vm_run error %d, errno %d\n", error, errno);
}
static int
@@ -776,7 +784,7 @@ fail:
}
int
-main(int argc, char *argv[])
+run_xhyve(int argc, char* argv[])
{
int c, error, gdb_port, bvmcons, fw;
int dump_guest_memory, max_vcpus, mptgen;
@@ -951,7 +959,7 @@ main(int argc, char *argv[])
/*
* Head off to the main event dispatch loop
*/
- mevent_dispatch();
+ error = mevent_dispatch();
- exit(1);
+ return error;
}