Port-sparc64 archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: sun4v trap table



On Mon, 06 Oct 2025 17:34:42 +1100
matthew green <mrg%eterna23.net@localhost> wrote:

> include/psl.h:264:#define WSTATE_USER    022
> include/psl.h:263:#define WSTATE_KERN    026
> 
> since they both seem to set OTHER bits, which means that 4:2 in the
> trap type will always be 2?  so always uses SPILLBOTH()?  i think i
> am still missing something here...

Looking at Illumos/Solaris: src/uts/sparc/v9/sys/privregs.h

/*
 * Window State Register (WSTATE)
 *
 *   |------------|
 *   |OTHER|NORMAL|
 *   |-----|------|
 *    5	  3 2    0
 */
#define	WSTATE_BAD	0	/* unused */
#define	WSTATE_U32	1	/* 32b stack */
#define	WSTATE_U64	2	/* 64b stack */
#define	WSTATE_CLEAN32	3	/* cleanwin workaround, 32b stack */
#define	WSTATE_CLEAN64	4	/* cleanwin workaround, 64b stack */
#define	WSTATE_K32	5	/* priv 32b stack */
#define	WSTATE_K64	6	/* priv 64b stack */
#define	WSTATE_KMIX	7	/* priv mixed stack */

#define	WSTATE_CLEAN_OFFSET	2
#define	WSTATE_SHIFT	3	/* normal-to-other shift */
#define	WSTATE_MASK	7	/* mask for each set */
#define	WSTATE(o, n)	(((o) << WSTATE_SHIFT) | (n))

#define	WSTATE_USER32	WSTATE(WSTATE_BAD, WSTATE_U32)
#define	WSTATE_USER64	WSTATE(WSTATE_BAD, WSTATE_U64)
#define	WSTATE_KERN	WSTATE(WSTATE_U32, WSTATE_K64)


This results in WSTATE.OTHER=0 and WSTATE.NORMAL=0-7. Unlike NetBSD,
only WSTATE_KERN results in WSTATE.OTHER>0.

WSTATE.NORMAL=0 is unused, so I guess they may use it like a NULL
pointer to catch uninitialised WSTATE register?


Home | Main Index | Thread Index | Old Index