seg_vn.h revision f747815b19f4ec6501a11d169175a451c84a2eec
/*
* 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 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* University Copyright- Copyright (c) 1982, 1986, 1988
* The Regents of the University of California
* All Rights Reserved
*
* University Acknowledgment- Portions of this document are derived from
* software developed by the University of California, Berkeley, and its
* contributors.
*/
#ifndef _VM_SEG_VN_H
#define _VM_SEG_VN_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
/*
* A pointer to this structure is passed to segvn_create().
*/
typedef struct segvn_crargs {
/*
* (Semi) private data maintained by the seg_vn driver per segment mapping.
*
* vpage array. All fields in segvn_data are treated as read-only when
* the "read" version of the address space and the segment locks are held.
* The "write" version of the segment lock, however, is required in order to
* update the following fields:
*
* pageprot
* prot
* amp
* vpage
*
* softlockcnt
* is written by acquiring either the readers lock on the segment and
* freemem lock, or any lock combination which guarantees exclusive use
* of this segment (e.g., adress space writers lock,
* address space readers lock + segment writers lock).
*/
typedef struct segvn_data {
int tr_state; /* TR (text replication) state */
} segvn_data_t;
#ifdef _KERNEL
/*
* segment text replication states.
*/
#define SEGVN_TR_INIT (0) /* Check if text replication can be enabled */
/*
* Macros for segvn segment driver locking.
*/
/*
* Macros to test lock states.
*/
/*
* Macro used to detect the need to Break the sharing of COW pages
*
* The rw == S_WRITE is for the COW case
* rw == S_READ and type == SOFTLOCK is for the physio case
* We don't want to share a softlocked page because it can cause problems
* with multithreaded apps but if rw == S_READ_NOCOW it's ok to not break
* sharing of COW pages even in SOFTLOCK case.
*/
seg_type == MAP_PRIVATE)
((crfp) == (int (*)())segvn_create && \
(MAP_TEXT | MAP_INITDATA)) && \
((crfp) == (int (*)())segvn_create && \
(svntr_hashtab_sz - 1))
#define SEGVN_TR_ADDSTAT(stat) \
/*
* use for text replication based on main thread's (t_tid = 1) lgrp.
*/
typedef struct svntr {
int tr_valid; /* entry validity state */
} svntr_t;
typedef struct svntr_bucket {
typedef struct svntr_stats {
extern void segvn_init(void);
extern int segvn_create(struct seg *, void *);
/*
* Provided as shorthand for creating user zfod segments.
*/
extern caddr_t zfod_argsp;
extern caddr_t kzfod_argsp;
extern caddr_t stack_exec_argsp;
extern caddr_t stack_noexec_argsp;
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _VM_SEG_VN_H */