2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License (the "License").
2N/A * You may not use this file except in compliance with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A/*
2N/A * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
2N/A * Use is subject to license terms.
2N/A */
2N/A
2N/A#pragma ident "%Z%%M% %I% %E% SMI"
2N/A
2N/A .inline _curthread, 0
2N/A .register %g7, #scratch
2N/A mov %g7, %o0
2N/A .end
2N/A
2N/A .inline __curthread, 0
2N/A .register %g7, #scratch
2N/A ld [%g7 + 80], %o0 ! ul_self
2N/A .end
2N/A
2N/A .inline stkptr, 0
2N/A mov %sp, %o0
2N/A .end
2N/A
2N/A .inline gethrtime, 0
2N/A ta 0x24
2N/A .end
2N/A
2N/A .inline set_lock_byte, 0
2N/A ldstub [%o0], %o0
2N/A .end
2N/A
2N/A /*
2N/A * When compiling with -xarch=v8, the compiler refuses to
2N/A * accept the 'cas' instruction, so we encode it in hex below.
2N/A * We can't compile the 32-bit libc with -xarch=v8plus because
2N/A * then %g5 would become a scratch register and we would break
2N/A * 32-bit applications that use %g5 as an invariant register.
2N/A */
2N/A
2N/A .inline atomic_cas_32, 0
2N/A .word 0xd5e21009 ! cas [%o0], %o1, %o2
2N/A mov %o2, %o0
2N/A .end
2N/A
2N/A .inline atomic_swap_32, 0
2N/A ld [%o0], %o2
2N/A1:
2N/A mov %o1, %o3
2N/A .word 0xd7e2100a ! cas [%o0], %o2, %o3
2N/A cmp %o2, %o3
2N/A bne,a 1b
2N/A mov %o3, %o2
2N/A mov %o3, %o0
2N/A .end
2N/A
2N/A .inline atomic_inc_32, 0
2N/A ld [%o0], %o2
2N/A1:
2N/A add %o2, 1, %o3
2N/A .word 0xd7e2100a ! cas [%o0], %o2, %o3
2N/A cmp %o2, %o3
2N/A bne,a 1b
2N/A mov %o3, %o2
2N/A .end
2N/A
2N/A .inline atomic_dec_32, 0
2N/A ld [%o0], %o2
2N/A1:
2N/A sub %o2, 1, %o3
2N/A .word 0xd7e2100a ! cas [%o0], %o2, %o3
2N/A cmp %o2, %o3
2N/A bne,a 1b
2N/A mov %o3, %o2
2N/A .end
2N/A
2N/A .inline atomic_and_32, 0
2N/A ld [%o0], %o2
2N/A1:
2N/A and %o2, %o1, %o3
2N/A .word 0xd7e2100a ! cas [%o0], %o2, %o3
2N/A cmp %o2, %o3
2N/A bne,a 1b
2N/A mov %o3, %o2
2N/A .end
2N/A
2N/A .inline atomic_or_32, 0
2N/A ld [%o0], %o2
2N/A1:
2N/A or %o2, %o1, %o3
2N/A .word 0xd7e2100a ! cas [%o0], %o2, %o3
2N/A cmp %o2, %o3
2N/A bne,a 1b
2N/A mov %o3, %o2
2N/A .end
2N/A
2N/A .inline caller, 0
2N/A mov %i7, %o0
2N/A .end
2N/A
2N/A .inline getfp, 0
2N/A mov %fp, %o0
2N/A .end