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