10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 52005Selowe * Common Development and Distribution License (the "License"). 62005Selowe * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 22*9195SChristopher.Baumbauer@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 230Sstevel@tonic-gate * Use is subject to license terms. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 260Sstevel@tonic-gate #ifndef _SYS_MACHPCB_H 270Sstevel@tonic-gate #define _SYS_MACHPCB_H 280Sstevel@tonic-gate 290Sstevel@tonic-gate #include <sys/stack.h> 300Sstevel@tonic-gate #include <sys/regset.h> 310Sstevel@tonic-gate #include <v9/sys/privregs.h> 320Sstevel@tonic-gate #if defined(__lint) 330Sstevel@tonic-gate #include <sys/thread.h> 340Sstevel@tonic-gate #endif /* __lint */ 350Sstevel@tonic-gate 360Sstevel@tonic-gate #ifdef __cplusplus 370Sstevel@tonic-gate extern "C" { 380Sstevel@tonic-gate #endif 390Sstevel@tonic-gate 400Sstevel@tonic-gate /* 410Sstevel@tonic-gate * This file is machine dependent. 420Sstevel@tonic-gate */ 430Sstevel@tonic-gate 440Sstevel@tonic-gate /* 450Sstevel@tonic-gate * Machine dependent per-thread data. 460Sstevel@tonic-gate */ 470Sstevel@tonic-gate #define MAXWIN 8 /* max # of windows currently supported */ 480Sstevel@tonic-gate 490Sstevel@tonic-gate /* 500Sstevel@tonic-gate * The system actually supports one more than the above number. 510Sstevel@tonic-gate * There is always one window reserved for trap handlers that 520Sstevel@tonic-gate * never has to be saved into the pcb struct. 530Sstevel@tonic-gate */ 540Sstevel@tonic-gate 550Sstevel@tonic-gate /* 560Sstevel@tonic-gate * Distance from beginning of thread stack (t_stk) to saved regs struct. 570Sstevel@tonic-gate */ 580Sstevel@tonic-gate #define REGOFF SA(MINFRAME) 590Sstevel@tonic-gate 600Sstevel@tonic-gate #ifndef _ASM 610Sstevel@tonic-gate 620Sstevel@tonic-gate /* 630Sstevel@tonic-gate * The struct machpcb is always allocated stack aligned. 640Sstevel@tonic-gate */ 650Sstevel@tonic-gate typedef struct machpcb { 660Sstevel@tonic-gate char mpcb_frame[REGOFF]; 670Sstevel@tonic-gate struct regs mpcb_regs; /* user's saved registers */ 680Sstevel@tonic-gate caddr_t mpcb_wbuf; /* pointer to wbuf */ 690Sstevel@tonic-gate caddr_t mpcb_spbuf[MAXWIN]; /* sp's for each wbuf */ 700Sstevel@tonic-gate struct rwindow mpcb_rwin[2]; /* windows used while doing watchpoints */ 710Sstevel@tonic-gate caddr_t mpcb_rsp[2]; /* sp's for pcb_rwin[] */ 720Sstevel@tonic-gate int mpcb_wbcnt; /* number of saved windows in pcb_wbuf */ 730Sstevel@tonic-gate uint_t mpcb_wstate; /* per-lwp %wstate */ 740Sstevel@tonic-gate kfpu_t *mpcb_fpu; /* fpu state */ 750Sstevel@tonic-gate struct fq mpcb_fpu_q[MAXFPQ]; /* fpu exception queue */ 760Sstevel@tonic-gate caddr_t mpcb_illexcaddr; /* address of last illegal instruction */ 770Sstevel@tonic-gate uint_t mpcb_illexcinsn; /* last illegal instruction */ 78*9195SChristopher.Baumbauer@Sun.COM uint_t mpcb_illexccnt; /* count of illegal instruction attempts */ 790Sstevel@tonic-gate int mpcb_flags; /* various state flags */ 800Sstevel@tonic-gate int mpcb_wocnt; /* window overflow count */ 810Sstevel@tonic-gate int mpcb_wucnt; /* window underflow count */ 820Sstevel@tonic-gate kthread_t *mpcb_thread; /* associated thread */ 830Sstevel@tonic-gate uint64_t mpcb_pa; /* pcb physical */ 840Sstevel@tonic-gate uint64_t mpcb_wbuf_pa; /* pointer to wbuf - physical */ 850Sstevel@tonic-gate } machpcb_t; 860Sstevel@tonic-gate #endif /* ! _ASM */ 870Sstevel@tonic-gate 880Sstevel@tonic-gate /* mpcb_flags */ 890Sstevel@tonic-gate #define FP_TRAPPED 0x04 /* fp_traps call caused by fp queue */ 900Sstevel@tonic-gate 910Sstevel@tonic-gate /* 920Sstevel@tonic-gate * We can use lwp_regs to find the mpcb base. 930Sstevel@tonic-gate */ 940Sstevel@tonic-gate #ifndef _ASM 950Sstevel@tonic-gate #define lwptompcb(lwp) ((struct machpcb *) \ 960Sstevel@tonic-gate ((caddr_t)(lwp)->lwp_regs - REGOFF)) 970Sstevel@tonic-gate #endif 980Sstevel@tonic-gate 992005Selowe #ifndef _ASM 1002005Selowe struct kmem_cache; 1012005Selowe extern struct kmem_cache *wbuf32_cache; 1022005Selowe extern struct kmem_cache *wbuf64_cache; 1032005Selowe #endif 1042005Selowe 1050Sstevel@tonic-gate #ifdef __cplusplus 1060Sstevel@tonic-gate } 1070Sstevel@tonic-gate #endif 1080Sstevel@tonic-gate 1090Sstevel@tonic-gate #endif /* _SYS_MACHPCB_H */ 110