1 /*-
2  * SPDX-License-Identifier: BSD-3-Clause
3  *
4  * Copyright (c) 1997 Berkeley Software Design, Inc. All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  * 3. Berkeley Software Design Inc's name may not be used to endorse or
15  *    promote products derived from this software without specific prior
16  *    written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY BERKELEY SOFTWARE DESIGN INC ``AS IS'' AND
19  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21  * ARE DISCLAIMED.  IN NO EVENT SHALL BERKELEY SOFTWARE DESIGN INC BE LIABLE
22  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28  * SUCH DAMAGE.
29  *
30  *	from: BSDI: wstate.h,v 1.4 1997/09/18 13:05:51 torek Exp
31  * $FreeBSD: stable/12/sys/sparc64/include/wstate.h 326262 2017-11-27 15:10:39Z pfg $
32  */
33 
34 #ifndef	_MACHINE_WSTATE_H_
35 #define	_MACHINE_WSTATE_H_
36 
37 /*
38  * Window state register bits
39  *
40  * There really are no bits per se, just the two fields WSTATE.NORMAL
41  * and WSTATE.OTHER.  The rest is up to software.
42  *
43  * We use WSTATE_NORMAL to represent user mode or kernel mode saves
44  * (whichever is currently in effect) and WSTATE_OTHER to represent
45  * user mode saves (only).
46  *
47  * Note that locore.s assumes this same bit layout (since the translation
48  * from "bits" to "{spill,fill}_N_{normal,other}" is done in hardware).
49  */
50 
51 #define	WSTATE_NORMAL_MASK	1	/* wstate normal minus transition */
52 #define	WSTATE_OTHER_SHIFT	3	/* for wstate other / user */
53 #define	WSTATE_OTHER_MASK		/* wstate other minus nested */ \
54 	(WSTATE_NORMAL_MASK << WSTATE_OTHER_SHIFT)
55 
56 #define	WSTATE_KERNEL		0	/* normal kernel wstate */
57 #define	WSTATE_USER_64		0	/* normal 64bit user wstate */
58 #define	WSTATE_USER_32		1	/* normal 32bit user wstate */
59 
60 #define	WSTATE_TRANSITION	2	/* if set, force user window */
61 #define	WSTATE_NESTED			/* if set, spill must not fault */ \
62 	(WSTATE_TRANSITION << WSTATE_OTHER_SHIFT)
63 
64 /* Values used by the PROM and (Open)Solaris */
65 #define	WSTATE_PROM_KMIX	7
66 #define	WSTATE_PROM_MASK	7
67 
68 #endif /* !_MACHINE_WSTATE_H_ */
69