From: David Vrabel Subject: [PATCHv3 2/4] arm: provide xadd() Date: Tue, 21 Apr 2015 11:11:26 +0100 Message-ID: <1429611088-23950-3-git-send-email-david.vrabel@citrix.com> References: <1429611088-23950-1-git-send-email-david.vrabel@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YkV9c-0003jF-EJ for xen-devel@lists.xenproject.org; Tue, 21 Apr 2015 10:11:44 +0000 In-Reply-To: <1429611088-23950-1-git-send-email-david.vrabel@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: Keir Fraser , Ian Campbell , Stefano Stabellini , Andrew Cooper , Tim Deegan , David Vrabel , Jan Beulich , Jennifer Herbert List-Id: xen-devel@lists.xenproject.org xadd() atomically adds a value and returns the previous value. This is needed to implement ticket locks. This generic arm implementation uses the GCC __sync_fetch_and_add() builtin. This builtin resulted in suitable inlined asm for GCC 4.8.3 (arm64) and GCC 4.6.3 (arm32). Signed-off-by: David Vrabel Acked-by: Ian Campbell --- xen/include/asm-arm/system.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xen/include/asm-arm/system.h b/xen/include/asm-arm/system.h index ce3d38a..367af1d 100644 --- a/xen/include/asm-arm/system.h +++ b/xen/include/asm-arm/system.h @@ -51,6 +51,8 @@ # error "unknown ARM variant" #endif +#define xadd(x, v) __sync_fetch_and_add(x, v) + extern struct vcpu *__context_switch(struct vcpu *prev, struct vcpu *next); #endif -- 1.7.10.4