From owner-p4-projects@FreeBSD.ORG Thu Oct 13 17:26:14 2005 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id B275716A421; Thu, 13 Oct 2005 17:26:13 +0000 (GMT) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 75CCE16A41F for ; Thu, 13 Oct 2005 17:26:13 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id D1EF443D48 for ; Thu, 13 Oct 2005 17:26:12 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id j9DHQCG1067366 for ; Thu, 13 Oct 2005 17:26:12 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id j9DHQCk0067363 for perforce@freebsd.org; Thu, 13 Oct 2005 17:26:12 GMT (envelope-from jhb@freebsd.org) Date: Thu, 13 Oct 2005 17:26:12 GMT Message-Id: <200510131726.j9DHQCk0067363@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin To: Perforce Change Reviews Cc: Subject: PERFORCE change 85221 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Oct 2005 17:26:14 -0000 http://perforce.freebsd.org/chv.cgi?CH=85221 Change 85221 by jhb@jhb_slimer on 2005/10/13 17:26:01 Try to use memory operands in atomic operations and add missing constraints to let the compiler know that the memory is modified for the userland atomic operations. Affected files ... .. //depot/projects/smpng/sys/arm/include/atomic.h#19 edit Differences ... ==== //depot/projects/smpng/sys/arm/include/atomic.h#19 (text+ko) ==== @@ -77,9 +77,9 @@ static __inline uint32_t __swp(uint32_t val, volatile uint32_t *ptr) { - __asm __volatile("swp %0, %2, [%3]" + __asm __volatile("swp %0, %2, %1" : "=&r" (val), "=m" (*ptr) - : "r" (val) , "r" (ptr), "m" (*ptr) + : "r" (val) , "m" (*ptr) : "memory"); return (val); } @@ -154,16 +154,17 @@ "adr %1, 1b\n" "mov %0, #0xe0000004\n" "str %1, [%0]\n" - "ldr %1, [%2]\n" + "ldr %1, %2\n" "cmp %1, %3\n" - "streq %4, [%2]\n" + "streq %4, %2\n" "2:\n" "mov %1, #0\n" "str %1, [%0]\n" "moveq %1, #1\n" "movne %1, #0\n" : "=r" (ras_start), "=r" (done) - ,"+r" (p), "+r" (cmpval), "+r" (newval)); + ,"=m" (*p), "+r" (cmpval), "+r" (newval) + : "m" (*p)); return (done); } @@ -179,13 +180,14 @@ "adr %1, 1b\n" "mov %0, #0xe0000004\n" "str %1, [%0]\n" - "ldr %1, [%2]\n" + "ldr %1, %2\n" "add %1, %1, %3\n" - "str %1, [%2]\n" + "str %1, %2\n" "2:\n" "mov %1, #0\n" "str %1, [%0]\n" - : "=r" (ras_start), "=r" (start), "+r" (p), "+r" (val)); + : "=r" (ras_start), "=r" (start), "=m" (*p), "+r" (val) + : "m" (*p)); } static __inline void @@ -200,14 +202,15 @@ "adr %1, 1b\n" "mov %0, #0xe0000004\n" "str %1, [%0]\n" - "ldr %1, [%2]\n" + "ldr %1, %2\n" "sub %1, %1, %3\n" - "str %1, [%2]\n" + "str %1, %2\n" "2:\n" "mov %1, #0\n" "str %1, [%0]\n" - : "=r" (ras_start), "=r" (start), "+r" (p), "+r" (val)); + : "=r" (ras_start), "=r" (start), "=m" (*p), "+r" (val) + : "m" (*p)); } static __inline void @@ -222,14 +225,15 @@ "adr %1, 1b\n" "mov %0, #0xe0000004\n" "str %1, [%0]\n" - "ldr %1, [%2]\n" + "ldr %1, %2\n" "orr %1, %1, %3\n" - "str %1, [%2]\n" + "str %1, %2\n" "2:\n" "mov %1, #0\n" "str %1, [%0]\n" - : "=r" (ras_start), "=r" (start), "+r" (address), "+r" (setmask)); + : "=r" (ras_start), "=r" (start), "=m" (*address), "+r" (setmask) + : "m" (*address)); } static __inline void @@ -244,13 +248,14 @@ "adr %1, 1b\n" "mov %0, #0xe0000004\n" "str %1, [%0]\n" - "ldr %1, [%2]\n" + "ldr %1, %2\n" "bic %1, %1, %3\n" - "str %1, [%2]\n" + "str %1, %2\n" "2:\n" "mov %1, #0\n" "str %1, [%0]\n" - : "=r" (ras_start), "=r" (start), "+r" (address), "+r" (clearmask)); + : "=r" (ras_start), "=r" (start), "=m" (*address), "+r" (clearmask) + : "m" (*address)); } @@ -272,7 +277,8 @@ "2:\n" "mov %3, #0\n" "str %3, [%0]\n" - : "=r" (ras_start), "=r" (start), "=m" (*p), "+r" (v)); + : "=r" (ras_start), "=r" (start), "=m" (*p), "+r" (v) + : "m" (*p)); return (start); }