On 24.08.2023 17:25, Jinoh Kang wrote: > Prepare for an upcoming patch that overloads the 'cr2' field for #DB.
Seeing the subsequent change and the fact that earlier on Andrew didn't need such an adjustment, I'm afraid I can't see the need for this change, and the one sentence above also doesn't answer the "Why?", but only the "What?" Jan > --- a/xen/arch/x86/hvm/hvm.c > +++ b/xen/arch/x86/hvm/hvm.c > @@ -503,9 +503,14 @@ void hvm_migrate_pirqs(struct vcpu *v) > > static bool hvm_get_pending_event(struct vcpu *v, struct x86_event *info) > { > - info->cr2 = v->arch.hvm.guest_cr[2]; > + if ( !alternative_call(hvm_funcs.get_pending_event, v, info) ) > + return false; > + > + if ( info->type == X86_EVENTTYPE_HW_EXCEPTION && > + info->vector == X86_EXC_PF ) > + info->cr2 = v->arch.hvm.guest_cr[2]; > > - return alternative_call(hvm_funcs.get_pending_event, v, info); > + return true; > } > > void hvm_do_resume(struct vcpu *v)