Changeset View
Changeset View
Standalone View
Standalone View
head/usr.sbin/bhyve/bhyverun.c
Show First 20 Lines • Show All 304 Lines • ▼ Show 20 Lines | |||||
#endif | #endif | ||||
return (VMEXIT_CONTINUE); | return (VMEXIT_CONTINUE); | ||||
} | } | ||||
static int | static int | ||||
vmexit_inout(struct vmctx *ctx, struct vm_exit *vme, int *pvcpu) | vmexit_inout(struct vmctx *ctx, struct vm_exit *vme, int *pvcpu) | ||||
{ | { | ||||
int error; | int error; | ||||
int bytes, port, in, out, string; | int bytes, port, in, out; | ||||
int vcpu; | int vcpu; | ||||
vcpu = *pvcpu; | vcpu = *pvcpu; | ||||
port = vme->u.inout.port; | port = vme->u.inout.port; | ||||
bytes = vme->u.inout.bytes; | bytes = vme->u.inout.bytes; | ||||
string = vme->u.inout.string; | |||||
in = vme->u.inout.in; | in = vme->u.inout.in; | ||||
out = !in; | out = !in; | ||||
/* Extra-special case of host notifications */ | /* Extra-special case of host notifications */ | ||||
if (out && port == GUEST_NIO_PORT) { | if (out && port == GUEST_NIO_PORT) { | ||||
error = vmexit_handle_notify(ctx, vme, pvcpu, vme->u.inout.eax); | error = vmexit_handle_notify(ctx, vme, pvcpu, vme->u.inout.eax); | ||||
return (error); | return (error); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 285 Lines • ▼ Show 20 Lines | vm_loop(struct vmctx *ctx, int vcpu, uint64_t startrip) | ||||
error = vm_set_register(ctx, vcpu, VM_REG_GUEST_RIP, startrip); | error = vm_set_register(ctx, vcpu, VM_REG_GUEST_RIP, startrip); | ||||
assert(error == 0); | assert(error == 0); | ||||
while (1) { | while (1) { | ||||
error = vm_run(ctx, vcpu, &vmexit[vcpu]); | error = vm_run(ctx, vcpu, &vmexit[vcpu]); | ||||
if (error != 0) | if (error != 0) | ||||
break; | break; | ||||
prevcpu = vcpu; | |||||
exitcode = vmexit[vcpu].exitcode; | exitcode = vmexit[vcpu].exitcode; | ||||
if (exitcode >= VM_EXITCODE_MAX || handler[exitcode] == NULL) { | if (exitcode >= VM_EXITCODE_MAX || handler[exitcode] == NULL) { | ||||
fprintf(stderr, "vm_loop: unexpected exitcode 0x%x\n", | fprintf(stderr, "vm_loop: unexpected exitcode 0x%x\n", | ||||
exitcode); | exitcode); | ||||
exit(1); | exit(1); | ||||
} | } | ||||
rc = (*handler[exitcode])(ctx, &vmexit[vcpu], &vcpu); | rc = (*handler[exitcode])(ctx, &vmexit[vcpu], &vcpu); | ||||
switch (rc) { | switch (rc) { | ||||
case VMEXIT_CONTINUE: | case VMEXIT_CONTINUE: | ||||
break; | break; | ||||
case VMEXIT_ABORT: | case VMEXIT_ABORT: | ||||
abort(); | abort(); | ||||
default: | default: | ||||
exit(1); | exit(1); | ||||
▲ Show 20 Lines • Show All 334 Lines • Show Last 20 Lines |