xref: /titanic_51/usr/src/uts/sparc/v9/sys/machpcb.h (revision bc0e91320069f0bcaee43e80a7ea686d9efa2d08)
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
5a8599265Selowe  * Common Development and Distribution License (the "License").
6a8599265Selowe  * 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 /*
22eb86370fSChristopher Baumbauer - Sun Microsystems - San Diego United States  * 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_MACHPCB_H
277c478bd9Sstevel@tonic-gate #define	_SYS_MACHPCB_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #include <sys/stack.h>
307c478bd9Sstevel@tonic-gate #include <sys/regset.h>
317c478bd9Sstevel@tonic-gate #include <v9/sys/privregs.h>
327c478bd9Sstevel@tonic-gate #if defined(__lint)
337c478bd9Sstevel@tonic-gate #include <sys/thread.h>
347c478bd9Sstevel@tonic-gate #endif /* __lint */
357c478bd9Sstevel@tonic-gate 
367c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
377c478bd9Sstevel@tonic-gate extern "C" {
387c478bd9Sstevel@tonic-gate #endif
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate /*
417c478bd9Sstevel@tonic-gate  * This file is machine dependent.
427c478bd9Sstevel@tonic-gate  */
437c478bd9Sstevel@tonic-gate 
447c478bd9Sstevel@tonic-gate /*
457c478bd9Sstevel@tonic-gate  * Machine dependent per-thread data.
467c478bd9Sstevel@tonic-gate  */
477c478bd9Sstevel@tonic-gate #define	MAXWIN	8	/* max # of windows currently supported */
487c478bd9Sstevel@tonic-gate 
497c478bd9Sstevel@tonic-gate /*
507c478bd9Sstevel@tonic-gate  * The system actually supports one more than the above number.
517c478bd9Sstevel@tonic-gate  * There is always one window reserved for trap handlers that
527c478bd9Sstevel@tonic-gate  * never has to be saved into the pcb struct.
537c478bd9Sstevel@tonic-gate  */
547c478bd9Sstevel@tonic-gate 
557c478bd9Sstevel@tonic-gate /*
567c478bd9Sstevel@tonic-gate  * Distance from beginning of thread stack (t_stk) to saved regs struct.
577c478bd9Sstevel@tonic-gate  */
587c478bd9Sstevel@tonic-gate #define	REGOFF	SA(MINFRAME)
597c478bd9Sstevel@tonic-gate 
607c478bd9Sstevel@tonic-gate #ifndef _ASM
617c478bd9Sstevel@tonic-gate 
627c478bd9Sstevel@tonic-gate /*
637c478bd9Sstevel@tonic-gate  * The struct machpcb is always allocated stack aligned.
647c478bd9Sstevel@tonic-gate  */
657c478bd9Sstevel@tonic-gate typedef struct machpcb {
667c478bd9Sstevel@tonic-gate 	char	mpcb_frame[REGOFF];
677c478bd9Sstevel@tonic-gate 	struct	regs mpcb_regs;	/* user's saved registers */
687c478bd9Sstevel@tonic-gate 	caddr_t	mpcb_wbuf;	/* pointer to wbuf */
697c478bd9Sstevel@tonic-gate 	caddr_t	mpcb_spbuf[MAXWIN]; /* sp's for each wbuf */
707c478bd9Sstevel@tonic-gate 	struct	rwindow mpcb_rwin[2]; /* windows used while doing watchpoints */
717c478bd9Sstevel@tonic-gate 	caddr_t	mpcb_rsp[2];	/* sp's for pcb_rwin[]  */
727c478bd9Sstevel@tonic-gate 	int	mpcb_wbcnt;	/* number of saved windows in pcb_wbuf */
737c478bd9Sstevel@tonic-gate 	uint_t	mpcb_wstate;	/* per-lwp %wstate */
747c478bd9Sstevel@tonic-gate 	kfpu_t	*mpcb_fpu; /* fpu state */
75*bc0e9132SGordon Ross 	struct	_fq mpcb_fpu_q[_MAXFPQ]; /* fpu exception queue */
767c478bd9Sstevel@tonic-gate 	caddr_t	mpcb_illexcaddr; /* address of last illegal instruction */
777c478bd9Sstevel@tonic-gate 	uint_t	mpcb_illexcinsn; /* last illegal instruction */
78eb86370fSChristopher Baumbauer - Sun Microsystems - San Diego United States 	uint_t	mpcb_illexccnt; /* count of illegal instruction attempts */
797c478bd9Sstevel@tonic-gate 	int	mpcb_flags;	/* various state flags */
807c478bd9Sstevel@tonic-gate 	int	mpcb_wocnt;	/* window overflow count */
817c478bd9Sstevel@tonic-gate 	int	mpcb_wucnt;	/* window underflow count */
827c478bd9Sstevel@tonic-gate 	kthread_t *mpcb_thread;	/* associated thread */
837c478bd9Sstevel@tonic-gate 	uint64_t mpcb_pa;	/* pcb physical */
847c478bd9Sstevel@tonic-gate 	uint64_t mpcb_wbuf_pa;	/* pointer to wbuf - physical */
857c478bd9Sstevel@tonic-gate } machpcb_t;
867c478bd9Sstevel@tonic-gate #endif /* ! _ASM */
877c478bd9Sstevel@tonic-gate 
887c478bd9Sstevel@tonic-gate /* mpcb_flags */
897c478bd9Sstevel@tonic-gate #define	FP_TRAPPED	0x04	/* fp_traps call caused by fp queue */
907c478bd9Sstevel@tonic-gate 
917c478bd9Sstevel@tonic-gate /*
927c478bd9Sstevel@tonic-gate  * We can use lwp_regs to find the mpcb base.
937c478bd9Sstevel@tonic-gate  */
947c478bd9Sstevel@tonic-gate #ifndef _ASM
957c478bd9Sstevel@tonic-gate #define	lwptompcb(lwp)	((struct machpcb *) \
967c478bd9Sstevel@tonic-gate 	    ((caddr_t)(lwp)->lwp_regs - REGOFF))
977c478bd9Sstevel@tonic-gate #endif
987c478bd9Sstevel@tonic-gate 
99a8599265Selowe #ifndef	_ASM
100a8599265Selowe struct kmem_cache;
101a8599265Selowe extern struct kmem_cache *wbuf32_cache;
102a8599265Selowe extern struct kmem_cache *wbuf64_cache;
103a8599265Selowe #endif
104a8599265Selowe 
1057c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1067c478bd9Sstevel@tonic-gate }
1077c478bd9Sstevel@tonic-gate #endif
1087c478bd9Sstevel@tonic-gate 
1097c478bd9Sstevel@tonic-gate #endif	/* _SYS_MACHPCB_H */
110