]>
Commit | Line | Data |
---|---|---|
de355530 A |
1 | /* |
2 | * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
6 | * The contents of this file constitute Original Code as defined in and | |
7 | * are subject to the Apple Public Source License Version 1.1 (the | |
8 | * "License"). You may not use this file except in compliance with the | |
9 | * License. Please obtain a copy of the License at | |
10 | * http://www.apple.com/publicsource and read it before using this file. | |
11 | * | |
12 | * This Original Code and all software distributed under the License are | |
13 | * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
14 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
15 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
16 | * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the | |
17 | * License for the specific language governing rights and limitations | |
18 | * under the License. | |
19 | * | |
20 | * @APPLE_LICENSE_HEADER_END@ | |
21 | */ | |
22 | /* | |
23 | * @OSF_COPYRIGHT@ | |
24 | */ | |
25 | ||
26 | /* Things that don't need to be exported from pmap. Putting | |
27 | * them here and not in pmap.h avoids major recompiles when | |
28 | * modifying something either here or in proc_reg.h | |
29 | */ | |
30 | ||
31 | #ifndef _PMAP_INTERNALS_H_ | |
32 | #define _PMAP_INTERNALS_H_ | |
33 | ||
34 | /* | |
35 | * Definition of the flags in the low 5 bits of the phys_link field of the phys_entry | |
36 | */ | |
37 | ||
38 | #define PHYS_LOCK 0x00000001 | |
39 | #define PHYS_FLAGS 0x0000001F | |
40 | ||
41 | #ifndef ASSEMBLER | |
42 | ||
43 | #include <cpus.h> | |
44 | #include <mach_ldebug.h> | |
45 | #include <debug.h> | |
46 | ||
47 | #include <mach/vm_types.h> | |
48 | #include <mach/machine/vm_types.h> | |
49 | #include <mach/vm_prot.h> | |
50 | #include <mach/vm_statistics.h> | |
51 | #include <kern/assert.h> | |
52 | #include <kern/cpu_number.h> | |
53 | #include <kern/lock.h> | |
54 | #include <kern/queue.h> | |
55 | #include <ppc/proc_reg.h> | |
56 | ||
57 | ||
58 | /* Page table entries are stored in groups (PTEGS) in a hash table */ | |
59 | ||
60 | #if __PPC__ | |
61 | #if _BIG_ENDIAN == 0 | |
62 | error - bitfield structures are not checked for bit ordering in words | |
63 | #endif /* _BIG_ENDIAN */ | |
64 | #endif /* __PPC__ */ | |
65 | ||
66 | /* | |
67 | * Don't change these structures unless you change the assembly code | |
68 | */ | |
69 | ||
70 | struct phys_entry { | |
71 | struct mapping *phys_link; /* MUST BE FIRST - chain of mappings and flags in the low 5 bits, see above */ | |
72 | unsigned int pte1; /* referenced/changed/wimg - info update atomically */ | |
73 | }; | |
74 | ||
75 | ||
76 | #define PHYS_NULL ((struct phys_entry *)0) | |
77 | ||
78 | /* Memory may be non-contiguous. This data structure contains info | |
79 | * for mapping this non-contiguous space into the contiguous | |
80 | * physical->virtual mapping tables. An array of this type is | |
81 | * provided to the pmap system at bootstrap by ppc_vm_init. | |
82 | * | |
83 | * NB : regions must be in order in this structure. | |
84 | */ | |
85 | ||
86 | typedef struct mem_region { | |
87 | vm_offset_t start; /* Address of base of region */ | |
88 | struct phys_entry *phys_table; /* base of region's table */ | |
89 | unsigned int end; /* End address+1 */ | |
90 | } mem_region_t; | |
91 | ||
92 | /* PMAP_MEM_REGION_MAX has a PowerMac dependancy - at least the value of | |
93 | * kMaxRAMBanks in ppc/POWERMAC/nkinfo.h | |
94 | */ | |
95 | #define PMAP_MEM_REGION_MAX 26 | |
96 | ||
97 | extern mem_region_t pmap_mem_regions[PMAP_MEM_REGION_MAX]; | |
98 | extern int pmap_mem_regions_count; | |
99 | ||
100 | /* keep track of free regions of physical memory so that we can offer | |
101 | * them up via pmap_next_page later on | |
102 | */ | |
103 | ||
104 | #define FREE_REGION_MAX 8 | |
105 | extern mem_region_t free_regions[FREE_REGION_MAX]; | |
106 | extern int free_regions_count; | |
107 | ||
108 | /* Prototypes */ | |
109 | ||
110 | struct phys_entry *pmap_find_physentry(vm_offset_t pa); | |
111 | ||
112 | ||
113 | #if DEBUG | |
114 | extern int pmdebug; | |
115 | #define PDB_LOCK 0x100 | |
116 | #define LOCKPRINTF(args) if (pmdebug & PDB_LOCK) printf args; else | |
117 | #else /* DEBUG */ | |
118 | #define LOCKPRINTF(args) | |
119 | #endif /* DEBUG */ | |
120 | ||
121 | extern vm_offset_t hash_table_base; | |
122 | extern unsigned int hash_table_size; | |
123 | ||
124 | #endif | |
125 | #endif /* _PMAP_INTERNALS_H_ */ |