182906Sjake/*-
282906Sjake * Copyright (c) 1997 Berkeley Software Design, Inc. All rights reserved.
382906Sjake *
482906Sjake * Redistribution and use in source and binary forms, with or without
582906Sjake * modification, are permitted provided that the following conditions
682906Sjake * are met:
782906Sjake * 1. Redistributions of source code must retain the above copyright
882906Sjake *    notice, this list of conditions and the following disclaimer.
982906Sjake * 2. Redistributions in binary form must reproduce the above copyright
1082906Sjake *    notice, this list of conditions and the following disclaimer in the
1182906Sjake *    documentation and/or other materials provided with the distribution.
1282906Sjake * 3. Berkeley Software Design Inc's name may not be used to endorse or
1382906Sjake *    promote products derived from this software without specific prior
1482906Sjake *    written permission.
1582906Sjake *
1682906Sjake * THIS SOFTWARE IS PROVIDED BY BERKELEY SOFTWARE DESIGN INC ``AS IS'' AND
1782906Sjake * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1882906Sjake * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1982906Sjake * ARE DISCLAIMED.  IN NO EVENT SHALL BERKELEY SOFTWARE DESIGN INC BE LIABLE
2082906Sjake * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2182906Sjake * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2282906Sjake * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2382906Sjake * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2482906Sjake * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2582906Sjake * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2682906Sjake * SUCH DAMAGE.
2782906Sjake *
2882906Sjake *	from: BSDI: wstate.h,v 1.4 1997/09/18 13:05:51 torek Exp
2982906Sjake * $FreeBSD$
3082906Sjake */
3182906Sjake
3282906Sjake#ifndef	_MACHINE_WSTATE_H_
3382906Sjake#define	_MACHINE_WSTATE_H_
3482906Sjake
3582906Sjake/*
36205409Smarius * Window state register bits
3782906Sjake *
3882906Sjake * There really are no bits per se, just the two fields WSTATE.NORMAL
3982906Sjake * and WSTATE.OTHER.  The rest is up to software.
4082906Sjake *
4182906Sjake * We use WSTATE_NORMAL to represent user mode or kernel mode saves
4282906Sjake * (whichever is currently in effect) and WSTATE_OTHER to represent
4382906Sjake * user mode saves (only).
4482906Sjake *
4582906Sjake * Note that locore.s assumes this same bit layout (since the translation
4682906Sjake * from "bits" to "{spill,fill}_N_{normal,other}" is done in hardware).
4782906Sjake */
4882906Sjake
4991246Sjake#define	WSTATE_NORMAL_MASK	1	/* wstate normal minus transition */
5088632Sjake#define	WSTATE_OTHER_SHIFT	3	/* for wstate other / user */
5191246Sjake#define	WSTATE_OTHER_MASK		/* wstate other minus nested */ \
5291246Sjake	(WSTATE_NORMAL_MASK << WSTATE_OTHER_SHIFT)
5382906Sjake
5485245Sjake#define	WSTATE_KERNEL		0	/* normal kernel wstate */
5591246Sjake#define	WSTATE_USER_64		0	/* normal 64bit user wstate */
5691246Sjake#define	WSTATE_USER_32		1	/* normal 32bit user wstate */
5785245Sjake
5891246Sjake#define	WSTATE_TRANSITION	2	/* if set, force user window */
5991246Sjake#define	WSTATE_NESTED			/* if set, spill must not fault */ \
6091246Sjake	(WSTATE_TRANSITION << WSTATE_OTHER_SHIFT)
6191246Sjake
62205409Smarius/* Values used by the PROM and (Open)Solaris */
63205409Smarius#define	WSTATE_PROM_KMIX	7
64205409Smarius#define	WSTATE_PROM_MASK	7
65205409Smarius
6682906Sjake#endif /* !_MACHINE_WSTATE_H_ */
67