mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-08-06 02:35:10 +00:00
hv: remove goto in ept_violation_vmexit_handler
Using goto leads the code to be difficult to read and maintain Tracked-On: #861 Signed-off-by: Li, Fei1 <fei1.li@intel.com>
This commit is contained in:
parent
a958fea7a4
commit
4131d46f84
@ -115,46 +115,41 @@ int32_t ept_violation_vmexit_handler(struct acrn_vcpu *vcpu)
|
|||||||
ret = decode_instruction(vcpu);
|
ret = decode_instruction(vcpu);
|
||||||
if (ret > 0) {
|
if (ret > 0) {
|
||||||
mmio_req->size = (uint64_t)ret;
|
mmio_req->size = (uint64_t)ret;
|
||||||
} else if (ret == -EFAULT) {
|
/*
|
||||||
pr_info("page fault happen during decode_instruction");
|
* For MMIO write, ask DM to run MMIO emulation after
|
||||||
status = 0;
|
* instruction emulation. For MMIO read, ask DM to run MMIO
|
||||||
goto out;
|
* emulation at first.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Determine value being written. */
|
||||||
|
if (mmio_req->direction == REQUEST_WRITE) {
|
||||||
|
status = emulate_instruction(vcpu);
|
||||||
|
if (status != 0) {
|
||||||
|
ret = -EFAULT;;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ret > 0) {
|
||||||
|
status = emulate_io(vcpu, io_req);
|
||||||
|
if (status == 0) {
|
||||||
|
emulate_mmio_post(vcpu, io_req);
|
||||||
|
} else {
|
||||||
|
if (status == IOREQ_PENDING) {
|
||||||
|
status = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
goto out;
|
if (ret == -EFAULT) {
|
||||||
}
|
pr_info("page fault happen during decode_instruction");
|
||||||
|
status = 0;
|
||||||
|
|
||||||
/*
|
|
||||||
* For MMIO write, ask DM to run MMIO emulation after
|
|
||||||
* instruction emulation. For MMIO read, ask DM to run MMIO
|
|
||||||
* emulation at first.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Determine value being written. */
|
|
||||||
if (mmio_req->direction == REQUEST_WRITE) {
|
|
||||||
status = emulate_instruction(vcpu);
|
|
||||||
if (status != 0) {
|
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
status = emulate_io(vcpu, io_req);
|
if (ret <= 0) {
|
||||||
|
pr_acrnlog("Guest Linear Address: 0x%016llx", exec_vmread(VMX_GUEST_LINEAR_ADDR));
|
||||||
if (status == 0) {
|
pr_acrnlog("Guest Physical Address address: 0x%016llx", gpa);
|
||||||
emulate_mmio_post(vcpu, io_req);
|
|
||||||
} else if (status == IOREQ_PENDING) {
|
|
||||||
status = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return status;
|
|
||||||
|
|
||||||
out:
|
|
||||||
pr_acrnlog("Guest Linear Address: 0x%016llx",
|
|
||||||
exec_vmread(VMX_GUEST_LINEAR_ADDR));
|
|
||||||
|
|
||||||
pr_acrnlog("Guest Physical Address address: 0x%016llx",
|
|
||||||
gpa);
|
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user