klwp.h revision 9acbbeaf2a1ffe5c14b244867d427714fab43c5c
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_KLWP_H
#define _SYS_KLWP_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/ucontext.h>
#include <sys/contract.h>
#include <sys/machparam.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* The light-weight process object and the methods by which it
* is accessed.
*/
/* lwp_eosys values */
#define NORMALRETURN 0 /* normal return; adjusts PC, registers */
/*
* Resource usage, per-lwp plus per-process (sum over defunct lwps).
*/
struct lrusage {
};
typedef struct _klwp {
/*
* user-mode context
*/
/*
* system-call interface
*/
long *lwp_ap; /* pointer to arglist */
int lwp_errno; /* error for current syscall (private) */
/*
* support for I/O
*/
char lwp_error; /* return error code */
char lwp_eosys; /* special action on end of syscall */
char lwp_argsaved; /* are all args in lwp_arg */
char lwp_watchtrap; /* lwp undergoing watchpoint single-step */
void *lwp_regs; /* pointer to saved regs on stack */
void *lwp_fpu; /* pointer to fpu regs */
/*
* signal handling and debugger (/proc) interface
*/
struct lwp_watch { /* used in watchpoint single-stepping */
int wpcode;
int wpmapped;
/*
* Microstate accounting. Timestamps are made at the start and the
* and the corresponding accounting info is updated. The current
* microstate is kept in the thread struct, since there are cases
* when one thread must update another thread's state (a no-no
* microstate stuff is kept here to avoid wasting space on things
* like kernel threads that don't have an associated lwp.
*/
struct mstate {
int ms_prev; /* previous running mstate */
} lwp_mstate;
/*
* Per-lwp resource usage.
*/
/*
* Things to keep for real-time (SIGPROF) profiling.
*/
int lwp_lastfault;
/*
* timers. Protected by lwp->procp->p_lock
*/
/*
* There are a number of places where you do not wish an lwp to
* be stopped due to some interaction with other lwps in the process.
* In these cases the lwp_nostop value is incremented. At places where
* the lwp would normally be stopped the stop is allowed if lwp_nostop
* is zero. There are a very few cases where even if lwp_nostop is set
* we need to allow the lwp to stop. In those cases the lwp is
* stopped if lwp_nostop_r is not set regardless of the state of
* lwp_nostop. These conditions are:
*
* 1. In issig_forreal() when another lwp is undergoing fork1()
* or watchpoint activity (p_flag contains either SHOLDFORK1 or
* SHOLDWATCH or t_proc_flag contains TP_HOLDLWP)
*
* 2. In stop() when the why argument is not PR_SUSPENDED or the what
* argument is not SUSPEND_NORMAL.
*
* 3. In cv_wait_stop() when another lwp is undergoing fork1() or
* watchpoint activity (p_flag contains either SHOLDFORK1 or
* SHOLDWATCH or t_proc_flag contains TP_HOLDLWP)
*
* lwp_nostop_r is set in prstop(). ie we honour the presence of
* SHOLDFORK1 or SHOLDWATCH or TP_HOLDLWP in the case of
* stop(PR_SUSPENDED, SUSPEND_NORMAL)
*/
char lwp_unused;
/*
* Last failed privilege.
*/
short lwp_badpriv;
/*
* linkage
*/
struct _kthread *lwp_thread;
/*
* Contracts
*/
void *lwp_brand; /* per-lwp brand data */
} klwp_t;
/* lwp states */
#if defined(_KERNEL)
extern int lwp_default_stksize;
extern int lwp_reapcnt;
extern struct _kthread *lwp_deathrow;
extern struct kmem_cache *lwp_cache;
extern void *segkp_lwp;
/* where newly-created lwps normally start */
extern void lwp_rtt(void);
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_KLWP_H */