Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/bhyve/bhyverun.c
| Show First 20 Lines • Show All 703 Lines • ▼ Show 20 Lines | vmexit_mtrap(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu) | ||||
| } | } | ||||
| gdb_cpu_mtrap(*pvcpu); | gdb_cpu_mtrap(*pvcpu); | ||||
| return (VMEXIT_CONTINUE); | return (VMEXIT_CONTINUE); | ||||
| } | } | ||||
| static int | static int | ||||
| vmexit_inst_emul(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu) | vmexit_inst_emul(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu) | ||||
| { | { | ||||
| int err, i; | int err, i, cs_d; | ||||
| struct vie *vie; | struct vie *vie; | ||||
| enum vm_cpu_mode mode; | |||||
| stats.vmexit_inst_emul++; | stats.vmexit_inst_emul++; | ||||
| vie = &vmexit->u.inst_emul.vie; | vie = &vmexit->u.inst_emul.vie; | ||||
| if (!vie->decoded) { | |||||
| /* | |||||
| * Attempt to decode in userspace as a fallback. This allows | |||||
| * updating instruction decode in bhyve without rebooting the | |||||
| * kernel (rapid prototyping), albeit with much slower | |||||
| * emulation. | |||||
| */ | |||||
| mode = vmexit->u.inst_emul.paging.cpu_mode; | |||||
| cs_d = vmexit->u.inst_emul.cs_d; | |||||
| (void)vmm_decode_instruction(mode, cs_d, vie); | |||||
| } | |||||
| err = emulate_mem(ctx, *pvcpu, vmexit->u.inst_emul.gpa, | err = emulate_mem(ctx, *pvcpu, vmexit->u.inst_emul.gpa, | ||||
| vie, &vmexit->u.inst_emul.paging); | vie, &vmexit->u.inst_emul.paging); | ||||
| if (err) { | if (err) { | ||||
| if (err == ESRCH) { | if (err == ESRCH) { | ||||
| EPRINTLN("Unhandled memory access to 0x%lx\n", | EPRINTLN("Unhandled memory access to 0x%lx\n", | ||||
| vmexit->u.inst_emul.gpa); | vmexit->u.inst_emul.gpa); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 534 Lines • Show Last 20 Lines | |||||