xref: /minix3/common/lib/libc/arch/sparc/atomic/membar_ops.S (revision b6cbf7203b080219de306404f8022a65b7884f33)
1*b6cbf720SGianluca Guida/*	$NetBSD: membar_ops.S,v 1.4 2008/05/25 15:56:12 chs Exp $	*/
2*b6cbf720SGianluca Guida
3*b6cbf720SGianluca Guida/*-
4*b6cbf720SGianluca Guida * Copyright (c) 2007 The NetBSD Foundation, Inc.
5*b6cbf720SGianluca Guida * All rights reserved.
6*b6cbf720SGianluca Guida *
7*b6cbf720SGianluca Guida * This code is derived from software contributed to The NetBSD Foundation
8*b6cbf720SGianluca Guida * by Jason R. Thorpe, and by Andrew Doran.
9*b6cbf720SGianluca Guida *
10*b6cbf720SGianluca Guida * Redistribution and use in source and binary forms, with or without
11*b6cbf720SGianluca Guida * modification, are permitted provided that the following conditions
12*b6cbf720SGianluca Guida * are met:
13*b6cbf720SGianluca Guida * 1. Redistributions of source code must retain the above copyright
14*b6cbf720SGianluca Guida *    notice, this list of conditions and the following disclaimer.
15*b6cbf720SGianluca Guida * 2. Redistributions in binary form must reproduce the above copyright
16*b6cbf720SGianluca Guida *    notice, this list of conditions and the following disclaimer in the
17*b6cbf720SGianluca Guida *    documentation and/or other materials provided with the distribution.
18*b6cbf720SGianluca Guida *
19*b6cbf720SGianluca Guida * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20*b6cbf720SGianluca Guida * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21*b6cbf720SGianluca Guida * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22*b6cbf720SGianluca Guida * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23*b6cbf720SGianluca Guida * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24*b6cbf720SGianluca Guida * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25*b6cbf720SGianluca Guida * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26*b6cbf720SGianluca Guida * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27*b6cbf720SGianluca Guida * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28*b6cbf720SGianluca Guida * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29*b6cbf720SGianluca Guida * POSSIBILITY OF SUCH DAMAGE.
30*b6cbf720SGianluca Guida */
31*b6cbf720SGianluca Guida
32*b6cbf720SGianluca Guida#include "atomic_op_asm.h"
33*b6cbf720SGianluca Guida
34*b6cbf720SGianluca Guida	.text
35*b6cbf720SGianluca Guida
36*b6cbf720SGianluca Guida/* These assume Total Store Order (TSO) */
37*b6cbf720SGianluca Guida
38*b6cbf720SGianluca GuidaENTRY(_membar_producer)
39*b6cbf720SGianluca Guida	retl
40*b6cbf720SGianluca Guida	 nop
41*b6cbf720SGianluca Guida
42*b6cbf720SGianluca GuidaENTRY(_membar_consumer)
43*b6cbf720SGianluca Guida	add	%sp, -112, %sp
44*b6cbf720SGianluca Guida	st	%g0, [%sp+100]
45*b6cbf720SGianluca Guida	retl
46*b6cbf720SGianluca Guida	 sub	%sp, -112, %sp
47*b6cbf720SGianluca Guida
48*b6cbf720SGianluca GuidaATOMIC_OP_ALIAS(membar_producer,_membar_producer)
49*b6cbf720SGianluca GuidaATOMIC_OP_ALIAS(membar_consumer,_membar_consumer)
50*b6cbf720SGianluca GuidaATOMIC_OP_ALIAS(membar_enter,_membar_consumer)
51*b6cbf720SGianluca GuidaSTRONG_ALIAS(_membar_enter,_membar_consumer)
52*b6cbf720SGianluca GuidaATOMIC_OP_ALIAS(membar_exit,_membar_consumer)
53*b6cbf720SGianluca GuidaSTRONG_ALIAS(_membar_exit,_membar_consumer)
54*b6cbf720SGianluca GuidaATOMIC_OP_ALIAS(membar_sync,_membar_consumer)
55*b6cbf720SGianluca GuidaSTRONG_ALIAS(_membar_sync,_membar_consumer)
56