xref: /titanic_52/usr/src/lib/libc/sparcv9/gen/smt_pause.s (revision e2c5185af3c50d9510e5df68aa37abdc6c0d3aac)
1*e2c5185aSChristopher Kiick/*
2*e2c5185aSChristopher Kiick * CDDL HEADER START
3*e2c5185aSChristopher Kiick *
4*e2c5185aSChristopher Kiick * The contents of this file are subject to the terms of the
5*e2c5185aSChristopher Kiick * Common Development and Distribution License (the "License").
6*e2c5185aSChristopher Kiick * You may not use this file except in compliance with the License.
7*e2c5185aSChristopher Kiick *
8*e2c5185aSChristopher Kiick * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*e2c5185aSChristopher Kiick * or http://www.opensolaris.org/os/licensing.
10*e2c5185aSChristopher Kiick * See the License for the specific language governing permissions
11*e2c5185aSChristopher Kiick * and limitations under the License.
12*e2c5185aSChristopher Kiick *
13*e2c5185aSChristopher Kiick * When distributing Covered Code, include this CDDL HEADER in each
14*e2c5185aSChristopher Kiick * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*e2c5185aSChristopher Kiick * If applicable, add the following below this CDDL HEADER, with the
16*e2c5185aSChristopher Kiick * fields enclosed by brackets "[]" replaced with your own identifying
17*e2c5185aSChristopher Kiick * information: Portions Copyright [yyyy] [name of copyright owner]
18*e2c5185aSChristopher Kiick *
19*e2c5185aSChristopher Kiick * CDDL HEADER END
20*e2c5185aSChristopher Kiick */
21*e2c5185aSChristopher Kiick/*
22*e2c5185aSChristopher Kiick * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
23*e2c5185aSChristopher Kiick */
24*e2c5185aSChristopher Kiick
25*e2c5185aSChristopher Kiick	.file	"smt_pause.s"
26*e2c5185aSChristopher Kiick
27*e2c5185aSChristopher Kiick#include <sys/asm_linkage.h>
28*e2c5185aSChristopher Kiick#include <../assym.h>
29*e2c5185aSChristopher Kiick
30*e2c5185aSChristopher Kiick/*
31*e2c5185aSChristopher Kiick * void smt_pause(void)
32*e2c5185aSChristopher Kiick *
33*e2c5185aSChristopher Kiick * Do nothing efficiently.
34*e2c5185aSChristopher Kiick */
35*e2c5185aSChristopher Kiick
36*e2c5185aSChristopher Kiick#ifdef lint
37*e2c5185aSChristopher Kiickvoid
38*e2c5185aSChristopher Kiicksmt_pause(void)
39*e2c5185aSChristopher Kiick{
40*e2c5185aSChristopher Kiick}
41*e2c5185aSChristopher Kiick#else
42*e2c5185aSChristopher Kiick#define	BANKS	(4 * 64)
43*e2c5185aSChristopher Kiick	ENTRY(smt_pause)
44*e2c5185aSChristopher Kiick	save %sp, -SA(MINFRAME+BANKS), %sp
45*e2c5185aSChristopher Kiick	ld      [%g7 + UL_LWPID], %i3   ! curthread->ul_lwpid
46*e2c5185aSChristopher Kiick	add	%fp, STACK_BIAS-BANKS, %i0
47*e2c5185aSChristopher Kiick	and     %i3, 0x3, %i2           ! save last 2 bits
48*e2c5185aSChristopher Kiick	sllx    %i2, 0x6, %i1           ! pick a slot
49*e2c5185aSChristopher Kiick	add     %i1, %i0, %o0
50*e2c5185aSChristopher Kiick	casx    [%o0], %g0, %g0
51*e2c5185aSChristopher Kiick	casx    [%o0], %g0, %g0
52*e2c5185aSChristopher Kiick	ret
53*e2c5185aSChristopher Kiick	restore
54*e2c5185aSChristopher Kiick	SET_SIZE(smt_pause)
55*e2c5185aSChristopher Kiick#endif
56