Deleted Added
full compact
pmap.h (91257) pmap.h (91288)
1/*
2 * Copyright (c) 1991 Regents of the University of California.
3 * All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * the Systems Programming Group of the University of Utah Computer
7 * Science Department and William Jolitz of UUNET Technologies Inc.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * 3. All advertising materials mentioning features or use of this software
18 * must display the following acknowledgement:
19 * This product includes software developed by the University of
20 * California, Berkeley and its contributors.
21 * 4. Neither the name of the University nor the names of its contributors
22 * may be used to endorse or promote products derived from this software
23 * without specific prior written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * SUCH DAMAGE.
36 *
37 * from: hp300: @(#)pmap.h 7.2 (Berkeley) 12/16/90
38 * from: @(#)pmap.h 7.4 (Berkeley) 5/12/91
39 * from: FreeBSD: src/sys/i386/include/pmap.h,v 1.70 2000/11/30
1/*
2 * Copyright (c) 1991 Regents of the University of California.
3 * All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * the Systems Programming Group of the University of Utah Computer
7 * Science Department and William Jolitz of UUNET Technologies Inc.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * 3. All advertising materials mentioning features or use of this software
18 * must display the following acknowledgement:
19 * This product includes software developed by the University of
20 * California, Berkeley and its contributors.
21 * 4. Neither the name of the University nor the names of its contributors
22 * may be used to endorse or promote products derived from this software
23 * without specific prior written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * SUCH DAMAGE.
36 *
37 * from: hp300: @(#)pmap.h 7.2 (Berkeley) 12/16/90
38 * from: @(#)pmap.h 7.4 (Berkeley) 5/12/91
39 * from: FreeBSD: src/sys/i386/include/pmap.h,v 1.70 2000/11/30
40 * $FreeBSD: head/sys/sparc64/include/pmap.h 91257 2002-02-25 22:58:41Z jake $
40 * $FreeBSD: head/sys/sparc64/include/pmap.h 91288 2002-02-26 06:57:30Z jake $
41 */
42
43#ifndef _MACHINE_PMAP_H_
44#define _MACHINE_PMAP_H_
45
46#include <machine/tte.h>
47
48#define DCACHE_COLOR_BITS (1)
49#define DCACHE_COLORS (1 << DCACHE_COLOR_BITS)
50#define DCACHE_COLOR_MASK (DCACHE_COLORS - 1)
51#define DCACHE_COLOR(va) (((va) >> PAGE_SHIFT) & DCACHE_COLOR_MASK)
52
53#define PMAP_CONTEXT_MAX 8192
54
55#define pmap_resident_count(pm) (pm->pm_stats.resident_count)
56
57struct pv_entry;
58
59typedef struct pmap *pmap_t;
60typedef struct pv_entry *pv_entry_t;
61
62struct md_page {
63 TAILQ_HEAD(, pv_entry) pv_list;
64 int pv_list_count;
65 int colors[DCACHE_COLORS];
66};
67
68struct pmap {
69 TAILQ_HEAD(,pv_entry) pm_pvlist;
70 struct tte *pm_tsb;
71 vm_object_t pm_tsb_obj;
72 u_int pm_active;
41 */
42
43#ifndef _MACHINE_PMAP_H_
44#define _MACHINE_PMAP_H_
45
46#include <machine/tte.h>
47
48#define DCACHE_COLOR_BITS (1)
49#define DCACHE_COLORS (1 << DCACHE_COLOR_BITS)
50#define DCACHE_COLOR_MASK (DCACHE_COLORS - 1)
51#define DCACHE_COLOR(va) (((va) >> PAGE_SHIFT) & DCACHE_COLOR_MASK)
52
53#define PMAP_CONTEXT_MAX 8192
54
55#define pmap_resident_count(pm) (pm->pm_stats.resident_count)
56
57struct pv_entry;
58
59typedef struct pmap *pmap_t;
60typedef struct pv_entry *pv_entry_t;
61
62struct md_page {
63 TAILQ_HEAD(, pv_entry) pv_list;
64 int pv_list_count;
65 int colors[DCACHE_COLORS];
66};
67
68struct pmap {
69 TAILQ_HEAD(,pv_entry) pm_pvlist;
70 struct tte *pm_tsb;
71 vm_object_t pm_tsb_obj;
72 u_int pm_active;
73 u_int pm_context;
73 u_int pm_context[MAXCPU];
74 u_int pm_count;
75 struct pmap_statistics pm_stats;
76};
77
78struct pv_entry {
79 TAILQ_ENTRY(pv_entry) pv_list;
80 TAILQ_ENTRY(pv_entry) pv_plist;
81 pmap_t pv_pmap;
82 vm_offset_t pv_va;
83 vm_page_t pv_m;
84};
85
86void pmap_bootstrap(vm_offset_t ekva);
87vm_offset_t pmap_kextract(vm_offset_t va);
88void pmap_kenter_flags(vm_offset_t va, vm_offset_t pa, u_long flags);
89void pmap_qenter_flags(vm_offset_t va, vm_page_t *m, int count, u_long fl);
90
91int pmap_cache_enter(vm_page_t m, vm_offset_t va);
92void pmap_cache_remove(vm_page_t m, vm_offset_t va);
93
94void pmap_map_tsb(void);
95
96#define vtophys(va) pmap_kextract(((vm_offset_t) (va)))
97
98extern vm_offset_t avail_start;
99extern vm_offset_t avail_end;
100extern struct pmap kernel_pmap_store;
101#define kernel_pmap (&kernel_pmap_store)
102extern vm_offset_t phys_avail[];
103extern vm_offset_t virtual_avail;
104extern vm_offset_t virtual_end;
105extern vm_offset_t kernel_page;
106
107extern int pmap_pagedaemon_waken;
108
109extern vm_offset_t msgbuf_phys;
110
111static __inline int
112pmap_track_modified(pmap_t pm, vm_offset_t va)
113{
114 if (pm == kernel_pmap)
115 return ((va < kmi.clean_sva) || (va >= kmi.clean_eva));
116 else
117 return (1);
118}
119
120#endif /* !_MACHINE_PMAP_H_ */
74 u_int pm_count;
75 struct pmap_statistics pm_stats;
76};
77
78struct pv_entry {
79 TAILQ_ENTRY(pv_entry) pv_list;
80 TAILQ_ENTRY(pv_entry) pv_plist;
81 pmap_t pv_pmap;
82 vm_offset_t pv_va;
83 vm_page_t pv_m;
84};
85
86void pmap_bootstrap(vm_offset_t ekva);
87vm_offset_t pmap_kextract(vm_offset_t va);
88void pmap_kenter_flags(vm_offset_t va, vm_offset_t pa, u_long flags);
89void pmap_qenter_flags(vm_offset_t va, vm_page_t *m, int count, u_long fl);
90
91int pmap_cache_enter(vm_page_t m, vm_offset_t va);
92void pmap_cache_remove(vm_page_t m, vm_offset_t va);
93
94void pmap_map_tsb(void);
95
96#define vtophys(va) pmap_kextract(((vm_offset_t) (va)))
97
98extern vm_offset_t avail_start;
99extern vm_offset_t avail_end;
100extern struct pmap kernel_pmap_store;
101#define kernel_pmap (&kernel_pmap_store)
102extern vm_offset_t phys_avail[];
103extern vm_offset_t virtual_avail;
104extern vm_offset_t virtual_end;
105extern vm_offset_t kernel_page;
106
107extern int pmap_pagedaemon_waken;
108
109extern vm_offset_t msgbuf_phys;
110
111static __inline int
112pmap_track_modified(pmap_t pm, vm_offset_t va)
113{
114 if (pm == kernel_pmap)
115 return ((va < kmi.clean_sva) || (va >= kmi.clean_eva));
116 else
117 return (1);
118}
119
120#endif /* !_MACHINE_PMAP_H_ */