@@ -314,7 +314,7 @@ static int inject_event(struct domain *d,
v->arch.hvm.inject_event.type = data->type;
v->arch.hvm.inject_event.insn_len = data->insn_len;
v->arch.hvm.inject_event.error_code = data->error_code;
- v->arch.hvm.inject_event.cr2 = data->cr2;
+ v->arch.hvm.inject_event.extra = data->cr2;
smp_wmb();
v->arch.hvm.inject_event.vector = data->vector;
@@ -507,7 +507,7 @@ static bool hvm_get_pending_event(struct vcpu *v, struct x86_event *info)
if ( info->type == X86_EVENTTYPE_HW_EXCEPTION &&
info->vector == X86_EXC_PF )
- info->cr2 = v->arch.hvm.guest_cr[2];
+ info->extra = v->arch.hvm.guest_cr[2];
return true;
}
@@ -548,7 +548,7 @@ void hvm_do_resume(struct vcpu *v)
if ( hvm_get_pending_event(v, &info) )
{
hvm_monitor_interrupt(info.vector, info.type, info.error_code,
- info.cr2);
+ info.extra);
v->arch.monitor.next_interrupt_enabled = false;
}
}
@@ -842,7 +842,7 @@ int cf_check nsvm_vcpu_vmexit_event(
ASSERT(vcpu_nestedhvm(v).nv_vvmcx != NULL);
nestedsvm_vmexit_defer(v, VMEXIT_EXCEPTION_DE + event->vector,
- event->error_code, event->cr2);
+ event->error_code, event->extra);
return NESTEDHVM_VMEXIT_DONE;
}
@@ -1252,7 +1252,7 @@ static void svm_emul_swint_injection(struct x86_event *event)
{
fault = X86_EXC_PF;
ec = pfinfo.ec;
- event->cr2 = pfinfo.linear;
+ event->extra = pfinfo.linear;
}
goto raise_exception;
@@ -1345,8 +1345,8 @@ static void cf_check svm_inject_event(const struct x86_event *event)
case X86_EXC_PF:
ASSERT(_event.type == X86_EVENTTYPE_HW_EXCEPTION);
- curr->arch.hvm.guest_cr[2] = _event.cr2;
- vmcb_set_cr2(vmcb, _event.cr2);
+ curr->arch.hvm.guest_cr[2] = _event.extra;
+ vmcb_set_cr2(vmcb, _event.extra);
break;
}
@@ -1430,7 +1430,7 @@ static void cf_check svm_inject_event(const struct x86_event *event)
if ( _event.vector == X86_EXC_PF &&
_event.type == X86_EVENTTYPE_HW_EXCEPTION )
HVMTRACE_LONG_2D(PF_INJECT, _event.error_code,
- TRC_PAR_LONG(_event.cr2));
+ TRC_PAR_LONG(_event.extra));
else
HVMTRACE_2D(INJ_EXC, _event.vector, _event.error_code);
}
@@ -2051,7 +2051,7 @@ static void cf_check vmx_inject_event(const struct x86_event *event)
case X86_EXC_PF:
ASSERT(_event.type == X86_EVENTTYPE_HW_EXCEPTION);
- curr->arch.hvm.guest_cr[2] = _event.cr2;
+ curr->arch.hvm.guest_cr[2] = _event.extra;
break;
}
@@ -735,7 +735,7 @@ static inline void pv_inject_page_fault(int errcode, unsigned long cr2)
.vector = X86_EXC_PF,
.type = X86_EVENTTYPE_HW_EXCEPTION,
.error_code = errcode,
- .cr2 = cr2,
+ .extra = cr2,
};
pv_inject_event(&event);
@@ -532,7 +532,7 @@ static inline void hvm_inject_page_fault(int errcode, unsigned long cr2)
.vector = X86_EXC_PF,
.type = X86_EVENTTYPE_HW_EXCEPTION,
.error_code = errcode,
- .cr2 = cr2,
+ .extra = cr2,
};
hvm_inject_event(&event);
@@ -53,15 +53,15 @@ void pv_inject_event(const struct x86_event *event)
if ( event->type == X86_EVENTTYPE_HW_EXCEPTION &&
vector == X86_EXC_PF )
{
- curr->arch.pv.ctrlreg[2] = event->cr2;
- arch_set_cr2(curr, event->cr2);
+ curr->arch.pv.ctrlreg[2] = event->extra;
+ arch_set_cr2(curr, event->extra);
/* Re-set error_code.user flag appropriately for the guest. */
error_code &= ~PFEC_user_mode;
if ( !guest_kernel_mode(curr, regs) )
error_code |= PFEC_user_mode;
- trace_pv_page_fault(event->cr2, error_code);
+ trace_pv_page_fault(event->extra, error_code);
}
else
trace_pv_trap(vector, regs->rip, use_error_code, error_code);
@@ -82,7 +82,7 @@ void pv_inject_event(const struct x86_event *event)
vector, vector_name(vector), error_code);
if ( vector == X86_EXC_PF )
- show_page_walk(event->cr2);
+ show_page_walk(event->extra);
}
}
@@ -78,7 +78,7 @@ struct x86_event {
uint8_t type; /* X86_EVENTTYPE_* */
uint8_t insn_len; /* Instruction length */
int32_t error_code; /* X86_EVENT_NO_EC if n/a */
- unsigned long cr2; /* Only for X86_EXC_PF h/w exception */
+ unsigned long extra; /* CR2 if X86_EXC_PF h/w exception */
};
/*
@@ -831,7 +831,7 @@ static inline void x86_emul_pagefault(
ctxt->event.vector = X86_EXC_PF;
ctxt->event.type = X86_EVENTTYPE_HW_EXCEPTION;
ctxt->event.error_code = error_code;
- ctxt->event.cr2 = cr2;
+ ctxt->event.extra = cr2;
ctxt->event_pending = true;
}
XEN_DMOP_inject_event() copies the 'cr2' argument to struct x86_event. 'cr2' is overladed to mean pending_dbg for a debug trap, but consumers of struct x86_event always interpret it as CR2. Clarify the role of the 'cr2' field by renaming it to 'extra', in preparation for an upcoming patch that uses it to actually populate dr6. Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com> --- xen/arch/x86/hvm/dm.c | 2 +- xen/arch/x86/hvm/hvm.c | 4 ++-- xen/arch/x86/hvm/svm/nestedsvm.c | 2 +- xen/arch/x86/hvm/svm/svm.c | 8 ++++---- xen/arch/x86/hvm/vmx/vmx.c | 2 +- xen/arch/x86/include/asm/domain.h | 2 +- xen/arch/x86/include/asm/hvm/hvm.h | 2 +- xen/arch/x86/pv/traps.c | 8 ++++---- xen/arch/x86/x86_emulate/x86_emulate.h | 4 ++-- 9 files changed, 17 insertions(+), 17 deletions(-)