From patchwork Fri Feb 5 08:02:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 8232571 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 39EEB9F1C1 for ; Fri, 5 Feb 2016 08:05:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3FCE820306 for ; Fri, 5 Feb 2016 08:04:58 +0000 (UTC) Received: from lists.xen.org (lists.xenproject.org [50.57.142.19]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 388F8200CF for ; Fri, 5 Feb 2016 08:04:57 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aRbLj-0007Im-UM; Fri, 05 Feb 2016 08:02:39 +0000 Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aRbLi-0007Ia-JN for xen-devel@lists.xenproject.org; Fri, 05 Feb 2016 08:02:38 +0000 Received: from [85.158.143.35] by server-1.bemta-4.messagelabs.com id AE/B2-09708-D1754B65; Fri, 05 Feb 2016 08:02:37 +0000 X-Env-Sender: JBeulich@suse.com X-Msg-Ref: server-3.tower-21.messagelabs.com!1454659355!13700877!1 X-Originating-IP: [137.65.248.74] X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 29705 invoked from network); 5 Feb 2016 08:02:36 -0000 Received: from prv-mh.provo.novell.com (HELO prv-mh.provo.novell.com) (137.65.248.74) by server-3.tower-21.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 5 Feb 2016 08:02:36 -0000 Received: from INET-PRV-MTA by prv-mh.provo.novell.com with Novell_GroupWise; Fri, 05 Feb 2016 01:02:35 -0700 Message-Id: <56B4652B02000078000CEDCC@prv-mh.provo.novell.com> X-Mailer: Novell GroupWise Internet Agent 14.2.0 Date: Fri, 05 Feb 2016 01:02:35 -0700 From: "Jan Beulich" To: "xen-devel" References: <56B4628602000078000CED9E@prv-mh.provo.novell.com> In-Reply-To: <56B4628602000078000CED9E@prv-mh.provo.novell.com> Mime-Version: 1.0 Cc: George Dunlap , Andrew Cooper , Keir Fraser , Tim Deegan Subject: [Xen-devel] [PATCH 3/3] x86/shadow: remove a few 32-bit hypervisor leftovers X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP ... related to 8-byte cmpxchg having required special precautions there. Signed-off-by: Jan Beulich x86/shadow: remove a few 32-bit hypervisor leftovers ... related to 8-byte cmpxchg having required special precautions there. Signed-off-by: Jan Beulich --- a/xen/arch/x86/mm/shadow/common.c +++ b/xen/arch/x86/mm/shadow/common.c @@ -259,10 +259,10 @@ hvm_emulate_cmpxchg(enum x86_segment seg struct sh_emulate_ctxt *sh_ctxt = container_of(ctxt, struct sh_emulate_ctxt, ctxt); struct vcpu *v = current; - unsigned long addr, old[2], new[2]; + unsigned long addr, old, new; int rc; - if ( !is_x86_user_segment(seg) ) + if ( !is_x86_user_segment(seg) || bytes > sizeof(long) ) return X86EMUL_UNHANDLEABLE; rc = hvm_translate_linear_addr( @@ -270,15 +270,12 @@ hvm_emulate_cmpxchg(enum x86_segment seg if ( rc ) return rc; - old[0] = new[0] = 0; - memcpy(old, p_old, bytes); - memcpy(new, p_new, bytes); - - if ( bytes <= sizeof(long) ) - return v->arch.paging.mode->shadow.x86_emulate_cmpxchg( - v, addr, old[0], new[0], bytes, sh_ctxt); + old = new = 0; + memcpy(&old, p_old, bytes); + memcpy(&new, p_new, bytes); - return X86EMUL_UNHANDLEABLE; + return v->arch.paging.mode->shadow.x86_emulate_cmpxchg( + v, addr, old, new, bytes, sh_ctxt); } static const struct x86_emulate_ops hvm_shadow_emulator_ops = { @@ -335,21 +332,18 @@ pv_emulate_cmpxchg(enum x86_segment seg, { struct sh_emulate_ctxt *sh_ctxt = container_of(ctxt, struct sh_emulate_ctxt, ctxt); - unsigned long old[2], new[2]; + unsigned long old, new; struct vcpu *v = current; - if ( !is_x86_user_segment(seg) ) + if ( !is_x86_user_segment(seg) || bytes > sizeof(long) ) return X86EMUL_UNHANDLEABLE; - old[0] = new[0] = 0; - memcpy(old, p_old, bytes); - memcpy(new, p_new, bytes); - - if ( bytes <= sizeof(long) ) - return v->arch.paging.mode->shadow.x86_emulate_cmpxchg( - v, offset, old[0], new[0], bytes, sh_ctxt); + old = new = 0; + memcpy(&old, p_old, bytes); + memcpy(&new, p_new, bytes); - return X86EMUL_UNHANDLEABLE; + return v->arch.paging.mode->shadow.x86_emulate_cmpxchg( + v, offset, old, new, bytes, sh_ctxt); } static const struct x86_emulate_ops pv_shadow_emulator_ops = { --- a/xen/arch/x86/mm/shadow/types.h +++ b/xen/arch/x86/mm/shadow/types.h @@ -247,7 +247,6 @@ static inline shadow_l4e_t shadow_l4e_fr #define sh_detach_old_tables INTERNAL_NAME(sh_detach_old_tables) #define sh_x86_emulate_write INTERNAL_NAME(sh_x86_emulate_write) #define sh_x86_emulate_cmpxchg INTERNAL_NAME(sh_x86_emulate_cmpxchg) -#define sh_x86_emulate_cmpxchg8b INTERNAL_NAME(sh_x86_emulate_cmpxchg8b) #define sh_audit_l1_table INTERNAL_NAME(sh_audit_l1_table) #define sh_audit_fl1_table INTERNAL_NAME(sh_audit_fl1_table) #define sh_audit_l2_table INTERNAL_NAME(sh_audit_l2_table) --- a/xen/arch/x86/mm/shadow/common.c +++ b/xen/arch/x86/mm/shadow/common.c @@ -259,10 +259,10 @@ hvm_emulate_cmpxchg(enum x86_segment seg struct sh_emulate_ctxt *sh_ctxt = container_of(ctxt, struct sh_emulate_ctxt, ctxt); struct vcpu *v = current; - unsigned long addr, old[2], new[2]; + unsigned long addr, old, new; int rc; - if ( !is_x86_user_segment(seg) ) + if ( !is_x86_user_segment(seg) || bytes > sizeof(long) ) return X86EMUL_UNHANDLEABLE; rc = hvm_translate_linear_addr( @@ -270,15 +270,12 @@ hvm_emulate_cmpxchg(enum x86_segment seg if ( rc ) return rc; - old[0] = new[0] = 0; - memcpy(old, p_old, bytes); - memcpy(new, p_new, bytes); - - if ( bytes <= sizeof(long) ) - return v->arch.paging.mode->shadow.x86_emulate_cmpxchg( - v, addr, old[0], new[0], bytes, sh_ctxt); + old = new = 0; + memcpy(&old, p_old, bytes); + memcpy(&new, p_new, bytes); - return X86EMUL_UNHANDLEABLE; + return v->arch.paging.mode->shadow.x86_emulate_cmpxchg( + v, addr, old, new, bytes, sh_ctxt); } static const struct x86_emulate_ops hvm_shadow_emulator_ops = { @@ -335,21 +332,18 @@ pv_emulate_cmpxchg(enum x86_segment seg, { struct sh_emulate_ctxt *sh_ctxt = container_of(ctxt, struct sh_emulate_ctxt, ctxt); - unsigned long old[2], new[2]; + unsigned long old, new; struct vcpu *v = current; - if ( !is_x86_user_segment(seg) ) + if ( !is_x86_user_segment(seg) || bytes > sizeof(long) ) return X86EMUL_UNHANDLEABLE; - old[0] = new[0] = 0; - memcpy(old, p_old, bytes); - memcpy(new, p_new, bytes); - - if ( bytes <= sizeof(long) ) - return v->arch.paging.mode->shadow.x86_emulate_cmpxchg( - v, offset, old[0], new[0], bytes, sh_ctxt); + old = new = 0; + memcpy(&old, p_old, bytes); + memcpy(&new, p_new, bytes); - return X86EMUL_UNHANDLEABLE; + return v->arch.paging.mode->shadow.x86_emulate_cmpxchg( + v, offset, old, new, bytes, sh_ctxt); } static const struct x86_emulate_ops pv_shadow_emulator_ops = { --- a/xen/arch/x86/mm/shadow/types.h +++ b/xen/arch/x86/mm/shadow/types.h @@ -247,7 +247,6 @@ static inline shadow_l4e_t shadow_l4e_fr #define sh_detach_old_tables INTERNAL_NAME(sh_detach_old_tables) #define sh_x86_emulate_write INTERNAL_NAME(sh_x86_emulate_write) #define sh_x86_emulate_cmpxchg INTERNAL_NAME(sh_x86_emulate_cmpxchg) -#define sh_x86_emulate_cmpxchg8b INTERNAL_NAME(sh_x86_emulate_cmpxchg8b) #define sh_audit_l1_table INTERNAL_NAME(sh_audit_l1_table) #define sh_audit_fl1_table INTERNAL_NAME(sh_audit_fl1_table) #define sh_audit_l2_table INTERNAL_NAME(sh_audit_l2_table)