bhyve: Remove some no-op code for setting RIP.
fbsdrun_addcpu() read the current vCPU's RIP register from the kernel via vm_get_register() to pass along through some layers to vm_loop() which then set the register via vm_set_register(). However, this is just always setting the value back to itself. Reviewed by: corvink Differential Revision: https://reviews.freebsd.org/D37643
This commit is contained in:
parent
461663ddba
commit
ceb0d0b0f1
@ -194,7 +194,7 @@ static const int BSP = 0;
|
|||||||
|
|
||||||
static cpuset_t cpumask;
|
static cpuset_t cpumask;
|
||||||
|
|
||||||
static void vm_loop(struct vmctx *ctx, int vcpu, uint64_t rip);
|
static void vm_loop(struct vmctx *ctx, int vcpu);
|
||||||
|
|
||||||
static struct vm_exit *vmexit;
|
static struct vm_exit *vmexit;
|
||||||
|
|
||||||
@ -540,7 +540,7 @@ fbsdrun_start_thread(void *param)
|
|||||||
#endif
|
#endif
|
||||||
gdb_cpu_add(vcpu);
|
gdb_cpu_add(vcpu);
|
||||||
|
|
||||||
vm_loop(mtp->mt_ctx, vcpu, vmexit[vcpu].rip);
|
vm_loop(mtp->mt_ctx, vcpu);
|
||||||
|
|
||||||
/* not reached */
|
/* not reached */
|
||||||
exit(1);
|
exit(1);
|
||||||
@ -548,7 +548,7 @@ fbsdrun_start_thread(void *param)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fbsdrun_addcpu(struct vmctx *ctx, int newcpu, uint64_t rip, bool suspend)
|
fbsdrun_addcpu(struct vmctx *ctx, int newcpu, bool suspend)
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
@ -561,13 +561,6 @@ fbsdrun_addcpu(struct vmctx *ctx, int newcpu, uint64_t rip, bool suspend)
|
|||||||
if (suspend)
|
if (suspend)
|
||||||
vm_suspend_cpu(ctx, newcpu);
|
vm_suspend_cpu(ctx, newcpu);
|
||||||
|
|
||||||
/*
|
|
||||||
* Set up the vmexit struct to allow execution to start
|
|
||||||
* at the given RIP
|
|
||||||
*/
|
|
||||||
vmexit[newcpu].rip = rip;
|
|
||||||
vmexit[newcpu].inst_length = 0;
|
|
||||||
|
|
||||||
mt_vmm_info[newcpu].mt_ctx = ctx;
|
mt_vmm_info[newcpu].mt_ctx = ctx;
|
||||||
mt_vmm_info[newcpu].mt_vcpu = newcpu;
|
mt_vmm_info[newcpu].mt_vcpu = newcpu;
|
||||||
|
|
||||||
@ -973,7 +966,7 @@ static vmexit_handler_t handler[VM_EXITCODE_MAX] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
vm_loop(struct vmctx *ctx, int vcpu, uint64_t startrip)
|
vm_loop(struct vmctx *ctx, int vcpu)
|
||||||
{
|
{
|
||||||
int error, rc;
|
int error, rc;
|
||||||
enum vm_exitcode exitcode;
|
enum vm_exitcode exitcode;
|
||||||
@ -988,9 +981,6 @@ vm_loop(struct vmctx *ctx, int vcpu, uint64_t startrip)
|
|||||||
error = vm_active_cpus(ctx, &active_cpus);
|
error = vm_active_cpus(ctx, &active_cpus);
|
||||||
assert(CPU_ISSET(vcpu, &active_cpus));
|
assert(CPU_ISSET(vcpu, &active_cpus));
|
||||||
|
|
||||||
error = vm_set_register(ctx, vcpu, VM_REG_GUEST_RIP, startrip);
|
|
||||||
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)
|
||||||
@ -1152,7 +1142,6 @@ static void
|
|||||||
spinup_vcpu(struct vmctx *ctx, int vcpu, bool suspend)
|
spinup_vcpu(struct vmctx *ctx, int vcpu, bool suspend)
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
uint64_t rip;
|
|
||||||
|
|
||||||
if (vcpu != BSP) {
|
if (vcpu != BSP) {
|
||||||
fbsdrun_set_capabilities(ctx, vcpu);
|
fbsdrun_set_capabilities(ctx, vcpu);
|
||||||
@ -1166,10 +1155,7 @@ spinup_vcpu(struct vmctx *ctx, int vcpu, bool suspend)
|
|||||||
assert(error == 0);
|
assert(error == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
error = vm_get_register(ctx, vcpu, VM_REG_GUEST_RIP, &rip);
|
fbsdrun_addcpu(ctx, vcpu, suspend);
|
||||||
assert(error == 0);
|
|
||||||
|
|
||||||
fbsdrun_addcpu(ctx, vcpu, rip, suspend);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
|
Loading…
Reference in New Issue
Block a user