atomic.h (273667) | atomic.h (278613) |
---|---|
1/* $NetBSD: atomic.h,v 1.1 2002/10/19 12:22:34 bsh Exp $ */ 2 3/*- 4 * Copyright (C) 2003-2004 Olivier Houchard 5 * Copyright (C) 1994-1997 Mark Brinicombe 6 * Copyright (C) 1994 Brini 7 * All rights reserved. 8 * --- 19 unchanged lines hidden (view full) --- 28 * IN NO EVENT SHALL BRINI BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 30 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 31 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 32 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 33 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 34 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 * | 1/* $NetBSD: atomic.h,v 1.1 2002/10/19 12:22:34 bsh Exp $ */ 2 3/*- 4 * Copyright (C) 2003-2004 Olivier Houchard 5 * Copyright (C) 1994-1997 Mark Brinicombe 6 * Copyright (C) 1994 Brini 7 * All rights reserved. 8 * --- 19 unchanged lines hidden (view full) --- 28 * IN NO EVENT SHALL BRINI BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 30 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 31 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 32 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 33 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 34 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 * |
36 * $FreeBSD: stable/10/sys/arm/include/atomic.h 273667 2014-10-26 03:13:19Z ian $ | 36 * $FreeBSD: stable/10/sys/arm/include/atomic.h 278613 2015-02-12 03:50:33Z ian $ |
37 */ 38 39#ifndef _MACHINE_ATOMIC_H_ 40#define _MACHINE_ATOMIC_H_ 41 42#include <sys/types.h> | 37 */ 38 39#ifndef _MACHINE_ATOMIC_H_ 40#define _MACHINE_ATOMIC_H_ 41 42#include <sys/types.h> |
43#include <machine/armreg.h> |
|
43 44#ifndef _KERNEL 45#include <machine/sysarch.h> 46#else 47#include <machine/cpuconf.h> 48#endif 49 50#if defined (__ARM_ARCH_7__) || defined (__ARM_ARCH_7A__) --- 11 unchanged lines hidden (view full) --- 62#define dsb() __asm __volatile("mcr p15, 0, %0, c7, c10, 4" : : "r" (0) : "memory") 63#define dmb() dsb() 64#endif 65 66#define mb() dmb() 67#define wmb() dmb() 68#define rmb() dmb() 69 | 44 45#ifndef _KERNEL 46#include <machine/sysarch.h> 47#else 48#include <machine/cpuconf.h> 49#endif 50 51#if defined (__ARM_ARCH_7__) || defined (__ARM_ARCH_7A__) --- 11 unchanged lines hidden (view full) --- 63#define dsb() __asm __volatile("mcr p15, 0, %0, c7, c10, 4" : : "r" (0) : "memory") 64#define dmb() dsb() 65#endif 66 67#define mb() dmb() 68#define wmb() dmb() 69#define rmb() dmb() 70 |
70#ifndef I32_bit 71#define I32_bit (1 << 7) /* IRQ disable */ 72#endif 73#ifndef F32_bit 74#define F32_bit (1 << 6) /* FIQ disable */ 75#endif | |
76 | 71 |
72 |
|
77/* 78 * It would be nice to use _HAVE_ARMv6_INSTRUCTIONS from machine/asm.h 79 * here, but that header can't be included here because this is C 80 * code. I would like to move the _HAVE_ARMv6_INSTRUCTIONS definition 81 * out of asm.h so it can be used in both asm and C code. - kientzle@ 82 */ 83#if defined (__ARM_ARCH_7__) || \ 84 defined (__ARM_ARCH_7A__) || \ --- 612 unchanged lines hidden (view full) --- 697 do { \ 698 u_int cpsr_save, tmp; \ 699 \ 700 __asm __volatile( \ 701 "mrs %0, cpsr;" \ 702 "orr %1, %0, %2;" \ 703 "msr cpsr_fsxc, %1;" \ 704 : "=r" (cpsr_save), "=r" (tmp) \ | 73/* 74 * It would be nice to use _HAVE_ARMv6_INSTRUCTIONS from machine/asm.h 75 * here, but that header can't be included here because this is C 76 * code. I would like to move the _HAVE_ARMv6_INSTRUCTIONS definition 77 * out of asm.h so it can be used in both asm and C code. - kientzle@ 78 */ 79#if defined (__ARM_ARCH_7__) || \ 80 defined (__ARM_ARCH_7A__) || \ --- 612 unchanged lines hidden (view full) --- 693 do { \ 694 u_int cpsr_save, tmp; \ 695 \ 696 __asm __volatile( \ 697 "mrs %0, cpsr;" \ 698 "orr %1, %0, %2;" \ 699 "msr cpsr_fsxc, %1;" \ 700 : "=r" (cpsr_save), "=r" (tmp) \ |
705 : "I" (I32_bit | F32_bit) \ | 701 : "I" (PSR_I | PSR_F) \ |
706 : "cc" ); \ 707 (expr); \ 708 __asm __volatile( \ 709 "msr cpsr_fsxc, %0" \ 710 : /* no output */ \ 711 : "r" (cpsr_save) \ 712 : "cc" ); \ 713 } while(0) --- 425 unchanged lines hidden --- | 702 : "cc" ); \ 703 (expr); \ 704 __asm __volatile( \ 705 "msr cpsr_fsxc, %0" \ 706 : /* no output */ \ 707 : "r" (cpsr_save) \ 708 : "cc" ); \ 709 } while(0) --- 425 unchanged lines hidden --- |