No empty .Rs/.Re
[netbsd-mini2440.git] / sys / arch / x86 / include / pmap_pv.h
blobde9fb971b514c7bed81066dad5e475662d3e3408
1 /* $NetBSD: pmap_pv.h,v 1.1 2008/01/20 13:43:38 yamt Exp $ */
3 /*-
4 * Copyright (c)2008 YAMAMOTO Takashi,
5 * All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
29 #ifndef _X86_PMAP_PV_H_
30 #define _X86_PMAP_PV_H_
32 #include <sys/mutex.h>
33 #include <sys/queue.h>
35 struct vm_page;
38 * structures to track P->V mapping
40 * this file is intended to be minimum as it's included by <machine/vmparam.h>.
44 * pv_pte: describe a pte
47 struct pv_pte {
48 struct vm_page *pte_ptp; /* PTP; NULL for pmap_kernel() */
49 vaddr_t pte_va; /* VA */
53 * pv_entry: plug pv_pte into lists.
56 struct pv_entry {
57 struct pv_pte pve_pte; /* should be the first member */
58 LIST_ENTRY(pv_entry) pve_list; /* on pv_head::pvh_list */
59 SLIST_ENTRY(pv_entry) pve_hash;
61 #define pve_next pve_list.le_next
64 * pmap_page: a structure which is embedded in each vm_page.
67 struct pmap_page {
68 kmutex_t pp_lock;
69 union {
70 /* PP_EMBEDDED */
71 struct pv_pte u_pte;
73 /* !PP_EMBEDDED */
74 struct pv_head {
75 LIST_HEAD(, pv_entry) pvh_list;
76 } u_head;
78 /* PTPs */
79 struct vm_page *u_link;
80 } pp_u;
81 #define pp_pte pp_u.u_pte
82 #define pp_head pp_u.u_head
83 #define pp_link pp_u.u_link
84 uint8_t pp_flags;
85 uint8_t pp_attrs; /* saved PG_M and PG_U */
88 /* pp_flags */
89 #define PP_EMBEDDED 1
91 #define PMAP_PAGE_INIT(pp) \
92 mutex_init(&(pp)->pp_lock, MUTEX_NODEBUG, IPL_VM)
94 #endif /* !_X86_PMAP_PV_H_ */