xref: /titanic_50/usr/src/uts/sparc/nskern/nsc_asm.s (revision 8e7248e505faa19396d4e853604e3fa7cd2cb3b5)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21/*
22 * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23 * Use is subject to license terms.
24 */
25
26#if defined(lint) || defined(DS_DDICT)
27#include <sys/types.h>
28#include <sys/param.h>
29#else
30#include <sys/asm_linkage.h>
31#endif
32
33#ifdef DS_DDICT
34#define	uint8_t	uchar_t
35#endif
36
37
38/*
39 * Special support routines that can't be done with C
40 */
41
42
43/*
44 * uint8_t nsc_ldstub(uint8_t *cp)
45 *
46 * Store 0xFF at the specified location, and return its previous content.
47 */
48
49#if defined(lint) || defined(DS_DDICT)
50uint8_t
51nsc_ldstub(uint8_t *cp)
52{
53	uint8_t rv;
54	rv = *cp;
55	*cp = 0xFF;
56	return (rv);
57}
58#else
59
60	ENTRY(nsc_ldstub)
61	retl
62	ldstub	[%o0], %o0
63	SET_SIZE(nsc_ldstub)
64
65#endif	/* lint || DS_DDICT */
66
67
68/*
69 * nsc_membar_stld(void)
70 *
71 * C callable interface to SPARC asm membar instruction.
72 */
73
74#if defined(lint) || defined(DS_DDICT)
75void
76nsc_membar_stld(void)
77{}
78#else
79
80	ENTRY(nsc_membar_stld)
81	retl
82	membar	#StoreLoad
83	SET_SIZE(nsc_membar_stld)
84
85#endif	/* lint || DS_DDICT */
86
87
88/*
89 * if a() calls b() calls nsc_caller(),
90 * nsc_caller() returns return address in a().
91 */
92
93#if defined(lint) || defined(DS_DDICT)
94caddr_t
95nsc_caller(void)
96{
97	return (0);
98}
99#else
100
101	ENTRY(nsc_caller)
102	retl
103	mov	%i7, %o0
104	SET_SIZE(nsc_caller)
105
106#endif  /* lint || DS_DDICT */
107
108
109/*
110 * if a() calls nsc_callee(), nsc_callee() returns the
111 * return address in a();
112 */
113
114#if defined(lint) || defined(DS_DDICT)
115caddr_t
116nsc_callee(void)
117{
118	return (0);
119}
120#else
121
122	ENTRY(nsc_callee)
123	.register %g7, #scratch
124	retl
125	mov	%o7, %o0
126	SET_SIZE(nsc_callee)
127
128#endif  /* lint || DS_DDICT */
129
130
131/*
132 * nsc_threadp(void)
133 *
134 * C callable interface to get the current thread pointer.
135 */
136
137#if defined(lint) || defined(DS_DDICT)
138void *
139nsc_threadp(void)
140{
141       return (NULL);
142}
143#else
144
145       ENTRY(nsc_threadp)
146       retl
147       mov %g7, %o0
148       SET_SIZE(nsc_threadp)
149
150#endif /* lint || DS_DDICT */
151