From owner-freebsd-arm@FreeBSD.ORG Wed Jul 20 14:59:26 2005 Return-Path: X-Original-To: arm@FreeBSD.org Delivered-To: freebsd-arm@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BF18816A41F; Wed, 20 Jul 2005 14:59:26 +0000 (GMT) (envelope-from jhb@FreeBSD.org) Received: from mv.twc.weather.com (mv.twc.weather.com [65.212.71.225]) by mx1.FreeBSD.org (Postfix) with ESMTP id 55D6443D55; Wed, 20 Jul 2005 14:59:26 +0000 (GMT) (envelope-from jhb@FreeBSD.org) Received: from [10.50.40.201] (Not Verified[65.202.103.25]) by mv.twc.weather.com with NetIQ MailMarshal (v6, 0, 3, 8) id ; Wed, 20 Jul 2005 11:13:43 -0400 From: John Baldwin To: arm@FreeBSD.org Date: Wed, 20 Jul 2005 10:49:26 -0400 User-Agent: KMail/1.8 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200507201049.27568.jhb@FreeBSD.org> Cc: cognet@FreeBSD.org Subject: [PATCH] - small cleanups to asm constraints X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the StrongARM Processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jul 2005 14:59:26 -0000 Can you please test the patch below. It makes use of the + modifier for a register variable in one place and fixes the asm constraints for _swp() to specify that _swp() modifies the memory being modified, not just the address of the memory (which isn't actually modified at that). Note that this means that the generic "memory" clobber can probably be removed, but I haven't done that yet: --- //depot/vendor/freebsd/src/sys/arm/include/atomic.h 2005/07/15 18:20:34 +++ //depot/projects/smpng/sys/arm/include/atomic.h 2005/07/18 17:20:49 @@ -77,8 +77,10 @@ static __inline uint32_t __swp(uint32_t val, volatile uint32_t *ptr) { - __asm __volatile("swp %0, %1, [%2]" - : "=&r" (val) : "r" (val) , "r" (ptr) : "memory"); + __asm __volatile("swp %0, %2, [%3]" + : "=&r" (val), "=m" (*ptr) + : "r" (val) , "r" (ptr), "m" (*ptr) + : "memory"); return (val); } --- //depot/vendor/freebsd/src/sys/arm/include/endian.h 2005/05/24 21:45:17 +++ //depot/projects/smpng/sys/arm/include/endian.h 2005/07/18 17:20:49 @@ -100,11 +100,10 @@ __bswap16_var(__uint16_t v) { __asm __volatile( - "mov %0, %1, ror #8\n" + "mov %0, %0, ror #8\n" "orr %0, %0, %0, lsr #16\n" "bic %0, %0, %0, lsl #16" - : "=r" (v) - : "0" (v)); + : "+r" (v)); return (v); } -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org