Project

General

Profile

Statistics
| Revision:

root / lab4 / .minix-src / include / x86 / pmap_pv.h @ 13

History | View | Annotate | Download (2.53 KB)

1 13 up20180614
/*        $NetBSD: pmap_pv.h,v 1.3 2011/06/12 03:35:50 rmind Exp $        */
2
3
/*-
4
 * Copyright (c)2008 YAMAMOTO Takashi,
5
 * All rights reserved.
6
 *
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.
15
 *
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.
27
 */
28
29
#ifndef _X86_PMAP_PV_H_
30
#define        _X86_PMAP_PV_H_
31
32
#include <sys/mutex.h>
33
#include <sys/queue.h>
34
35
struct vm_page;
36
37
/*
38
 * structures to track P->V mapping
39
 *
40
 * this file is intended to be minimum as it's included by <machine/vmparam.h>.
41
 */
42
43
/*
44
 * pv_pte: describe a pte
45
 */
46
47
struct pv_pte {
48
        struct vm_page *pte_ptp;        /* PTP; NULL for pmap_kernel() */
49
        vaddr_t pte_va;                        /* VA */
50
};
51
52
/*
53
 * pv_entry: plug pv_pte into lists.
54
 */
55
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;
60
};
61
#define        pve_next        pve_list.le_next
62
63
/*
64
 * pmap_page: a structure which is embedded in each vm_page.
65
 */
66
67
struct pmap_page {
68
        union {
69
                /* PP_EMBEDDED */
70
                struct pv_pte u_pte;
71
72
                /* !PP_EMBEDDED */
73
                struct pv_head {
74
                        LIST_HEAD(, pv_entry) pvh_list;
75
                } u_head;
76
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 */
85
};
86
87
/* pp_flags */
88
#define        PP_EMBEDDED        1
89
90
#define        PMAP_PAGE_INIT(pp)        /* none */
91
92
#endif /* !_X86_PMAP_PV_H_ */