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