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