|
root / base / usr / src / uts / i86pc / vm / hment.h
hment.h C 102 lines 2.5 KB
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (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
 * or http://www.opensolaris.org/os/licensing.
 * 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 2005 Sun Microsystems, Inc.  All rights reserved.
 * Use is subject to license terms.
 */

#ifndef	_VM_HMENT_H
#define	_VM_HMENT_H

#ifdef	__cplusplus
extern "C" {
#endif


struct hment;
typedef struct hment hment_t;

#if defined(_KERNEL)

/*
 * Remove a page mapping, finds the matching mapping and unlinks it from
 * the page_t. If it returns a non-NULL pointer, the pointer must be
 * freed via hment_free() after doing x86_hm_exit().
 */
extern hment_t *hment_remove(page_t *, htable_t *ht, uint_t entry);
extern void hment_free(hment_t *);

/*
 * Iterator to walk through all mappings of a page.
 */
extern hment_t *hment_walk(page_t *, htable_t **, uint_t *, hment_t *);

/*
 * Prepare a page for a new mapping
 */
extern hment_t *hment_prepare(htable_t *ht, uint_t entry, page_t *);

/*
 * Add a mapping to a page's mapping list
 */
extern void hment_assign(htable_t *ht, uint_t entry, page_t *, hment_t *);

/*
 * initialize hment data structures
 */
extern void hment_init(void);

/*
 * lock/unlock a page_t's mapping list/pte entry
 */
extern void x86_hm_enter(page_t *);
extern void x86_hm_exit(page_t *);
extern int x86_hm_held(page_t *pp);

/*
 * Called to allocate additional hments for reserve.
 *
 * The hment_reserve_count is exported for use by htable_hment_steal()
 */
extern void hment_reserve(uint_t);
extern uint_t hment_reserve_count;

/*
 * Used to readjust the hment reserve after the reserve list has been used.
 * Also called after boot to release left over boot reserves.
 */
extern void hment_adjust_reserve(void);

/*
 * Return the number of mappings of a page_t
 */
extern uint_t hment_mapcnt(page_t *);

#endif	/* _KERNEL */


#ifdef	__cplusplus
}
#endif

#endif	/* _VM_HMENT_H */