etc/protocols - sync with NetBSD-8
[minix.git] / sys / arch / x86 / include / pmap_pv.h
blobd8e40dd45cc7ca3a45e8367f1900d904d883cd3c
1 /* $NetBSD: pmap_pv.h,v 1.3 2011/06/12 03:35:50 rmind 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 union {
69 /* PP_EMBEDDED */
70 struct pv_pte u_pte;
72 /* !PP_EMBEDDED */
73 struct pv_head {
74 LIST_HEAD(, pv_entry) pvh_list;
75 } u_head;
77 /* PTPs */
78 struct vm_page *u_link;
79 } pp_u;
80 #define pp_pte pp_u.u_pte
81 #define pp_head pp_u.u_head
82 #define pp_link pp_u.u_link
83 uint8_t pp_flags;
84 uint8_t pp_attrs; /* saved PG_M and PG_U */
87 /* pp_flags */
88 #define PP_EMBEDDED 1
90 #define PMAP_PAGE_INIT(pp) /* none */
92 #endif /* !_X86_PMAP_PV_H_ */