exception: add vcpu_inject_pf support

add page fault exception injection support

Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com>
Acked-by: Tian, Kevin <kevin.tian@intel.com>
This commit is contained in:
Jason Chen CJ 2018-05-25 14:02:50 +08:00 committed by lijinxia
parent 75a03bf0f7
commit 7718338008
2 changed files with 11 additions and 0 deletions

View File

@ -322,6 +322,16 @@ int vcpu_inject_gp(struct vcpu *vcpu, uint32_t err_code)
return vcpu_make_request(vcpu, ACRN_REQUEST_EXCP); return vcpu_make_request(vcpu, ACRN_REQUEST_EXCP);
} }
int vcpu_inject_pf(struct vcpu *vcpu, uint64_t addr, uint32_t err_code)
{
struct run_context *cur_context =
&vcpu->arch_vcpu.contexts[vcpu->arch_vcpu.cur_context];
cur_context->cr2 = addr;
vcpu_queue_exception(vcpu, IDT_PF, err_code);
return vcpu_make_request(vcpu, ACRN_REQUEST_EXCP);
}
int interrupt_window_vmexit_handler(struct vcpu *vcpu) int interrupt_window_vmexit_handler(struct vcpu *vcpu)
{ {
int value32; int value32;

View File

@ -184,6 +184,7 @@ extern spurious_handler_t spurious_handler;
int vcpu_inject_extint(struct vcpu *vcpu); int vcpu_inject_extint(struct vcpu *vcpu);
int vcpu_inject_nmi(struct vcpu *vcpu); int vcpu_inject_nmi(struct vcpu *vcpu);
int vcpu_inject_gp(struct vcpu *vcpu, uint32_t err_code); int vcpu_inject_gp(struct vcpu *vcpu, uint32_t err_code);
int vcpu_inject_pf(struct vcpu *vcpu, uint64_t addr, uint32_t err_code);
int vcpu_make_request(struct vcpu *vcpu, int eventid); int vcpu_make_request(struct vcpu *vcpu, int eventid);
int vcpu_queue_exception(struct vcpu *vcpu, int32_t vector, uint32_t err_code); int vcpu_queue_exception(struct vcpu *vcpu, int32_t vector, uint32_t err_code);