xref: /illumos-gate/usr/src/uts/sun4/ml/subr_asm.S (revision 5d9d9091f564c198a760790b0bfa72c44e17912b)
1*5d9d9091SRichard Lowe/*
2*5d9d9091SRichard Lowe * CDDL HEADER START
3*5d9d9091SRichard Lowe *
4*5d9d9091SRichard Lowe * The contents of this file are subject to the terms of the
5*5d9d9091SRichard Lowe * Common Development and Distribution License (the "License").
6*5d9d9091SRichard Lowe * You may not use this file except in compliance with the License.
7*5d9d9091SRichard Lowe *
8*5d9d9091SRichard Lowe * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*5d9d9091SRichard Lowe * or http://www.opensolaris.org/os/licensing.
10*5d9d9091SRichard Lowe * See the License for the specific language governing permissions
11*5d9d9091SRichard Lowe * and limitations under the License.
12*5d9d9091SRichard Lowe *
13*5d9d9091SRichard Lowe * When distributing Covered Code, include this CDDL HEADER in each
14*5d9d9091SRichard Lowe * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*5d9d9091SRichard Lowe * If applicable, add the following below this CDDL HEADER, with the
16*5d9d9091SRichard Lowe * fields enclosed by brackets "[]" replaced with your own identifying
17*5d9d9091SRichard Lowe * information: Portions Copyright [yyyy] [name of copyright owner]
18*5d9d9091SRichard Lowe *
19*5d9d9091SRichard Lowe * CDDL HEADER END
20*5d9d9091SRichard Lowe */
21*5d9d9091SRichard Lowe/*
22*5d9d9091SRichard Lowe * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23*5d9d9091SRichard Lowe * Use is subject to license terms.
24*5d9d9091SRichard Lowe */
25*5d9d9091SRichard Lowe
26*5d9d9091SRichard Lowe/*
27*5d9d9091SRichard Lowe * General machine architecture & implementation specific
28*5d9d9091SRichard Lowe * assembly language routines.
29*5d9d9091SRichard Lowe */
30*5d9d9091SRichard Lowe#include "assym.h"
31*5d9d9091SRichard Lowe
32*5d9d9091SRichard Lowe#include <sys/asm_linkage.h>
33*5d9d9091SRichard Lowe#include <sys/async.h>
34*5d9d9091SRichard Lowe#include <sys/machthread.h>
35*5d9d9091SRichard Lowe#include <sys/vis.h>
36*5d9d9091SRichard Lowe#include <sys/machsig.h>
37*5d9d9091SRichard Lowe
38*5d9d9091SRichard Lowe	ENTRY(set_trap_table)
39*5d9d9091SRichard Lowe	set	trap_table, %o1
40*5d9d9091SRichard Lowe	rdpr	%tba, %o0
41*5d9d9091SRichard Lowe	wrpr	%o1, %tba
42*5d9d9091SRichard Lowe	retl
43*5d9d9091SRichard Lowe	wrpr	%g0, WSTATE_KERN, %wstate
44*5d9d9091SRichard Lowe	SET_SIZE(set_trap_table)
45*5d9d9091SRichard Lowe
46*5d9d9091SRichard Lowe	! Store long word value at physical address
47*5d9d9091SRichard Lowe	!
48*5d9d9091SRichard Lowe	! void  stdphys(uint64_t physaddr, uint64_t value)
49*5d9d9091SRichard Lowe	!
50*5d9d9091SRichard Lowe	ENTRY(stdphys)
51*5d9d9091SRichard Lowe	/*
52*5d9d9091SRichard Lowe	 * disable interrupts, clear Address Mask to access 64 bit physaddr
53*5d9d9091SRichard Lowe	 */
54*5d9d9091SRichard Lowe	rdpr	%pstate, %o4
55*5d9d9091SRichard Lowe	andn	%o4, PSTATE_IE | PSTATE_AM, %o5
56*5d9d9091SRichard Lowe	wrpr	%o5, 0, %pstate
57*5d9d9091SRichard Lowe	stxa	%o1, [%o0]ASI_MEM
58*5d9d9091SRichard Lowe	retl
59*5d9d9091SRichard Lowe	wrpr	%g0, %o4, %pstate	! restore earlier pstate register value
60*5d9d9091SRichard Lowe	SET_SIZE(stdphys)
61*5d9d9091SRichard Lowe
62*5d9d9091SRichard Lowe
63*5d9d9091SRichard Lowe	! Store long word value at physical i/o address
64*5d9d9091SRichard Lowe	!
65*5d9d9091SRichard Lowe	! void  stdphysio(u_longlong_t physaddr, u_longlong_t value)
66*5d9d9091SRichard Lowe	!
67*5d9d9091SRichard Lowe	ENTRY(stdphysio)
68*5d9d9091SRichard Lowe	/*
69*5d9d9091SRichard Lowe	 * disable interrupts, clear Address Mask to access 64 bit physaddr
70*5d9d9091SRichard Lowe	 */
71*5d9d9091SRichard Lowe	rdpr	%pstate, %o4
72*5d9d9091SRichard Lowe	andn	%o4, PSTATE_IE | PSTATE_AM, %o5
73*5d9d9091SRichard Lowe	wrpr	%o5, 0, %pstate		! clear IE, AM bits
74*5d9d9091SRichard Lowe	stxa	%o1, [%o0]ASI_IO
75*5d9d9091SRichard Lowe	retl
76*5d9d9091SRichard Lowe	wrpr	%g0, %o4, %pstate	! restore earlier pstate register value
77*5d9d9091SRichard Lowe	SET_SIZE(stdphysio)
78*5d9d9091SRichard Lowe
79*5d9d9091SRichard Lowe
80*5d9d9091SRichard Lowe	!
81*5d9d9091SRichard Lowe	! Load long word value at physical address
82*5d9d9091SRichard Lowe	!
83*5d9d9091SRichard Lowe	! uint64_t lddphys(uint64_t physaddr)
84*5d9d9091SRichard Lowe	!
85*5d9d9091SRichard Lowe	ENTRY(lddphys)
86*5d9d9091SRichard Lowe	rdpr	%pstate, %o4
87*5d9d9091SRichard Lowe	andn	%o4, PSTATE_IE | PSTATE_AM, %o5
88*5d9d9091SRichard Lowe	wrpr	%o5, 0, %pstate
89*5d9d9091SRichard Lowe	ldxa	[%o0]ASI_MEM, %o0
90*5d9d9091SRichard Lowe	retl
91*5d9d9091SRichard Lowe	wrpr	%g0, %o4, %pstate	! restore earlier pstate register value
92*5d9d9091SRichard Lowe	SET_SIZE(lddphys)
93*5d9d9091SRichard Lowe
94*5d9d9091SRichard Lowe	!
95*5d9d9091SRichard Lowe	! Load long word value at physical i/o address
96*5d9d9091SRichard Lowe	!
97*5d9d9091SRichard Lowe	! unsigned long long lddphysio(u_longlong_t physaddr)
98*5d9d9091SRichard Lowe	!
99*5d9d9091SRichard Lowe	ENTRY(lddphysio)
100*5d9d9091SRichard Lowe	rdpr	%pstate, %o4
101*5d9d9091SRichard Lowe	andn	%o4, PSTATE_IE | PSTATE_AM, %o5
102*5d9d9091SRichard Lowe	wrpr	%o5, 0, %pstate	! clear IE, AM bits
103*5d9d9091SRichard Lowe	ldxa	[%o0]ASI_IO, %o0
104*5d9d9091SRichard Lowe	retl
105*5d9d9091SRichard Lowe	wrpr	%g0, %o4, %pstate	! restore earlier pstate register value
106*5d9d9091SRichard Lowe	SET_SIZE(lddphysio)
107*5d9d9091SRichard Lowe
108*5d9d9091SRichard Lowe	!
109*5d9d9091SRichard Lowe	! Store value at physical address
110*5d9d9091SRichard Lowe	!
111*5d9d9091SRichard Lowe	! void  stphys(uint64_t physaddr, int value)
112*5d9d9091SRichard Lowe	!
113*5d9d9091SRichard Lowe	ENTRY(stphys)
114*5d9d9091SRichard Lowe	rdpr	%pstate, %o4
115*5d9d9091SRichard Lowe	andn	%o4, PSTATE_IE | PSTATE_AM, %o5
116*5d9d9091SRichard Lowe	wrpr	%o5, 0, %pstate
117*5d9d9091SRichard Lowe	sta	%o1, [%o0]ASI_MEM
118*5d9d9091SRichard Lowe	retl
119*5d9d9091SRichard Lowe	wrpr	%g0, %o4, %pstate	! restore earlier pstate register value
120*5d9d9091SRichard Lowe	SET_SIZE(stphys)
121*5d9d9091SRichard Lowe
122*5d9d9091SRichard Lowe
123*5d9d9091SRichard Lowe	!
124*5d9d9091SRichard Lowe	! load value at physical address
125*5d9d9091SRichard Lowe	!
126*5d9d9091SRichard Lowe	! int   ldphys(uint64_t physaddr)
127*5d9d9091SRichard Lowe	!
128*5d9d9091SRichard Lowe	ENTRY(ldphys)
129*5d9d9091SRichard Lowe	rdpr	%pstate, %o4
130*5d9d9091SRichard Lowe	andn	%o4, PSTATE_IE | PSTATE_AM, %o5
131*5d9d9091SRichard Lowe	wrpr	%o5, 0, %pstate
132*5d9d9091SRichard Lowe	lda	[%o0]ASI_MEM, %o0
133*5d9d9091SRichard Lowe	srl	%o0, 0, %o0	! clear upper 32 bits
134*5d9d9091SRichard Lowe	retl
135*5d9d9091SRichard Lowe	wrpr	%g0, %o4, %pstate	! restore earlier pstate register value
136*5d9d9091SRichard Lowe	SET_SIZE(ldphys)
137*5d9d9091SRichard Lowe
138*5d9d9091SRichard Lowe	!
139*5d9d9091SRichard Lowe	! Store value into physical address in I/O space
140*5d9d9091SRichard Lowe	!
141*5d9d9091SRichard Lowe	! void stphysio(u_longlong_t physaddr, uint_t value)
142*5d9d9091SRichard Lowe	!
143*5d9d9091SRichard Lowe	ENTRY_NP(stphysio)
144*5d9d9091SRichard Lowe	rdpr	%pstate, %o4		/* read PSTATE reg */
145*5d9d9091SRichard Lowe	andn	%o4, PSTATE_IE | PSTATE_AM, %o5
146*5d9d9091SRichard Lowe	wrpr	%o5, 0, %pstate
147*5d9d9091SRichard Lowe	stwa	%o1, [%o0]ASI_IO	/* store value via bypass ASI */
148*5d9d9091SRichard Lowe	retl
149*5d9d9091SRichard Lowe	wrpr	%g0, %o4, %pstate	/* restore the PSTATE */
150*5d9d9091SRichard Lowe	SET_SIZE(stphysio)
151*5d9d9091SRichard Lowe
152*5d9d9091SRichard Lowe	!
153*5d9d9091SRichard Lowe	! Store value into physical address in I/O space
154*5d9d9091SRichard Lowe	!
155*5d9d9091SRichard Lowe	! void sthphysio(u_longlong_t physaddr, ushort_t value)
156*5d9d9091SRichard Lowe	!
157*5d9d9091SRichard Lowe	ENTRY_NP(sthphysio)
158*5d9d9091SRichard Lowe	rdpr	%pstate, %o4		/* read PSTATE reg */
159*5d9d9091SRichard Lowe	andn	%o4, PSTATE_IE | PSTATE_AM, %o5
160*5d9d9091SRichard Lowe	wrpr	%o5, 0, %pstate
161*5d9d9091SRichard Lowe	stha	%o1, [%o0]ASI_IO	/* store value via bypass ASI */
162*5d9d9091SRichard Lowe	retl
163*5d9d9091SRichard Lowe	wrpr	%g0, %o4, %pstate		/* restore the PSTATE */
164*5d9d9091SRichard Lowe	SET_SIZE(sthphysio)
165*5d9d9091SRichard Lowe
166*5d9d9091SRichard Lowe	!
167*5d9d9091SRichard Lowe	! Store value into one byte physical address in I/O space
168*5d9d9091SRichard Lowe	!
169*5d9d9091SRichard Lowe	! void stbphysio(u_longlong_t physaddr, uchar_t value)
170*5d9d9091SRichard Lowe	!
171*5d9d9091SRichard Lowe	ENTRY_NP(stbphysio)
172*5d9d9091SRichard Lowe	rdpr	%pstate, %o4		/* read PSTATE reg */
173*5d9d9091SRichard Lowe	andn	%o4, PSTATE_IE | PSTATE_AM, %o5
174*5d9d9091SRichard Lowe	wrpr	%o5, 0, %pstate
175*5d9d9091SRichard Lowe	stba	%o1, [%o0]ASI_IO	/* store byte via bypass ASI */
176*5d9d9091SRichard Lowe	retl
177*5d9d9091SRichard Lowe	wrpr	%g0, %o4, %pstate	/* restore the PSTATE */
178*5d9d9091SRichard Lowe	SET_SIZE(stbphysio)
179*5d9d9091SRichard Lowe
180*5d9d9091SRichard Lowe	!
181*5d9d9091SRichard Lowe	! load value at physical address in I/O space
182*5d9d9091SRichard Lowe	!
183*5d9d9091SRichard Lowe	! uint_t   ldphysio(u_longlong_t physaddr)
184*5d9d9091SRichard Lowe	!
185*5d9d9091SRichard Lowe	ENTRY_NP(ldphysio)
186*5d9d9091SRichard Lowe	rdpr	%pstate, %o4		/* read PSTATE reg */
187*5d9d9091SRichard Lowe	andn	%o4, PSTATE_IE | PSTATE_AM, %o5
188*5d9d9091SRichard Lowe	wrpr	%o5, 0, %pstate
189*5d9d9091SRichard Lowe	lduwa	[%o0]ASI_IO, %o0	/* load value via bypass ASI */
190*5d9d9091SRichard Lowe	retl
191*5d9d9091SRichard Lowe	wrpr	%g0, %o4, %pstate	/* restore pstate */
192*5d9d9091SRichard Lowe	SET_SIZE(ldphysio)
193*5d9d9091SRichard Lowe
194*5d9d9091SRichard Lowe	!
195*5d9d9091SRichard Lowe	! load value at physical address in I/O space
196*5d9d9091SRichard Lowe	!
197*5d9d9091SRichard Lowe	! ushort_t   ldhphysio(u_longlong_t physaddr)
198*5d9d9091SRichard Lowe	!
199*5d9d9091SRichard Lowe	ENTRY_NP(ldhphysio)
200*5d9d9091SRichard Lowe	rdpr	%pstate, %o4		/* read PSTATE reg */
201*5d9d9091SRichard Lowe	andn	%o4, PSTATE_IE | PSTATE_AM, %o5
202*5d9d9091SRichard Lowe	wrpr	%o5, 0, %pstate
203*5d9d9091SRichard Lowe	lduha	[%o0]ASI_IO, %o0	/* load value via bypass ASI */
204*5d9d9091SRichard Lowe	retl
205*5d9d9091SRichard Lowe	wrpr	%g0, %o4, %pstate	/* restore pstate */
206*5d9d9091SRichard Lowe	SET_SIZE(ldhphysio)
207*5d9d9091SRichard Lowe
208*5d9d9091SRichard Lowe	!
209*5d9d9091SRichard Lowe	! load byte value at physical address in I/O space
210*5d9d9091SRichard Lowe	!
211*5d9d9091SRichard Lowe	! uchar_t   ldbphysio(u_longlong_t physaddr)
212*5d9d9091SRichard Lowe	!
213*5d9d9091SRichard Lowe	ENTRY_NP(ldbphysio)
214*5d9d9091SRichard Lowe	rdpr	%pstate, %o4		/* read PSTATE reg */
215*5d9d9091SRichard Lowe	andn	%o4, PSTATE_IE | PSTATE_AM, %o5
216*5d9d9091SRichard Lowe	wrpr	%o5, 0, %pstate
217*5d9d9091SRichard Lowe	lduba	[%o0]ASI_IO, %o0	/* load value via bypass ASI */
218*5d9d9091SRichard Lowe	retl
219*5d9d9091SRichard Lowe	wrpr	%g0, %o4, %pstate	/* restore pstate */
220*5d9d9091SRichard Lowe	SET_SIZE(ldbphysio)
221*5d9d9091SRichard Lowe
222*5d9d9091SRichard Lowe/*
223*5d9d9091SRichard Lowe * save_gsr(kfpu_t *fp)
224*5d9d9091SRichard Lowe * Store the graphics status register
225*5d9d9091SRichard Lowe */
226*5d9d9091SRichard Lowe
227*5d9d9091SRichard Lowe	ENTRY_NP(save_gsr)
228*5d9d9091SRichard Lowe	rd	%gsr, %g2			! save gsr
229*5d9d9091SRichard Lowe	retl
230*5d9d9091SRichard Lowe	stx	%g2, [%o0 + FPU_GSR]
231*5d9d9091SRichard Lowe	SET_SIZE(save_gsr)
232*5d9d9091SRichard Lowe
233*5d9d9091SRichard Lowe	ENTRY_NP(restore_gsr)
234*5d9d9091SRichard Lowe	ldx	[%o0 + FPU_GSR], %g2
235*5d9d9091SRichard Lowe	wr	%g2, %g0, %gsr
236*5d9d9091SRichard Lowe	retl
237*5d9d9091SRichard Lowe	nop
238*5d9d9091SRichard Lowe	SET_SIZE(restore_gsr)
239*5d9d9091SRichard Lowe
240*5d9d9091SRichard Lowe/*
241*5d9d9091SRichard Lowe * uint64_t
242*5d9d9091SRichard Lowe * _fp_read_pgsr()
243*5d9d9091SRichard Lowe * Get the graphics status register info from fp and return it
244*5d9d9091SRichard Lowe */
245*5d9d9091SRichard Lowe
246*5d9d9091SRichard Lowe	ENTRY_NP(_fp_read_pgsr)
247*5d9d9091SRichard Lowe	retl
248*5d9d9091SRichard Lowe	rd	%gsr, %o0
249*5d9d9091SRichard Lowe	SET_SIZE(_fp_read_pgsr)
250*5d9d9091SRichard Lowe
251*5d9d9091SRichard Lowe
252*5d9d9091SRichard Lowe/*
253*5d9d9091SRichard Lowe * uint64_t
254*5d9d9091SRichard Lowe * get_gsr(kfpu_t *fp)
255*5d9d9091SRichard Lowe * Get the graphics status register info from fp and return it
256*5d9d9091SRichard Lowe */
257*5d9d9091SRichard Lowe
258*5d9d9091SRichard Lowe	ENTRY_NP(get_gsr)
259*5d9d9091SRichard Lowe	retl
260*5d9d9091SRichard Lowe	ldx	[%o0 + FPU_GSR], %o0
261*5d9d9091SRichard Lowe	SET_SIZE(get_gsr)
262*5d9d9091SRichard Lowe
263*5d9d9091SRichard Lowe/*
264*5d9d9091SRichard Lowe * _fp_write_pgsr(uint64_t *buf, kfpu_t *fp)
265*5d9d9091SRichard Lowe * Set the graphics status register info to fp from buf
266*5d9d9091SRichard Lowe */
267*5d9d9091SRichard Lowe
268*5d9d9091SRichard Lowe	ENTRY_NP(_fp_write_pgsr)
269*5d9d9091SRichard Lowe	retl
270*5d9d9091SRichard Lowe	mov	%o0, %gsr
271*5d9d9091SRichard Lowe	SET_SIZE(_fp_write_pgsr)
272*5d9d9091SRichard Lowe
273*5d9d9091SRichard Lowe/*
274*5d9d9091SRichard Lowe * set_gsr(uint64_t buf, kfpu_t *fp)
275*5d9d9091SRichard Lowe * Set the graphics status register info to fp from buf
276*5d9d9091SRichard Lowe */
277*5d9d9091SRichard Lowe
278*5d9d9091SRichard Lowe	ENTRY_NP(set_gsr)
279*5d9d9091SRichard Lowe	retl
280*5d9d9091SRichard Lowe	stx	%o0, [%o1 + FPU_GSR]
281*5d9d9091SRichard Lowe	SET_SIZE(set_gsr)
282*5d9d9091SRichard Lowe
283*5d9d9091SRichard Lowe	ENTRY_NP(kdi_cpu_index)
284*5d9d9091SRichard Lowe	CPU_INDEX(%g1, %g2)
285*5d9d9091SRichard Lowe	jmp	%g7
286*5d9d9091SRichard Lowe	nop
287*5d9d9091SRichard Lowe	SET_SIZE(kdi_cpu_index)
288*5d9d9091SRichard Lowe
289*5d9d9091SRichard Lowe	ENTRY_NP(kmdb_enter)
290*5d9d9091SRichard Lowe	t	ST_KMDB_TRAP
291*5d9d9091SRichard Lowe	retl
292*5d9d9091SRichard Lowe	nop
293*5d9d9091SRichard Lowe	SET_SIZE(kmdb_enter)
294*5d9d9091SRichard Lowe
295*5d9d9091SRichard Lowe/*
296*5d9d9091SRichard Lowe * The Spitfire floating point code has been changed not to use install/
297*5d9d9091SRichard Lowe * save/restore/fork/freectx() because of the special memcpy library
298*5d9d9091SRichard Lowe * routines, which will lose too much performance if they have to go
299*5d9d9091SRichard Lowe * through the fp_disabled trap (which used to call ctxop_install()). So
300*5d9d9091SRichard Lowe * now fp_save/fp_restore are called from resume, and they don't care
301*5d9d9091SRichard Lowe * whether floating point was enabled from the user program via the
302*5d9d9091SRichard Lowe * fp_enabled trap or from the memcpy library, which just turns on floating
303*5d9d9091SRichard Lowe * point in the fprs register itself. The new routine lwp_freeregs is
304*5d9d9091SRichard Lowe * called everywhere freectx is called, and code was added to the sun4u-
305*5d9d9091SRichard Lowe * specific version of lwp_forkregs (which is called everywhere forkctx
306*5d9d9091SRichard Lowe * is called) to handle forking the floating point registers.
307*5d9d9091SRichard Lowe *
308*5d9d9091SRichard Lowe * Note that for the fprs dirty upper/lower bits are not used for now,
309*5d9d9091SRichard Lowe * because the #instructions to determine if we need to use them is probably
310*5d9d9091SRichard Lowe * greater than the #insructions just using them. This is a possible future
311*5d9d9091SRichard Lowe * optimization, only do it with very careful benchmarking!
312*5d9d9091SRichard Lowe *
313*5d9d9091SRichard Lowe * The fp_fksave and and fp_load were split into two routines for the
314*5d9d9091SRichard Lowe * sake of efficiency between the getfpregs/xregs_getfpregs and
315*5d9d9091SRichard Lowe * setfpregs/xregs_setfpregs. But note that for saving and restoring
316*5d9d9091SRichard Lowe * context, both *must* happen. For prmachdep, aka access from [k]adb,
317*5d9d9091SRichard Lowe * it's OK if only one part happens.
318*5d9d9091SRichard Lowe */
319*5d9d9091SRichard Lowe
320*5d9d9091SRichard Lowe/*
321*5d9d9091SRichard Lowe * fp_save(kfpu_t *fp)
322*5d9d9091SRichard Lowe * fp_fksave(kfpu_t *fp)
323*5d9d9091SRichard Lowe * Store the floating point registers.
324*5d9d9091SRichard Lowe */
325*5d9d9091SRichard Lowe
326*5d9d9091SRichard Lowe	ENTRY_NP(fp_save)
327*5d9d9091SRichard Lowe	ALTENTRY(fp_fksave)
328*5d9d9091SRichard Lowe	BSTORE_FPREGS(%o0, %o1)			! store V9 regs
329*5d9d9091SRichard Lowe	retl
330*5d9d9091SRichard Lowe	stx	%fsr, [%o0 + FPU_FSR]		! store fsr
331*5d9d9091SRichard Lowe	SET_SIZE(fp_fksave)
332*5d9d9091SRichard Lowe	SET_SIZE(fp_save)
333*5d9d9091SRichard Lowe
334*5d9d9091SRichard Lowe/*
335*5d9d9091SRichard Lowe * fp_v8_fksave(kfpu_t *fp)
336*5d9d9091SRichard Lowe *
337*5d9d9091SRichard Lowe * This is like the above routine but only saves the lower half.
338*5d9d9091SRichard Lowe */
339*5d9d9091SRichard Lowe
340*5d9d9091SRichard Lowe	ENTRY_NP(fp_v8_fksave)
341*5d9d9091SRichard Lowe	BSTORE_V8_FPREGS(%o0, %o1)		! store V8 regs
342*5d9d9091SRichard Lowe	retl
343*5d9d9091SRichard Lowe	stx	%fsr, [%o0 + FPU_FSR]		! store fsr
344*5d9d9091SRichard Lowe	SET_SIZE(fp_v8_fksave)
345*5d9d9091SRichard Lowe
346*5d9d9091SRichard Lowe/*
347*5d9d9091SRichard Lowe * fp_v8p_fksave(kfpu_t *fp)
348*5d9d9091SRichard Lowe *
349*5d9d9091SRichard Lowe * This is like the above routine but only saves the upper half.
350*5d9d9091SRichard Lowe */
351*5d9d9091SRichard Lowe
352*5d9d9091SRichard Lowe	ENTRY_NP(fp_v8p_fksave)
353*5d9d9091SRichard Lowe	BSTORE_V8P_FPREGS(%o0, %o1)		! store V9 extra regs
354*5d9d9091SRichard Lowe	retl
355*5d9d9091SRichard Lowe	stx	%fsr, [%o0 + FPU_FSR]		! store fsr
356*5d9d9091SRichard Lowe	SET_SIZE(fp_v8p_fksave)
357*5d9d9091SRichard Lowe
358*5d9d9091SRichard Lowe/*
359*5d9d9091SRichard Lowe * fp_restore(kfpu_t *fp)
360*5d9d9091SRichard Lowe */
361*5d9d9091SRichard Lowe
362*5d9d9091SRichard Lowe	ENTRY_NP(fp_restore)
363*5d9d9091SRichard Lowe	BLOAD_FPREGS(%o0, %o1)			! load V9 regs
364*5d9d9091SRichard Lowe	retl
365*5d9d9091SRichard Lowe	ldx	[%o0 + FPU_FSR], %fsr		! restore fsr
366*5d9d9091SRichard Lowe	SET_SIZE(fp_restore)
367*5d9d9091SRichard Lowe
368*5d9d9091SRichard Lowe/*
369*5d9d9091SRichard Lowe * fp_v8_load(kfpu_t *fp)
370*5d9d9091SRichard Lowe */
371*5d9d9091SRichard Lowe
372*5d9d9091SRichard Lowe	ENTRY_NP(fp_v8_load)
373*5d9d9091SRichard Lowe	BLOAD_V8_FPREGS(%o0, %o1)		! load V8 regs
374*5d9d9091SRichard Lowe	retl
375*5d9d9091SRichard Lowe	ldx	[%o0 + FPU_FSR], %fsr		! restore fsr
376*5d9d9091SRichard Lowe	SET_SIZE(fp_v8_load)
377*5d9d9091SRichard Lowe
378*5d9d9091SRichard Lowe/*
379*5d9d9091SRichard Lowe * fp_v8p_load(kfpu_t *fp)
380*5d9d9091SRichard Lowe */
381*5d9d9091SRichard Lowe
382*5d9d9091SRichard Lowe	ENTRY_NP(fp_v8p_load)
383*5d9d9091SRichard Lowe	BLOAD_V8P_FPREGS(%o0, %o1)		! load V9 extra regs
384*5d9d9091SRichard Lowe	retl
385*5d9d9091SRichard Lowe	ldx	[%o0 + FPU_FSR], %fsr		! restore fsr
386*5d9d9091SRichard Lowe	SET_SIZE(fp_v8p_load)
387*5d9d9091SRichard Lowe
388