2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
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.
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
20 * @APPLE_LICENSE_HEADER_END@
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
31 #ifndef _PMAP_INTERNALS_H_
32 #define _PMAP_INTERNALS_H_
35 * Definition of the flags in the low 5 bits of the phys_link field of the phys_entry
38 #define PHYS_LOCK 0x00000001
39 #define PHYS_FLAGS 0x0000001F
44 #include <mach_ldebug.h>
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>
58 /* Page table entries are stored in groups (PTEGS) in a hash table */
62 error
- bitfield structures are
not checked
for bit ordering in words
63 #endif /* _BIG_ENDIAN */
67 * Don't change these structures unless you change the assembly code
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 */
76 #define PHYS_NULL ((struct phys_entry *)0)
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.
83 * NB : regions must be in order in this structure.
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 */
92 /* PMAP_MEM_REGION_MAX has a PowerMac dependancy - at least the value of
93 * kMaxRAMBanks in ppc/POWERMAC/nkinfo.h
95 #define PMAP_MEM_REGION_MAX 26
97 extern mem_region_t pmap_mem_regions
[PMAP_MEM_REGION_MAX
];
98 extern int pmap_mem_regions_count
;
100 /* keep track of free regions of physical memory so that we can offer
101 * them up via pmap_next_page later on
104 #define FREE_REGION_MAX 8
105 extern mem_region_t free_regions
[FREE_REGION_MAX
];
106 extern int free_regions_count
;
110 struct phys_entry
*pmap_find_physentry(vm_offset_t pa
);
115 #define PDB_LOCK 0x100
116 #define LOCKPRINTF(args) if (pmdebug & PDB_LOCK) printf args; else
118 #define LOCKPRINTF(args)
121 extern vm_offset_t hash_table_base
;
122 extern unsigned int hash_table_size
;
125 #endif /* _PMAP_INTERNALS_H_ */