xref: /titanic_44/usr/src/uts/sparc/v9/sys/privregs.h (revision 2c5124a1a74b6e8fcb1cf8eb9a8d46b5a583086f)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
52f0fcb93SJason Beloro  * Common Development and Distribution License (the "License").
62f0fcb93SJason Beloro  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*2c5124a1SPrashanth Sreenivasa  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef _SYS_PRIVREGS_H
277c478bd9Sstevel@tonic-gate #define	_SYS_PRIVREGS_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
307c478bd9Sstevel@tonic-gate extern "C" {
317c478bd9Sstevel@tonic-gate #endif
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate /*
347c478bd9Sstevel@tonic-gate  * This file is kernel isa dependent.
357c478bd9Sstevel@tonic-gate  */
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate #include <sys/fsr.h>
387c478bd9Sstevel@tonic-gate #include <v9/sys/asi.h>
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate /*
417c478bd9Sstevel@tonic-gate  * This file describes the cpu's privileged register set, and
427c478bd9Sstevel@tonic-gate  * how the machine state is saved on the stack when a trap occurs.
437c478bd9Sstevel@tonic-gate  */
447c478bd9Sstevel@tonic-gate 
457c478bd9Sstevel@tonic-gate #ifndef	_ASM
467c478bd9Sstevel@tonic-gate 
477c478bd9Sstevel@tonic-gate struct regs {
487c478bd9Sstevel@tonic-gate 	long long	r_tstate;
497c478bd9Sstevel@tonic-gate 	long long	r_g1;		/* user global regs */
507c478bd9Sstevel@tonic-gate 	long long	r_g2;
517c478bd9Sstevel@tonic-gate 	long long	r_g3;
527c478bd9Sstevel@tonic-gate 	long long	r_g4;
537c478bd9Sstevel@tonic-gate 	long long	r_g5;
547c478bd9Sstevel@tonic-gate 	long long	r_g6;
557c478bd9Sstevel@tonic-gate 	long long	r_g7;
567c478bd9Sstevel@tonic-gate 	long long	r_o0;
577c478bd9Sstevel@tonic-gate 	long long	r_o1;
587c478bd9Sstevel@tonic-gate 	long long	r_o2;
597c478bd9Sstevel@tonic-gate 	long long	r_o3;
607c478bd9Sstevel@tonic-gate 	long long	r_o4;
617c478bd9Sstevel@tonic-gate 	long long	r_o5;
627c478bd9Sstevel@tonic-gate 	long long	r_o6;
637c478bd9Sstevel@tonic-gate 	long long	r_o7;
647c478bd9Sstevel@tonic-gate 	/*
657c478bd9Sstevel@tonic-gate 	 * These are still 32b in 4u's v8/v9 hybrid
667c478bd9Sstevel@tonic-gate 	 */
677c478bd9Sstevel@tonic-gate 	long	r_pc;		/* program counter */
687c478bd9Sstevel@tonic-gate 	long	r_npc;		/* next program counter */
697c478bd9Sstevel@tonic-gate 	int	r_y;		/* the y register */
707c478bd9Sstevel@tonic-gate };
717c478bd9Sstevel@tonic-gate 
727c478bd9Sstevel@tonic-gate #define	r_ps	r_tstate
737c478bd9Sstevel@tonic-gate #define	r_sp	r_o6
747c478bd9Sstevel@tonic-gate 
757c478bd9Sstevel@tonic-gate #endif	/* _ASM */
767c478bd9Sstevel@tonic-gate 
777c478bd9Sstevel@tonic-gate #ifdef _KERNEL
787c478bd9Sstevel@tonic-gate 
797c478bd9Sstevel@tonic-gate #define	lwptoregs(lwp)	((struct regs *)((lwp)->lwp_regs))
807c478bd9Sstevel@tonic-gate #define	lwptofpu(lwp)	((kfpu_t *)((lwp)->lwp_fpu))
817c478bd9Sstevel@tonic-gate 
827c478bd9Sstevel@tonic-gate /*
837c478bd9Sstevel@tonic-gate  * Macros for saving/restoring registers.
847c478bd9Sstevel@tonic-gate  */
857c478bd9Sstevel@tonic-gate 
867c478bd9Sstevel@tonic-gate #define	SAVE_GLOBALS(RP) \
877c478bd9Sstevel@tonic-gate 	stx	%g1, [RP + G1_OFF]; \
887c478bd9Sstevel@tonic-gate 	stx	%g2, [RP + G2_OFF]; \
897c478bd9Sstevel@tonic-gate 	stx	%g3, [RP + G3_OFF]; \
907c478bd9Sstevel@tonic-gate 	stx	%g4, [RP + G4_OFF]; \
917c478bd9Sstevel@tonic-gate 	stx	%g5, [RP + G5_OFF]; \
927c478bd9Sstevel@tonic-gate 	stx	%g6, [RP + G6_OFF]; \
937c478bd9Sstevel@tonic-gate 	stx	%g7, [RP + G7_OFF]; \
947c478bd9Sstevel@tonic-gate 	mov	%y, %g1; \
957c478bd9Sstevel@tonic-gate 	st	%g1, [RP + Y_OFF];
967c478bd9Sstevel@tonic-gate 
977c478bd9Sstevel@tonic-gate #define	RESTORE_GLOBALS(RP) \
987c478bd9Sstevel@tonic-gate 	ld	[RP + Y_OFF], %g1; \
997c478bd9Sstevel@tonic-gate 	mov	%g1, %y; \
1007c478bd9Sstevel@tonic-gate 	ldx	[RP + G1_OFF], %g1; \
1017c478bd9Sstevel@tonic-gate 	ldx	[RP + G2_OFF], %g2; \
1027c478bd9Sstevel@tonic-gate 	ldx	[RP + G3_OFF], %g3; \
1037c478bd9Sstevel@tonic-gate 	ldx	[RP + G4_OFF], %g4; \
1047c478bd9Sstevel@tonic-gate 	ldx	[RP + G5_OFF], %g5; \
1057c478bd9Sstevel@tonic-gate 	ldx	[RP + G6_OFF], %g6; \
1067c478bd9Sstevel@tonic-gate 	ldx	[RP + G7_OFF], %g7;
1077c478bd9Sstevel@tonic-gate 
1087c478bd9Sstevel@tonic-gate #define	SAVE_OUTS(RP) \
1097c478bd9Sstevel@tonic-gate 	stx	%i0, [RP + O0_OFF]; \
1107c478bd9Sstevel@tonic-gate 	stx	%i1, [RP + O1_OFF]; \
1117c478bd9Sstevel@tonic-gate 	stx	%i2, [RP + O2_OFF]; \
1127c478bd9Sstevel@tonic-gate 	stx	%i3, [RP + O3_OFF]; \
1137c478bd9Sstevel@tonic-gate 	stx	%i4, [RP + O4_OFF]; \
1147c478bd9Sstevel@tonic-gate 	stx	%i5, [RP + O5_OFF]; \
1157c478bd9Sstevel@tonic-gate 	stx	%i6, [RP + O6_OFF]; \
1167c478bd9Sstevel@tonic-gate 	stx	%i7, [RP + O7_OFF];
1177c478bd9Sstevel@tonic-gate 
1187c478bd9Sstevel@tonic-gate #define	RESTORE_OUTS(RP) \
1197c478bd9Sstevel@tonic-gate 	ldx	[RP + O0_OFF], %i0; \
1207c478bd9Sstevel@tonic-gate 	ldx	[RP + O1_OFF], %i1; \
1217c478bd9Sstevel@tonic-gate 	ldx	[RP + O2_OFF], %i2; \
1227c478bd9Sstevel@tonic-gate 	ldx	[RP + O3_OFF], %i3; \
1237c478bd9Sstevel@tonic-gate 	ldx	[RP + O4_OFF], %i4; \
1247c478bd9Sstevel@tonic-gate 	ldx	[RP + O5_OFF], %i5; \
1257c478bd9Sstevel@tonic-gate 	ldx	[RP + O6_OFF], %i6; \
1267c478bd9Sstevel@tonic-gate 	ldx	[RP + O7_OFF], %i7;
1277c478bd9Sstevel@tonic-gate 
1287c478bd9Sstevel@tonic-gate #define	SAVE_V8WINDOW(SBP) \
1297c478bd9Sstevel@tonic-gate 	st	%l0, [SBP + (0*4)]; \
1307c478bd9Sstevel@tonic-gate 	st	%l1, [SBP + (1*4)]; \
1317c478bd9Sstevel@tonic-gate 	st	%l2, [SBP + (2*4)]; \
1327c478bd9Sstevel@tonic-gate 	st	%l3, [SBP + (3*4)]; \
1337c478bd9Sstevel@tonic-gate 	st	%l4, [SBP + (4*4)]; \
1347c478bd9Sstevel@tonic-gate 	st	%l5, [SBP + (5*4)]; \
1357c478bd9Sstevel@tonic-gate 	st	%l6, [SBP + (6*4)]; \
1367c478bd9Sstevel@tonic-gate 	st	%l7, [SBP + (7*4)]; \
1377c478bd9Sstevel@tonic-gate 	st	%i0, [SBP + (8*4)]; \
1387c478bd9Sstevel@tonic-gate 	st	%i1, [SBP + (9*4)]; \
1397c478bd9Sstevel@tonic-gate 	st	%i2, [SBP + (10*4)]; \
1407c478bd9Sstevel@tonic-gate 	st	%i3, [SBP + (11*4)]; \
1417c478bd9Sstevel@tonic-gate 	st	%i4, [SBP + (12*4)]; \
1427c478bd9Sstevel@tonic-gate 	st	%i5, [SBP + (13*4)]; \
1437c478bd9Sstevel@tonic-gate 	st	%i6, [SBP + (14*4)]; \
1447c478bd9Sstevel@tonic-gate 	st	%i7, [SBP + (15*4)];
1457c478bd9Sstevel@tonic-gate 
1467c478bd9Sstevel@tonic-gate #define	SAVE_V8WINDOW_ASI(SBP) \
1477c478bd9Sstevel@tonic-gate 	sta	%l0, [SBP + (0*4)]%asi; \
1487c478bd9Sstevel@tonic-gate 	sta	%l1, [SBP + (1*4)]%asi; \
1497c478bd9Sstevel@tonic-gate 	sta	%l2, [SBP + (2*4)]%asi; \
1507c478bd9Sstevel@tonic-gate 	sta	%l3, [SBP + (3*4)]%asi; \
1517c478bd9Sstevel@tonic-gate 	sta	%l4, [SBP + (4*4)]%asi; \
1527c478bd9Sstevel@tonic-gate 	sta	%l5, [SBP + (5*4)]%asi; \
1537c478bd9Sstevel@tonic-gate 	sta	%l6, [SBP + (6*4)]%asi; \
1547c478bd9Sstevel@tonic-gate 	sta	%l7, [SBP + (7*4)]%asi; \
1557c478bd9Sstevel@tonic-gate 	sta	%i0, [SBP + (8*4)]%asi; \
1567c478bd9Sstevel@tonic-gate 	sta	%i1, [SBP + (9*4)]%asi; \
1577c478bd9Sstevel@tonic-gate 	sta	%i2, [SBP + (10*4)]%asi; \
1587c478bd9Sstevel@tonic-gate 	sta	%i3, [SBP + (11*4)]%asi; \
1597c478bd9Sstevel@tonic-gate 	sta	%i4, [SBP + (12*4)]%asi; \
1607c478bd9Sstevel@tonic-gate 	sta	%i5, [SBP + (13*4)]%asi; \
1617c478bd9Sstevel@tonic-gate 	sta	%i6, [SBP + (14*4)]%asi; \
1627c478bd9Sstevel@tonic-gate 	sta	%i7, [SBP + (15*4)]%asi;
1637c478bd9Sstevel@tonic-gate 
1647c478bd9Sstevel@tonic-gate #define	RESTORE_V8WINDOW(SBP) \
1657c478bd9Sstevel@tonic-gate 	ld	[SBP + (0*4)], %l0; \
1667c478bd9Sstevel@tonic-gate 	ld	[SBP + (1*4)], %l1; \
1677c478bd9Sstevel@tonic-gate 	ld	[SBP + (2*4)], %l2; \
1687c478bd9Sstevel@tonic-gate 	ld	[SBP + (3*4)], %l3; \
1697c478bd9Sstevel@tonic-gate 	ld	[SBP + (4*4)], %l4; \
1707c478bd9Sstevel@tonic-gate 	ld	[SBP + (5*4)], %l5; \
1717c478bd9Sstevel@tonic-gate 	ld	[SBP + (6*4)], %l6; \
1727c478bd9Sstevel@tonic-gate 	ld	[SBP + (7*4)], %l7; \
1737c478bd9Sstevel@tonic-gate 	ld	[SBP + (8*4)], %i0; \
1747c478bd9Sstevel@tonic-gate 	ld	[SBP + (9*4)], %i1; \
1757c478bd9Sstevel@tonic-gate 	ld	[SBP + (10*4)], %i2; \
1767c478bd9Sstevel@tonic-gate 	ld	[SBP + (11*4)], %i3; \
1777c478bd9Sstevel@tonic-gate 	ld	[SBP + (12*4)], %i4; \
1787c478bd9Sstevel@tonic-gate 	ld	[SBP + (13*4)], %i5; \
1797c478bd9Sstevel@tonic-gate 	ld	[SBP + (14*4)], %i6; \
1807c478bd9Sstevel@tonic-gate 	ld	[SBP + (15*4)], %i7;
1817c478bd9Sstevel@tonic-gate 
1827c478bd9Sstevel@tonic-gate #define	SAVE_V9WINDOW(SBP) \
1837c478bd9Sstevel@tonic-gate 	stx	%l0, [SBP + (0*8)]; \
1847c478bd9Sstevel@tonic-gate 	stx	%l1, [SBP + (1*8)]; \
1857c478bd9Sstevel@tonic-gate 	stx	%l2, [SBP + (2*8)]; \
1867c478bd9Sstevel@tonic-gate 	stx	%l3, [SBP + (3*8)]; \
1877c478bd9Sstevel@tonic-gate 	stx	%l4, [SBP + (4*8)]; \
1887c478bd9Sstevel@tonic-gate 	stx	%l5, [SBP + (5*8)]; \
1897c478bd9Sstevel@tonic-gate 	stx	%l6, [SBP + (6*8)]; \
1907c478bd9Sstevel@tonic-gate 	stx	%l7, [SBP + (7*8)]; \
1917c478bd9Sstevel@tonic-gate 	stx	%i0, [SBP + (8*8)]; \
1927c478bd9Sstevel@tonic-gate 	stx	%i1, [SBP + (9*8)]; \
1937c478bd9Sstevel@tonic-gate 	stx	%i2, [SBP + (10*8)]; \
1947c478bd9Sstevel@tonic-gate 	stx	%i3, [SBP + (11*8)]; \
1957c478bd9Sstevel@tonic-gate 	stx	%i4, [SBP + (12*8)]; \
1967c478bd9Sstevel@tonic-gate 	stx	%i5, [SBP + (13*8)]; \
1977c478bd9Sstevel@tonic-gate 	stx	%i6, [SBP + (14*8)]; \
1987c478bd9Sstevel@tonic-gate 	stx	%i7, [SBP + (15*8)];
1997c478bd9Sstevel@tonic-gate 
2007c478bd9Sstevel@tonic-gate #define	SAVE_V9WINDOW_ASI(SBP) \
2017c478bd9Sstevel@tonic-gate 	stxa	%l0, [SBP + (0*8)]%asi; \
2027c478bd9Sstevel@tonic-gate 	stxa	%l1, [SBP + (1*8)]%asi; \
2037c478bd9Sstevel@tonic-gate 	stxa	%l2, [SBP + (2*8)]%asi; \
2047c478bd9Sstevel@tonic-gate 	stxa	%l3, [SBP + (3*8)]%asi; \
2057c478bd9Sstevel@tonic-gate 	stxa	%l4, [SBP + (4*8)]%asi; \
2067c478bd9Sstevel@tonic-gate 	stxa	%l5, [SBP + (5*8)]%asi; \
2077c478bd9Sstevel@tonic-gate 	stxa	%l6, [SBP + (6*8)]%asi; \
2087c478bd9Sstevel@tonic-gate 	stxa	%l7, [SBP + (7*8)]%asi; \
2097c478bd9Sstevel@tonic-gate 	stxa	%i0, [SBP + (8*8)]%asi; \
2107c478bd9Sstevel@tonic-gate 	stxa	%i1, [SBP + (9*8)]%asi; \
2117c478bd9Sstevel@tonic-gate 	stxa	%i2, [SBP + (10*8)]%asi; \
2127c478bd9Sstevel@tonic-gate 	stxa	%i3, [SBP + (11*8)]%asi; \
2137c478bd9Sstevel@tonic-gate 	stxa	%i4, [SBP + (12*8)]%asi; \
2147c478bd9Sstevel@tonic-gate 	stxa	%i5, [SBP + (13*8)]%asi; \
2157c478bd9Sstevel@tonic-gate 	stxa	%i6, [SBP + (14*8)]%asi; \
2167c478bd9Sstevel@tonic-gate 	stxa	%i7, [SBP + (15*8)]%asi;
2177c478bd9Sstevel@tonic-gate 
2187c478bd9Sstevel@tonic-gate #define	RESTORE_V9WINDOW(SBP) \
2197c478bd9Sstevel@tonic-gate 	ldx	[SBP + (0*8)], %l0; \
2207c478bd9Sstevel@tonic-gate 	ldx	[SBP + (1*8)], %l1; \
2217c478bd9Sstevel@tonic-gate 	ldx	[SBP + (2*8)], %l2; \
2227c478bd9Sstevel@tonic-gate 	ldx	[SBP + (3*8)], %l3; \
2237c478bd9Sstevel@tonic-gate 	ldx	[SBP + (4*8)], %l4; \
2247c478bd9Sstevel@tonic-gate 	ldx	[SBP + (5*8)], %l5; \
2257c478bd9Sstevel@tonic-gate 	ldx	[SBP + (6*8)], %l6; \
2267c478bd9Sstevel@tonic-gate 	ldx	[SBP + (7*8)], %l7; \
2277c478bd9Sstevel@tonic-gate 	ldx	[SBP + (8*8)], %i0; \
2287c478bd9Sstevel@tonic-gate 	ldx	[SBP + (9*8)], %i1; \
2297c478bd9Sstevel@tonic-gate 	ldx	[SBP + (10*8)], %i2; \
2307c478bd9Sstevel@tonic-gate 	ldx	[SBP + (11*8)], %i3; \
2317c478bd9Sstevel@tonic-gate 	ldx	[SBP + (12*8)], %i4; \
2327c478bd9Sstevel@tonic-gate 	ldx	[SBP + (13*8)], %i5; \
2337c478bd9Sstevel@tonic-gate 	ldx	[SBP + (14*8)], %i6; \
2347c478bd9Sstevel@tonic-gate 	ldx	[SBP + (15*8)], %i7;
2357c478bd9Sstevel@tonic-gate 
2367c478bd9Sstevel@tonic-gate #define	STORE_FPREGS(FP) \
2377c478bd9Sstevel@tonic-gate 	std	%f0, [FP]; \
2387c478bd9Sstevel@tonic-gate 	std	%f2, [FP + 8]; \
2397c478bd9Sstevel@tonic-gate 	std	%f4, [FP + 16]; \
2407c478bd9Sstevel@tonic-gate 	std	%f6, [FP + 24]; \
2417c478bd9Sstevel@tonic-gate 	std	%f8, [FP + 32]; \
2427c478bd9Sstevel@tonic-gate 	std	%f10, [FP + 40]; \
2437c478bd9Sstevel@tonic-gate 	std	%f12, [FP + 48]; \
2447c478bd9Sstevel@tonic-gate 	std	%f14, [FP + 56]; \
2457c478bd9Sstevel@tonic-gate 	std	%f16, [FP + 64]; \
2467c478bd9Sstevel@tonic-gate 	std	%f18, [FP + 72]; \
2477c478bd9Sstevel@tonic-gate 	std	%f20, [FP + 80]; \
2487c478bd9Sstevel@tonic-gate 	std	%f22, [FP + 88]; \
2497c478bd9Sstevel@tonic-gate 	std	%f24, [FP + 96]; \
2507c478bd9Sstevel@tonic-gate 	std	%f26, [FP + 104]; \
2517c478bd9Sstevel@tonic-gate 	std	%f28, [FP + 112]; \
2527c478bd9Sstevel@tonic-gate 	std	%f30, [FP + 120]; \
2537c478bd9Sstevel@tonic-gate 	std	%d32, [FP + 128]; \
2547c478bd9Sstevel@tonic-gate 	std	%d34, [FP + 136]; \
2557c478bd9Sstevel@tonic-gate 	std	%d36, [FP + 144]; \
2567c478bd9Sstevel@tonic-gate 	std	%d38, [FP + 152]; \
2577c478bd9Sstevel@tonic-gate 	std	%d40, [FP + 160]; \
2587c478bd9Sstevel@tonic-gate 	std	%d42, [FP + 168]; \
2597c478bd9Sstevel@tonic-gate 	std	%d44, [FP + 176]; \
2607c478bd9Sstevel@tonic-gate 	std	%d46, [FP + 184]; \
2617c478bd9Sstevel@tonic-gate 	std	%d48, [FP + 192]; \
2627c478bd9Sstevel@tonic-gate 	std	%d50, [FP + 200]; \
2637c478bd9Sstevel@tonic-gate 	std	%d52, [FP + 208]; \
2647c478bd9Sstevel@tonic-gate 	std	%d54, [FP + 216]; \
2657c478bd9Sstevel@tonic-gate 	std	%d56, [FP + 224]; \
2667c478bd9Sstevel@tonic-gate 	std	%d58, [FP + 232]; \
2677c478bd9Sstevel@tonic-gate 	std	%d60, [FP + 240]; \
2687c478bd9Sstevel@tonic-gate 	std	%d62, [FP + 248];
2697c478bd9Sstevel@tonic-gate 
2707c478bd9Sstevel@tonic-gate #define	LOAD_FPREGS(FP) \
2717c478bd9Sstevel@tonic-gate 	ldd	[FP], %f0; \
2727c478bd9Sstevel@tonic-gate 	ldd	[FP + 8], %f2; \
2737c478bd9Sstevel@tonic-gate 	ldd	[FP + 16], %f4; \
2747c478bd9Sstevel@tonic-gate 	ldd	[FP + 24], %f6; \
2757c478bd9Sstevel@tonic-gate 	ldd	[FP + 32], %f8; \
2767c478bd9Sstevel@tonic-gate 	ldd	[FP + 40], %f10; \
2777c478bd9Sstevel@tonic-gate 	ldd	[FP + 48], %f12; \
2787c478bd9Sstevel@tonic-gate 	ldd	[FP + 56], %f14; \
2797c478bd9Sstevel@tonic-gate 	ldd	[FP + 64], %f16; \
2807c478bd9Sstevel@tonic-gate 	ldd	[FP + 72], %f18; \
2817c478bd9Sstevel@tonic-gate 	ldd	[FP + 80], %f20; \
2827c478bd9Sstevel@tonic-gate 	ldd	[FP + 88], %f22; \
2837c478bd9Sstevel@tonic-gate 	ldd	[FP + 96], %f24; \
2847c478bd9Sstevel@tonic-gate 	ldd	[FP + 104], %f26; \
2857c478bd9Sstevel@tonic-gate 	ldd	[FP + 112], %f28; \
2867c478bd9Sstevel@tonic-gate 	ldd	[FP + 120], %f30; \
2877c478bd9Sstevel@tonic-gate 	ldd	[FP + 128], %d32; \
2887c478bd9Sstevel@tonic-gate 	ldd	[FP + 136], %d34; \
2897c478bd9Sstevel@tonic-gate 	ldd	[FP + 144], %d36; \
2907c478bd9Sstevel@tonic-gate 	ldd	[FP + 152], %d38; \
2917c478bd9Sstevel@tonic-gate 	ldd	[FP + 160], %d40; \
2927c478bd9Sstevel@tonic-gate 	ldd	[FP + 168], %d42; \
2937c478bd9Sstevel@tonic-gate 	ldd	[FP + 176], %d44; \
2947c478bd9Sstevel@tonic-gate 	ldd	[FP + 184], %d46; \
2957c478bd9Sstevel@tonic-gate 	ldd	[FP + 192], %d48; \
2967c478bd9Sstevel@tonic-gate 	ldd	[FP + 200], %d50; \
2977c478bd9Sstevel@tonic-gate 	ldd	[FP + 208], %d52; \
2987c478bd9Sstevel@tonic-gate 	ldd	[FP + 216], %d54; \
2997c478bd9Sstevel@tonic-gate 	ldd	[FP + 224], %d56; \
3007c478bd9Sstevel@tonic-gate 	ldd	[FP + 232], %d58; \
3017c478bd9Sstevel@tonic-gate 	ldd	[FP + 240], %d60; \
3027c478bd9Sstevel@tonic-gate 	ldd	[FP + 248], %d62;
3037c478bd9Sstevel@tonic-gate 
3047c478bd9Sstevel@tonic-gate #define	STORE_DL_FPREGS(FP) \
3057c478bd9Sstevel@tonic-gate 	std	%f0, [FP]; \
3067c478bd9Sstevel@tonic-gate 	std	%f2, [FP + 8]; \
3077c478bd9Sstevel@tonic-gate 	std	%f4, [FP + 16]; \
3087c478bd9Sstevel@tonic-gate 	std	%f6, [FP + 24]; \
3097c478bd9Sstevel@tonic-gate 	std	%f8, [FP + 32]; \
3107c478bd9Sstevel@tonic-gate 	std	%f10, [FP + 40]; \
3117c478bd9Sstevel@tonic-gate 	std	%f12, [FP + 48]; \
3127c478bd9Sstevel@tonic-gate 	std	%f14, [FP + 56]; \
3137c478bd9Sstevel@tonic-gate 	std	%f16, [FP + 64]; \
3147c478bd9Sstevel@tonic-gate 	std	%f18, [FP + 72]; \
3157c478bd9Sstevel@tonic-gate 	std	%f20, [FP + 80]; \
3167c478bd9Sstevel@tonic-gate 	std	%f22, [FP + 88]; \
3177c478bd9Sstevel@tonic-gate 	std	%f24, [FP + 96]; \
3187c478bd9Sstevel@tonic-gate 	std	%f26, [FP + 104]; \
3197c478bd9Sstevel@tonic-gate 	std	%f28, [FP + 112]; \
3207c478bd9Sstevel@tonic-gate 	std	%f30, [FP + 120];
3217c478bd9Sstevel@tonic-gate 
3227c478bd9Sstevel@tonic-gate #define	STORE_DU_FPREGS(FP) \
3237c478bd9Sstevel@tonic-gate 	std	%d32, [FP + 128]; \
3247c478bd9Sstevel@tonic-gate 	std	%d34, [FP + 136]; \
3257c478bd9Sstevel@tonic-gate 	std	%d36, [FP + 144]; \
3267c478bd9Sstevel@tonic-gate 	std	%d38, [FP + 152]; \
3277c478bd9Sstevel@tonic-gate 	std	%d40, [FP + 160]; \
3287c478bd9Sstevel@tonic-gate 	std	%d42, [FP + 168]; \
3297c478bd9Sstevel@tonic-gate 	std	%d44, [FP + 176]; \
3307c478bd9Sstevel@tonic-gate 	std	%d46, [FP + 184]; \
3317c478bd9Sstevel@tonic-gate 	std	%d48, [FP + 192]; \
3327c478bd9Sstevel@tonic-gate 	std	%d50, [FP + 200]; \
3337c478bd9Sstevel@tonic-gate 	std	%d52, [FP + 208]; \
3347c478bd9Sstevel@tonic-gate 	std	%d54, [FP + 216]; \
3357c478bd9Sstevel@tonic-gate 	std	%d56, [FP + 224]; \
3367c478bd9Sstevel@tonic-gate 	std	%d58, [FP + 232]; \
3377c478bd9Sstevel@tonic-gate 	std	%d60, [FP + 240]; \
3387c478bd9Sstevel@tonic-gate 	std	%d62, [FP + 248];
3397c478bd9Sstevel@tonic-gate 
3407c478bd9Sstevel@tonic-gate #define	LOAD_DL_FPREGS(FP) \
3417c478bd9Sstevel@tonic-gate 	ldd	[FP], %f0; \
3427c478bd9Sstevel@tonic-gate 	ldd	[FP + 8], %f2; \
3437c478bd9Sstevel@tonic-gate 	ldd	[FP + 16], %f4; \
3447c478bd9Sstevel@tonic-gate 	ldd	[FP + 24], %f6; \
3457c478bd9Sstevel@tonic-gate 	ldd	[FP + 32], %f8; \
3467c478bd9Sstevel@tonic-gate 	ldd	[FP + 40], %f10; \
3477c478bd9Sstevel@tonic-gate 	ldd	[FP + 48], %f12; \
3487c478bd9Sstevel@tonic-gate 	ldd	[FP + 56], %f14; \
3497c478bd9Sstevel@tonic-gate 	ldd	[FP + 64], %f16; \
3507c478bd9Sstevel@tonic-gate 	ldd	[FP + 72], %f18; \
3517c478bd9Sstevel@tonic-gate 	ldd	[FP + 80], %f20; \
3527c478bd9Sstevel@tonic-gate 	ldd	[FP + 88], %f22; \
3537c478bd9Sstevel@tonic-gate 	ldd	[FP + 96], %f24; \
3547c478bd9Sstevel@tonic-gate 	ldd	[FP + 104], %f26; \
3557c478bd9Sstevel@tonic-gate 	ldd	[FP + 112], %f28; \
3567c478bd9Sstevel@tonic-gate 	ldd	[FP + 120], %f30;
3577c478bd9Sstevel@tonic-gate 
3587c478bd9Sstevel@tonic-gate #define	LOAD_DU_FPREGS(FP) \
3597c478bd9Sstevel@tonic-gate 	ldd	[FP + 128], %d32; \
3607c478bd9Sstevel@tonic-gate 	ldd	[FP + 136], %d34; \
3617c478bd9Sstevel@tonic-gate 	ldd	[FP + 144], %d36; \
3627c478bd9Sstevel@tonic-gate 	ldd	[FP + 152], %d38; \
3637c478bd9Sstevel@tonic-gate 	ldd	[FP + 160], %d40; \
3647c478bd9Sstevel@tonic-gate 	ldd	[FP + 168], %d42; \
3657c478bd9Sstevel@tonic-gate 	ldd	[FP + 176], %d44; \
3667c478bd9Sstevel@tonic-gate 	ldd	[FP + 184], %d46; \
3677c478bd9Sstevel@tonic-gate 	ldd	[FP + 192], %d48; \
3687c478bd9Sstevel@tonic-gate 	ldd	[FP + 200], %d50; \
3697c478bd9Sstevel@tonic-gate 	ldd	[FP + 208], %d52; \
3707c478bd9Sstevel@tonic-gate 	ldd	[FP + 216], %d54; \
3717c478bd9Sstevel@tonic-gate 	ldd	[FP + 224], %d56; \
3727c478bd9Sstevel@tonic-gate 	ldd	[FP + 232], %d58; \
3737c478bd9Sstevel@tonic-gate 	ldd	[FP + 240], %d60; \
3747c478bd9Sstevel@tonic-gate 	ldd	[FP + 248], %d62;
3757c478bd9Sstevel@tonic-gate 
3767c478bd9Sstevel@tonic-gate #endif /* _KERNEL */
3777c478bd9Sstevel@tonic-gate 
3787c478bd9Sstevel@tonic-gate /*
3797c478bd9Sstevel@tonic-gate  * V9 privileged registers
3807c478bd9Sstevel@tonic-gate  */
3817c478bd9Sstevel@tonic-gate 
3827c478bd9Sstevel@tonic-gate /*
3837c478bd9Sstevel@tonic-gate  * Condition Codes Register (CCR)
3847c478bd9Sstevel@tonic-gate  *
3857c478bd9Sstevel@tonic-gate  *	|-------------------------------|
3867c478bd9Sstevel@tonic-gate  *	|	XCC	|	ICC	|
3877c478bd9Sstevel@tonic-gate  *	| N | Z | V | C | N | Z | V | C |
3887c478bd9Sstevel@tonic-gate  *	|---|---|---|---|---|---|---|---|
3897c478bd9Sstevel@tonic-gate  *	7   6   5   4   3   2   1   0
3907c478bd9Sstevel@tonic-gate  */
3917c478bd9Sstevel@tonic-gate #define	CCR_IC		0x01	/* 32b carry */
3927c478bd9Sstevel@tonic-gate #define	CCR_IV		0x02	/* 32b overflow */
3937c478bd9Sstevel@tonic-gate #define	CCR_IZ		0x04	/* 32b zero */
3947c478bd9Sstevel@tonic-gate #define	CCR_IN		0x08	/* 32b negative */
3957c478bd9Sstevel@tonic-gate #define	CCR_XC		0x10	/* 64b carry */
3967c478bd9Sstevel@tonic-gate #define	CCR_XV		0x20	/* 64b overflow */
3977c478bd9Sstevel@tonic-gate #define	CCR_XZ		0x40	/* 64b zero */
3987c478bd9Sstevel@tonic-gate #define	CCR_XN		0x80	/* 64b negative */
3997c478bd9Sstevel@tonic-gate #define	CCR_ICC		0x0F
4007c478bd9Sstevel@tonic-gate #define	CCR_XCC		0xF0
4017c478bd9Sstevel@tonic-gate 
4027c478bd9Sstevel@tonic-gate 
4037c478bd9Sstevel@tonic-gate /*
4047c478bd9Sstevel@tonic-gate  * Processor State Register (PSTATE)
4057c478bd9Sstevel@tonic-gate  *
4067c478bd9Sstevel@tonic-gate  *   |-------------------------------------------------------------|
4077c478bd9Sstevel@tonic-gate  *   |  IG | MG | CLE | TLE | MM | RED | PEF | AM | PRIV | IE | AG |
4087c478bd9Sstevel@tonic-gate  *   |-----|----|-----|-----|----|-----|-----|----|------|----|----|
4097c478bd9Sstevel@tonic-gate  *	11   10    9     8   7  6   5     4     3     2     1    0
4107c478bd9Sstevel@tonic-gate  *
4117c478bd9Sstevel@tonic-gate  * Note that the IG, MG, RED and AG fields are not applicable to sun4v
4127c478bd9Sstevel@tonic-gate  * compliant processors.
4137c478bd9Sstevel@tonic-gate  */
4147c478bd9Sstevel@tonic-gate #ifndef GLREG
4157c478bd9Sstevel@tonic-gate #define	PSTATE_AG	0x001		/* alternate globals */
4167c478bd9Sstevel@tonic-gate #endif /* GLREG */
4177c478bd9Sstevel@tonic-gate 
4187c478bd9Sstevel@tonic-gate #define	PSTATE_IE	0x002		/* interrupt enable */
4197c478bd9Sstevel@tonic-gate #define	PSTATE_PRIV	0x004		/* privileged mode */
4207c478bd9Sstevel@tonic-gate #define	PSTATE_AM	0x008		/* use 32b address mask */
4217c478bd9Sstevel@tonic-gate #define	PSTATE_PEF	0x010		/* fp enable */
4227c478bd9Sstevel@tonic-gate 
4237c478bd9Sstevel@tonic-gate #ifndef GLREG
4247c478bd9Sstevel@tonic-gate #define	PSTATE_RED	0x020		/* red mode */
4257c478bd9Sstevel@tonic-gate #endif /* GLREG */
4267c478bd9Sstevel@tonic-gate 
4277c478bd9Sstevel@tonic-gate #define	PSTATE_MM	0x0C0		/* memory model */
4287c478bd9Sstevel@tonic-gate #define	PSTATE_TLE	0x100		/* trap little endian */
4297c478bd9Sstevel@tonic-gate #define	PSTATE_CLE	0x200		/* current little endian */
4307c478bd9Sstevel@tonic-gate 
4317c478bd9Sstevel@tonic-gate #ifndef GLREG
4327c478bd9Sstevel@tonic-gate #define	PSTATE_MG	0x400		/* MMU globals */
4337c478bd9Sstevel@tonic-gate #define	PSTATE_IG	0x800		/* interrupt globals */
4347c478bd9Sstevel@tonic-gate #endif /* GLREG */
4357c478bd9Sstevel@tonic-gate 
4367c478bd9Sstevel@tonic-gate #define	PSTATE_BITS \
4377c478bd9Sstevel@tonic-gate "\020\014IG\013MG\012CLE\011TLE\010MM-RMO\
4387c478bd9Sstevel@tonic-gate \07MM-PSO\06RED\05PEF\04AM\03PRIV\02IE\01AG"
4397c478bd9Sstevel@tonic-gate 
4407c478bd9Sstevel@tonic-gate /*
4417c478bd9Sstevel@tonic-gate  * Definition of MM (Memory Mode) bit field of pstate.
4427c478bd9Sstevel@tonic-gate  */
443*2c5124a1SPrashanth Sreenivasa #define	PSTATE_MM_TSO	0x00		/* total store ordering */
444*2c5124a1SPrashanth Sreenivasa #define	PSTATE_MM_PSO	0x40		/* partial store ordering */
4457c478bd9Sstevel@tonic-gate #define	PSTATE_MM_RMO	0x80		/* relaxed memory ordering */
446*2c5124a1SPrashanth Sreenivasa #define	PSTATE_MM_WC	0xC0		/* weak consistency */
4477c478bd9Sstevel@tonic-gate 
4487c478bd9Sstevel@tonic-gate 
4497c478bd9Sstevel@tonic-gate /*
4507c478bd9Sstevel@tonic-gate  * Trap State Register (TSTATE)
4517c478bd9Sstevel@tonic-gate  *
4527c478bd9Sstevel@tonic-gate  *	|------------------------------------------|
4537c478bd9Sstevel@tonic-gate  *	| GL | CCR | ASI | --- | PSTATE | -- | CWP |
4547c478bd9Sstevel@tonic-gate  *	|----|-----|-----|-----|--------|----|-----|
4557c478bd9Sstevel@tonic-gate  *	42 40 39 32 31 24 23 20 19	  8 7  5 4   0
4567c478bd9Sstevel@tonic-gate  *
4577c478bd9Sstevel@tonic-gate  * Note that the GL field is applicable to sun4v compliant processors only.
4587c478bd9Sstevel@tonic-gate  */
4597c478bd9Sstevel@tonic-gate #define	TSTATE_CWP_MASK		0x01F
4607c478bd9Sstevel@tonic-gate #define	TSTATE_CWP_SHIFT	0
4617c478bd9Sstevel@tonic-gate #define	TSTATE_PSTATE_MASK	0xFFF
4627c478bd9Sstevel@tonic-gate #define	TSTATE_PSTATE_SHIFT	8
4637c478bd9Sstevel@tonic-gate #define	TSTATE_ASI_MASK		0x0FF
4647c478bd9Sstevel@tonic-gate #define	TSTATE_ASI_SHIFT	24
4657c478bd9Sstevel@tonic-gate #define	TSTATE_CCR_MASK		0x0FF
4667c478bd9Sstevel@tonic-gate #define	TSTATE_CCR_SHIFT	32
4677c478bd9Sstevel@tonic-gate 
4687c478bd9Sstevel@tonic-gate #ifdef GLREG
4697c478bd9Sstevel@tonic-gate #define	TSTATE_GL_MASK		0x7
4707c478bd9Sstevel@tonic-gate #define	TSTATE_GL_SHIFT		40
4717c478bd9Sstevel@tonic-gate #endif /* GLREG */
4727c478bd9Sstevel@tonic-gate 
4737c478bd9Sstevel@tonic-gate /*
4747c478bd9Sstevel@tonic-gate  * Some handy tstate macros
4757c478bd9Sstevel@tonic-gate  */
4767c478bd9Sstevel@tonic-gate #define	TSTATE_AG	(PSTATE_AG << TSTATE_PSTATE_SHIFT)
4777c478bd9Sstevel@tonic-gate #define	TSTATE_IE	(PSTATE_IE << TSTATE_PSTATE_SHIFT)
4787c478bd9Sstevel@tonic-gate #define	TSTATE_PRIV	(PSTATE_PRIV << TSTATE_PSTATE_SHIFT)
4797c478bd9Sstevel@tonic-gate #define	TSTATE_AM	(PSTATE_AM << TSTATE_PSTATE_SHIFT)
4807c478bd9Sstevel@tonic-gate #define	TSTATE_PEF	(PSTATE_PEF << TSTATE_PSTATE_SHIFT)
481*2c5124a1SPrashanth Sreenivasa #define	TSTATE_MM	(PSTATE_MM << TSTATE_PSTATE_SHIFT)
482*2c5124a1SPrashanth Sreenivasa #define	TSTATE_MM_TSO	(PSTATE_MM_TSO << TSTATE_PSTATE_SHIFT)
483*2c5124a1SPrashanth Sreenivasa #define	TSTATE_MM_WC	(PSTATE_MM_WC << TSTATE_PSTATE_SHIFT)
4847c478bd9Sstevel@tonic-gate #define	TSTATE_MG	(PSTATE_MG << TSTATE_PSTATE_SHIFT)
4857c478bd9Sstevel@tonic-gate #define	TSTATE_IG	(PSTATE_IG << TSTATE_PSTATE_SHIFT)
4867c478bd9Sstevel@tonic-gate #define	TSTATE_CWP	TSTATE_CWP_MASK
4877c478bd9Sstevel@tonic-gate 
4887c478bd9Sstevel@tonic-gate /*
4897c478bd9Sstevel@tonic-gate  * as is 64b, but cc is 32b, so we need this hack.
4907c478bd9Sstevel@tonic-gate  */
4917c478bd9Sstevel@tonic-gate #ifndef _ASM
4927c478bd9Sstevel@tonic-gate #define	TSTATE_ICC	((long long)CCR_ICC << TSTATE_CCR_SHIFT)
4932f0fcb93SJason Beloro #define	TSTATE_XCC	((long long)CCR_XCC << TSTATE_CCR_SHIFT)
4947c478bd9Sstevel@tonic-gate #define	TSTATE_IC	((long long)CCR_IC << TSTATE_CCR_SHIFT)
4955892374fSdf157793 #define	TSTATE_IV	((long long)CCR_IV << TSTATE_CCR_SHIFT)
4962f0fcb93SJason Beloro #define	TSTATE_IN	((long long)CCR_IN << TSTATE_CCR_SHIFT)
4975892374fSdf157793 #define	TSTATE_XV	((long long)CCR_XV << TSTATE_CCR_SHIFT)
4982f0fcb93SJason Beloro #define	TSTATE_XZ	((long long)CCR_XZ << TSTATE_CCR_SHIFT)
4997c478bd9Sstevel@tonic-gate #else
5007c478bd9Sstevel@tonic-gate #define	TSTATE_ICC	(CCR_ICC << TSTATE_CCR_SHIFT)
5012f0fcb93SJason Beloro #define	TSTATE_XCC	(CCR_XCC << TSTATE_CCR_SHIFT)
5027c478bd9Sstevel@tonic-gate #define	TSTATE_IC	(CCR_IC << TSTATE_CCR_SHIFT)
5035892374fSdf157793 #define	TSTATE_IV	(CCR_IV << TSTATE_CCR_SHIFT)
5042f0fcb93SJason Beloro #define	TSTATE_IN	(CCR_IN << TSTATE_CCR_SHIFT)
5055892374fSdf157793 #define	TSTATE_XV	(CCR_XV << TSTATE_CCR_SHIFT)
5062f0fcb93SJason Beloro #define	TSTATE_XZ	(CCR_XZ << TSTATE_CCR_SHIFT)
5077c478bd9Sstevel@tonic-gate #endif
5087c478bd9Sstevel@tonic-gate #define	TSTATE_V8_UBITS (TSTATE_ICC | TSTATE_PEF)
5097c478bd9Sstevel@tonic-gate 
5107c478bd9Sstevel@tonic-gate /*
5117c478bd9Sstevel@tonic-gate  * Initial kernel and user %tstate.
5127c478bd9Sstevel@tonic-gate  */
5137c478bd9Sstevel@tonic-gate #define	PTSTATE_KERN_COMMON \
5147c478bd9Sstevel@tonic-gate 	(PSTATE_PRIV | PSTATE_PEF | PSTATE_MM_TSO)
5157c478bd9Sstevel@tonic-gate 
5167c478bd9Sstevel@tonic-gate #define	TSTATE_KERN	\
5177c478bd9Sstevel@tonic-gate 	(PTSTATE_KERN_COMMON << TSTATE_PSTATE_SHIFT)
5187c478bd9Sstevel@tonic-gate 
5197c478bd9Sstevel@tonic-gate #define	PSTATE_KERN	\
5207c478bd9Sstevel@tonic-gate 	(PTSTATE_KERN_COMMON | PSTATE_PRIV | PSTATE_IE)
5217c478bd9Sstevel@tonic-gate 
5227c478bd9Sstevel@tonic-gate #define	TSTATE_USER32	\
523*2c5124a1SPrashanth Sreenivasa 	(((PSTATE_IE | PSTATE_PEF | PSTATE_AM) << TSTATE_PSTATE_SHIFT) | \
5247c478bd9Sstevel@tonic-gate 	    ((long long)ASI_PNF << TSTATE_ASI_SHIFT))
5257c478bd9Sstevel@tonic-gate 
5267c478bd9Sstevel@tonic-gate #define	TSTATE_USER64	\
527*2c5124a1SPrashanth Sreenivasa 	(((PSTATE_IE | PSTATE_PEF) << TSTATE_PSTATE_SHIFT) | \
5287c478bd9Sstevel@tonic-gate 	    ((long long)ASI_PNF << TSTATE_ASI_SHIFT))
5297c478bd9Sstevel@tonic-gate 
5307c478bd9Sstevel@tonic-gate #define	USERMODE(x)	(!((x) & TSTATE_PRIV))
5317c478bd9Sstevel@tonic-gate 
5327c478bd9Sstevel@tonic-gate /*
5337c478bd9Sstevel@tonic-gate  * Window State Register (WSTATE)
5347c478bd9Sstevel@tonic-gate  *
5357c478bd9Sstevel@tonic-gate  *   |------------|
5367c478bd9Sstevel@tonic-gate  *   |OTHER|NORMAL|
5377c478bd9Sstevel@tonic-gate  *   |-----|------|
5387c478bd9Sstevel@tonic-gate  *    5	  3 2    0
5397c478bd9Sstevel@tonic-gate  */
5407c478bd9Sstevel@tonic-gate #define	WSTATE_BAD	0	/* unused */
5417c478bd9Sstevel@tonic-gate #define	WSTATE_U32	1	/* 32b stack */
5427c478bd9Sstevel@tonic-gate #define	WSTATE_U64	2	/* 64b stack */
5437c478bd9Sstevel@tonic-gate #define	WSTATE_CLEAN32	3	/* cleanwin workaround, 32b stack */
5447c478bd9Sstevel@tonic-gate #define	WSTATE_CLEAN64	4	/* cleanwin workaround, 64b stack */
5457c478bd9Sstevel@tonic-gate #define	WSTATE_K32	5	/* priv 32b stack */
5467c478bd9Sstevel@tonic-gate #define	WSTATE_K64	6	/* priv 64b stack */
5477c478bd9Sstevel@tonic-gate #define	WSTATE_KMIX	7	/* priv mixed stack */
5487c478bd9Sstevel@tonic-gate 
5497c478bd9Sstevel@tonic-gate #define	WSTATE_CLEAN_OFFSET	2
5507c478bd9Sstevel@tonic-gate #define	WSTATE_SHIFT	3	/* normal-to-other shift */
5517c478bd9Sstevel@tonic-gate #define	WSTATE_MASK	7	/* mask for each set */
5527c478bd9Sstevel@tonic-gate #define	WSTATE(o, n)	(((o) << WSTATE_SHIFT) | (n))
5537c478bd9Sstevel@tonic-gate 
5547c478bd9Sstevel@tonic-gate #define	WSTATE_USER32	WSTATE(WSTATE_BAD, WSTATE_U32)
5557c478bd9Sstevel@tonic-gate #define	WSTATE_USER64	WSTATE(WSTATE_BAD, WSTATE_U64)
5567c478bd9Sstevel@tonic-gate #define	WSTATE_KERN	WSTATE(WSTATE_U32, WSTATE_K64)
5577c478bd9Sstevel@tonic-gate 
5587c478bd9Sstevel@tonic-gate /*
5597c478bd9Sstevel@tonic-gate  * Processor Interrupt Level Register (PIL)
5607c478bd9Sstevel@tonic-gate  *
5617c478bd9Sstevel@tonic-gate  *   |-----|
5627c478bd9Sstevel@tonic-gate  *   | PIL |
5637c478bd9Sstevel@tonic-gate  *   |-----|
5647c478bd9Sstevel@tonic-gate  *    3   0
5657c478bd9Sstevel@tonic-gate  */
5667c478bd9Sstevel@tonic-gate 
5677c478bd9Sstevel@tonic-gate /*
5687c478bd9Sstevel@tonic-gate  * Version Register (VER)
5697c478bd9Sstevel@tonic-gate  *
5707c478bd9Sstevel@tonic-gate  *   |-------------------------------------------------|
5717c478bd9Sstevel@tonic-gate  *   | manuf | impl | mask | ---- | maxtl | - | maxwin |
5727c478bd9Sstevel@tonic-gate  *   |-------|------|------|------|-------|---|--------|
5737c478bd9Sstevel@tonic-gate  *    63   48 47  32 31  24 23  16 15	8  7 5	4    0
5747c478bd9Sstevel@tonic-gate  */
5757c478bd9Sstevel@tonic-gate #define	VER_MANUF	0xFFFF000000000000
5767c478bd9Sstevel@tonic-gate #define	VER_IMPL	0x0000FFFF00000000
5777c478bd9Sstevel@tonic-gate #define	VER_MASK	0x00000000FF000000
5787c478bd9Sstevel@tonic-gate #define	VER_MAXTL	0x000000000000FF00
5797c478bd9Sstevel@tonic-gate #define	VER_MAXWIN	0x000000000000001F
5808f230a59Sbs21162 #define	VER_MAXTL_SHIFT	8
5818f230a59Sbs21162 #define	VER_MAXTL_MASK	(VER_MAXTL >> VER_MAXTL_SHIFT)
5827c478bd9Sstevel@tonic-gate 
5837c478bd9Sstevel@tonic-gate /*
5847c478bd9Sstevel@tonic-gate  * Tick Register (TICK)
5857c478bd9Sstevel@tonic-gate  *
5867c478bd9Sstevel@tonic-gate  *   |---------------|
5877c478bd9Sstevel@tonic-gate  *   | npt | counter |
5887c478bd9Sstevel@tonic-gate  *   |-----|---------|
5897c478bd9Sstevel@tonic-gate  *     63   62      0
5907c478bd9Sstevel@tonic-gate  *
5917c478bd9Sstevel@tonic-gate  * Note: UltraSparc III Stick register has the same layout. When
5927c478bd9Sstevel@tonic-gate  * present, we clear it too.
5937c478bd9Sstevel@tonic-gate  */
5947c478bd9Sstevel@tonic-gate 
5957c478bd9Sstevel@tonic-gate #define	TICK_NPT	0x8000000000000000
5967c478bd9Sstevel@tonic-gate #define	TICK_COUNTER	0x7FFFFFFFFFFFFFFF
5977c478bd9Sstevel@tonic-gate 
5987c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
5997c478bd9Sstevel@tonic-gate }
6007c478bd9Sstevel@tonic-gate #endif
6017c478bd9Sstevel@tonic-gate 
6027c478bd9Sstevel@tonic-gate #endif	/* _SYS_PRIVREGS_H */
603