Message ID | 20241028154932.6797-7-alejandro.vallejo@cloud.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | x86: Address Space Isolation FPU preparations | expand |
On 28.10.2024 16:49, Alejandro Vallejo wrote: > --- a/xen/arch/x86/hvm/emulate.c > +++ b/xen/arch/x86/hvm/emulate.c > @@ -2371,7 +2371,8 @@ static int cf_check hvmemul_get_fpu( > alternative_vcall(hvm_funcs.fpu_dirty_intercept); > else if ( type == X86EMUL_FPU_fpu ) > { > - const fpusse_t *fpu_ctxt = &curr->arch.xsave_area->fpu_sse; > + const struct xsave_struct *xsave_area = vcpu_map_xsave_area(curr); > + const fpusse_t *fpu_ctxt = &xsave_area->fpu_sse; > > /* > * Latch current register state so that we can back out changes > @@ -2397,6 +2398,8 @@ static int cf_check hvmemul_get_fpu( > else > ASSERT(fcw == fpu_ctxt->fcw); > } > + > + vcpu_unmap_xsave_area(curr, xsave_area); > } Same question as for the other patch: Mainly a cosmetic change, with no actual map/unmap? > @@ -2411,7 +2414,8 @@ static void cf_check hvmemul_put_fpu( > > if ( aux ) > { > - fpusse_t *fpu_ctxt = &curr->arch.xsave_area->fpu_sse; > + struct xsave_struct *xsave_area = vcpu_map_xsave_area(curr); > + fpusse_t *fpu_ctxt = &xsave_area->fpu_sse; > bool dval = aux->dval; > int mode = hvm_guest_x86_mode(curr); > > @@ -2465,6 +2469,8 @@ static void cf_check hvmemul_put_fpu( > > fpu_ctxt->fop = aux->op; > > + vcpu_unmap_xsave_area(curr, xsave_area); > + > /* Re-use backout code below. */ > backout = X86EMUL_FPU_fpu; > } Same here. Because of the overhead concern, such places may be worthwhile to gain brief comments. Jan
diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c index f2bc6967dfcb..a6ddc9928f16 100644 --- a/xen/arch/x86/hvm/emulate.c +++ b/xen/arch/x86/hvm/emulate.c @@ -2371,7 +2371,8 @@ static int cf_check hvmemul_get_fpu( alternative_vcall(hvm_funcs.fpu_dirty_intercept); else if ( type == X86EMUL_FPU_fpu ) { - const fpusse_t *fpu_ctxt = &curr->arch.xsave_area->fpu_sse; + const struct xsave_struct *xsave_area = vcpu_map_xsave_area(curr); + const fpusse_t *fpu_ctxt = &xsave_area->fpu_sse; /* * Latch current register state so that we can back out changes @@ -2397,6 +2398,8 @@ static int cf_check hvmemul_get_fpu( else ASSERT(fcw == fpu_ctxt->fcw); } + + vcpu_unmap_xsave_area(curr, xsave_area); } return X86EMUL_OKAY; @@ -2411,7 +2414,8 @@ static void cf_check hvmemul_put_fpu( if ( aux ) { - fpusse_t *fpu_ctxt = &curr->arch.xsave_area->fpu_sse; + struct xsave_struct *xsave_area = vcpu_map_xsave_area(curr); + fpusse_t *fpu_ctxt = &xsave_area->fpu_sse; bool dval = aux->dval; int mode = hvm_guest_x86_mode(curr); @@ -2465,6 +2469,8 @@ static void cf_check hvmemul_put_fpu( fpu_ctxt->fop = aux->op; + vcpu_unmap_xsave_area(curr, xsave_area); + /* Re-use backout code below. */ backout = X86EMUL_FPU_fpu; }
No functional change. Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com> --- xen/arch/x86/hvm/emulate.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)