4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 .ident "%Z%%M% %I% %E% SMI"
32 #include <sys/asm_linkage.h>
35 ALTENTRY(atomic_add_64_nv)
38 movl 12(%esp), %edi // %edi = target address
40 movl 4(%edi), %edx // %edx:%eax = old value
43 movl 20(%esp), %ecx // %ecx:%ebx = delta
45 adcl %edx, %ecx // %ecx:%ebx = new value
47 cmpxchg8b (%edi) // try to stick it in
50 movl %ecx, %edx // return new value
54 SET_SIZE(atomic_add_64_nv)
55 SET_SIZE(atomic_add_64)
58 movl 4(%esp), %edx // %edx = target address
59 movb (%edx), %al // %al = old value
61 movl 8(%esp), %ecx // %ecx = delta
62 orb %al, %cl // %cl = new value
64 cmpxchgb %cl, (%edx) // try to stick it in
66 movzbl %cl, %eax // return new value
68 SET_SIZE(atomic_or_8_nv)
77 SET_SIZE(atomic_cas_ptr)
92 SET_SIZE(atomic_cas_64)
94 ENTRY(membar_producer)
98 SET_SIZE(membar_producer)