2 * Copyright (c) 2000-2005 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 * Mach Operating System
27 * Copyright (c) 1990,1991,1992 The University of Utah and
28 * the Center for Software Science (CSS).
29 * Copyright (c) 1991,1987 Carnegie Mellon University.
30 * All rights reserved.
32 * Permission to use, copy, modify and distribute this software and its
33 * documentation is hereby granted, provided that both the copyright
34 * notice and this permission notice appear in all copies of the
35 * software, derivative works or modified versions, and any portions
36 * thereof, and that both notices appear in supporting documentation,
37 * and that all advertising materials mentioning features or use of
38 * this software display the following acknowledgement: ``This product
39 * includes software developed by the Center for Software Science at
40 * the University of Utah.''
42 * CARNEGIE MELLON, THE UNIVERSITY OF UTAH AND CSS ALLOW FREE USE OF
43 * THIS SOFTWARE IN ITS "AS IS" CONDITION, AND DISCLAIM ANY LIABILITY
44 * OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF
47 * CSS requests users of this software to return to css-dist@cs.utah.edu any
48 * improvements that they make and grant CSS redistribution rights.
50 * Carnegie Mellon requests users of this software to return to
51 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
52 * School of Computer Science
53 * Carnegie Mellon University
54 * Pittsburgh PA 15213-3890
55 * any improvements or extensions that they make and grant Carnegie Mellon
56 * the rights to redistribute these changes.
58 * Utah $Hdr: pmap.c 1.28 92/06/23$
59 * Author: Mike Hibler, Bob Wheeler, University of Utah CSS, 10/90
63 * Manages physical address maps for powerpc.
65 * In addition to hardware address maps, this
66 * module is called upon to provide software-use-only
67 * maps which may or may not be stored in the same
68 * form as hardware maps. These pseudo-maps are
69 * used to store intermediate results from copy
70 * operations to and from address spaces.
72 * Since the information managed by this module is
73 * also stored by the logical address mapping module,
74 * this module may throw away valid virtual-to-physical
75 * mappings at almost any time. However, invalidations
76 * of virtual-to-physical mappings must be done as
79 * In order to cope with hardware architectures which
80 * make virtual-to-physical map invalidates expensive,
81 * this module may delay invalidate or reduced protection
82 * operations until such time as they are actually
83 * necessary. This module is given full information to
84 * when physical maps must be made correct.
88 #include <zone_debug.h>
90 #include <mach_kgdb.h>
91 #include <mach_vm_debug.h>
92 #include <db_machine_commands.h>
94 #include <kern/thread.h>
95 #include <kern/simple_lock.h>
96 #include <mach/vm_attributes.h>
97 #include <mach/vm_param.h>
98 #include <vm/vm_kern.h>
101 #include <kern/misc_protos.h>
102 #include <ppc/misc_protos.h>
103 #include <ppc/proc_reg.h>
106 #include <vm/vm_map.h>
107 #include <vm/vm_page.h>
109 #include <ppc/pmap.h>
111 #include <ppc/mappings.h>
113 #include <ppc/new_screen.h>
114 #include <ppc/Firmware.h>
115 #include <ppc/savearea.h>
116 #include <ppc/cpu_internal.h>
117 #include <ppc/exception.h>
118 #include <ppc/low_trace.h>
119 #include <ppc/lowglobals.h>
120 #include <ddb/db_output.h>
121 #include <machine/cpu_capabilities.h>
123 #include <vm/vm_protos.h> /* must be last */
126 extern unsigned int avail_remaining
;
127 unsigned int debugbackpocket
; /* (TEST/DEBUG) */
129 vm_offset_t first_free_virt
;
130 int current_free_region
; /* Used in pmap_next_page */
132 pmapTransTab
*pmapTrans
; /* Point to the hash to pmap translations */
133 struct phys_entry
*phys_table
;
136 static void pmap_map_physical(void);
137 static void pmap_map_iohole(addr64_t paddr
, addr64_t size
);
138 void pmap_activate(pmap_t pmap
, thread_t th
, int which_cpu
);
139 void pmap_deactivate(pmap_t pmap
, thread_t th
, int which_cpu
);
141 extern void hw_hash_init(void);
143 /* NOTE: kernel_pmap_store must be in V=R storage and aligned!!!!!!!!!!!!!! */
145 extern struct pmap kernel_pmap_store
;
146 pmap_t kernel_pmap
; /* Pointer to kernel pmap and anchor for in-use pmaps */
147 addr64_t kernel_pmap_phys
; /* Pointer to kernel pmap and anchor for in-use pmaps, physical address */
148 pmap_t cursor_pmap
; /* Pointer to last pmap allocated or previous if removed from in-use list */
149 pmap_t sharedPmap
; /* Pointer to common pmap for 64-bit address spaces */
150 struct zone
*pmap_zone
; /* zone of pmap structures */
151 boolean_t pmap_initialized
= FALSE
;
153 int ppc_max_pmaps
; /* Maximum number of concurrent address spaces allowed. This is machine dependent */
154 addr64_t vm_max_address
; /* Maximum effective address supported */
155 addr64_t vm_max_physical
; /* Maximum physical address supported */
158 * Physical-to-virtual translations are handled by inverted page table
159 * structures, phys_tables. Multiple mappings of a single page are handled
160 * by linking the affected mapping structures. We initialise one region
161 * for phys_tables of the physical memory we know about, but more may be
162 * added as it is discovered (eg. by drivers).
166 * free pmap list. caches the first free_pmap_max pmaps that are freed up
168 int free_pmap_max
= 32;
170 pmap_t free_pmap_list
;
171 decl_simple_lock_data(,free_pmap_lock
)
174 * Function to get index into phys_table for a given physical address
177 struct phys_entry
*pmap_find_physentry(ppnum_t pa
)
182 for (i
= pmap_mem_regions_count
- 1; i
>= 0; i
--) {
183 if (pa
< pmap_mem_regions
[i
].mrStart
) continue; /* See if we fit in this region */
184 if (pa
> pmap_mem_regions
[i
].mrEnd
) continue; /* Check the end too */
186 entry
= (unsigned int)pmap_mem_regions
[i
].mrPhysTab
+ ((pa
- pmap_mem_regions
[i
].mrStart
) * sizeof(phys_entry_t
));
187 return (struct phys_entry
*)entry
;
189 // kprintf("DEBUG - pmap_find_physentry: page 0x%08X not found\n", pa);
195 * pmap_add_physical_memory(vm_offset_t spa, vm_offset_t epa,
196 * boolean_t available, unsigned int attr)
198 * THIS IS NOT SUPPORTED
201 pmap_add_physical_memory(
202 __unused vm_offset_t spa
,
203 __unused vm_offset_t epa
,
204 __unused boolean_t available
,
205 __unused
unsigned int attr
)
208 panic("Forget it! You can't map no more memory, you greedy puke!\n");
213 * pmap_map(va, spa, epa, prot)
214 * is called during boot to map memory in the kernel's address map.
215 * A virtual address range starting at "va" is mapped to the physical
216 * address range "spa" to "epa" with machine independent protection
219 * "va", "spa", and "epa" are byte addresses and must be on machine
220 * independent page boundaries.
222 * Pages with a contiguous virtual address range, the same protection, and attributes.
223 * therefore, we map it with a single block.
225 * Note that this call will only map into 32-bit space
239 if (spa
== epa
) return(va
);
243 colladr
= mapping_make(kernel_pmap
, (addr64_t
)va
, (ppnum_t
)(spa
>> 12), (mmFlgBlock
| mmFlgPerm
), (epa
- spa
) >> 12, prot
& VM_PROT_ALL
);
245 if(colladr
) { /* Was something already mapped in the range? */
246 panic("pmap_map: attempt to map previously mapped range - va = %08X, pa = %08X, epa = %08X, collision = %016llX\n",
247 va
, spa
, epa
, colladr
);
253 * pmap_map_physical()
254 * Maps physical memory into the kernel's address map beginning at lgPMWvaddr, the
255 * physical memory window.
263 /* Iterate over physical memory regions, block mapping each into the kernel's address map */
264 for (region
= 0; region
< (unsigned)pmap_mem_regions_count
; region
++) {
265 addr64_t paddr
= ((addr64_t
)pmap_mem_regions
[region
].mrStart
<< 12);
266 addr64_t size
= (((addr64_t
)pmap_mem_regions
[region
].mrEnd
+ 1) << 12) - paddr
;
268 /* Block mappings are limited to 256M, so we map in blocks of up to 256M */
269 addr64_t vaddr
= paddr
+ lowGlo
.lgPMWvaddr
;
270 unsigned msize
= ((size
> 0x10000000)? 0x10000000 : size
);
271 addr64_t colladdr
= mapping_make(kernel_pmap
, vaddr
, (paddr
>> 12),
272 (mmFlgBlock
| mmFlgPerm
), (msize
>> 12),
273 (VM_PROT_READ
| VM_PROT_WRITE
));
275 panic ("pmap_map_physical: collision with previously mapped range - va = %016llX, pa = %08X, size = %08X, collision = %016llX\n",
276 vaddr
, (paddr
>> 12), (msize
>> 12), colladdr
);
285 * pmap_map_iohole(addr64_t paddr, addr64_t size)
286 * Maps an I/O hole into the kernel's address map at its proper offset in
287 * the physical memory window.
291 pmap_map_iohole(addr64_t paddr
, addr64_t size
)
294 addr64_t vaddr
= paddr
+ lowGlo
.lgPMWvaddr
;
295 unsigned msize
= ((size
> 0x10000000)? 0x10000000 : size
);
296 addr64_t colladdr
= mapping_make(kernel_pmap
, vaddr
, (paddr
>> 12),
297 (mmFlgBlock
| mmFlgPerm
| mmFlgGuarded
| mmFlgCInhib
), (msize
>> 12),
298 (VM_PROT_READ
| VM_PROT_WRITE
));
300 panic ("pmap_map_iohole: collision with previously mapped range - va = %016llX, pa = %08X, size = %08X, collision = %016llX\n",
301 vaddr
, (paddr
>> 12), (msize
>> 12), colladdr
);
309 * Bootstrap the system enough to run with virtual memory.
310 * Map the kernel's code and data, and allocate the system page table.
311 * Called with mapping done by BATs. Page_size must already be set.
314 * msize: Total memory present
315 * first_avail: First virtual address available
316 * kmapsize: Size of kernel text and data
319 pmap_bootstrap(uint64_t msize
, vm_offset_t
*first_avail
, unsigned int kmapsize
)
323 unsigned int i
, num
, mapsize
, vmpagesz
, vmmapsz
, nbits
;
327 vm_offset_t first_used_addr
, PCAsize
;
328 struct phys_entry
*phys_entry
;
330 *first_avail
= round_page(*first_avail
); /* Make sure we start out on a page boundary */
331 vm_last_addr
= VM_MAX_KERNEL_ADDRESS
; /* Set the highest address know to VM */
334 * Initialize kernel pmap
336 kernel_pmap
= &kernel_pmap_store
;
337 kernel_pmap_phys
= (addr64_t
)&kernel_pmap_store
;
338 cursor_pmap
= &kernel_pmap_store
;
340 kernel_pmap
->pmap_link
.next
= (queue_t
)kernel_pmap
; /* Set up anchor forward */
341 kernel_pmap
->pmap_link
.prev
= (queue_t
)kernel_pmap
; /* Set up anchor reverse */
342 kernel_pmap
->ref_count
= 1;
343 kernel_pmap
->pmapFlags
= pmapKeyDef
; /* Set the default keys */
344 kernel_pmap
->pmapCCtl
= pmapCCtlVal
; /* Initialize cache control */
345 kernel_pmap
->space
= PPC_SID_KERNEL
;
346 kernel_pmap
->pmapvr
= 0; /* Virtual = Real */
349 * IBM's recommended hash table size is one PTEG for every 2 physical pages.
350 * However, we have found that OSX rarely uses more than 4 PTEs in a PTEG
351 * with this size table. Therefore, by default we allocate a hash table
352 * one half IBM's recommended size, ie one PTEG per 4 pages. The "ht_shift" boot-arg
353 * can be used to override the default hash table size.
354 * We will allocate the hash table in physical RAM, outside of kernel virtual memory,
355 * at the top of the highest bank that will contain it.
356 * Note that "bank" doesn't refer to a physical memory slot here, it is a range of
357 * physically contiguous memory.
359 * The PCA will go there as well, immediately before the hash table.
362 nbits
= cntlzw(((msize
<< 1) - 1) >> 32); /* Get first bit in upper half */
363 if (nbits
== 32) /* If upper half was empty, find bit in bottom half */
364 nbits
= nbits
+ cntlzw((uint_t
)((msize
<< 1) - 1));
365 tmemsize
= 0x8000000000000000ULL
>> nbits
; /* Get memory size rounded up to power of 2 */
367 /* Calculate hash table size: First, make sure we don't overflow 32-bit arithmetic. */
368 if (tmemsize
> 0x0000002000000000ULL
)
369 tmemsize
= 0x0000002000000000ULL
;
371 /* Second, calculate IBM recommended hash table size, ie one PTEG per 2 physical pages */
372 hash_table_size
= (uint_t
)(tmemsize
>> 13) * PerProcTable
[0].ppe_vaddr
->pf
.pfPTEG
;
374 /* Third, cut this in half to produce the OSX default, ie one PTEG per 4 physical pages */
375 hash_table_size
>>= 1;
377 /* Fourth, adjust default size per "ht_shift" boot arg */
378 if (hash_table_shift
>= 0) /* if positive, make size bigger */
379 hash_table_size
<<= hash_table_shift
;
380 else /* if "ht_shift" is negative, make smaller */
381 hash_table_size
>>= (-hash_table_shift
);
383 /* Fifth, make sure we are at least minimum size */
384 if (hash_table_size
< (256 * 1024))
385 hash_table_size
= (256 * 1024);
387 while(1) { /* Try to fit hash table in PCA into contiguous memory */
389 if(hash_table_size
< (256 * 1024)) { /* Have we dropped too short? This should never, ever happen */
390 panic("pmap_bootstrap: Can't find space for hash table\n"); /* This will never print, system isn't up far enough... */
393 PCAsize
= (hash_table_size
/ PerProcTable
[0].ppe_vaddr
->pf
.pfPTEG
) * sizeof(PCA_t
); /* Get total size of PCA table */
394 PCAsize
= round_page(PCAsize
); /* Make sure it is at least a page long */
396 for(bank
= pmap_mem_regions_count
- 1; bank
>= 0; bank
--) { /* Search backwards through banks */
398 hash_table_base
= ((addr64_t
)pmap_mem_regions
[bank
].mrEnd
<< 12) - hash_table_size
+ PAGE_SIZE
; /* Get tenative address */
400 htslop
= hash_table_base
& (hash_table_size
- 1); /* Get the extra that we will round down when we align */
401 hash_table_base
= hash_table_base
& -(addr64_t
)hash_table_size
; /* Round down to correct boundary */
403 if((hash_table_base
- round_page(PCAsize
)) >= ((addr64_t
)pmap_mem_regions
[bank
].mrStart
<< 12)) break; /* Leave if we fit */
406 if(bank
>= 0) break; /* We are done if we found a suitable bank */
408 hash_table_size
= hash_table_size
>> 1; /* Try the next size down */
411 if(htslop
) { /* If there was slop (i.e., wasted pages for alignment) add a new region */
412 for(i
= pmap_mem_regions_count
- 1; i
>= (unsigned)bank
; i
--) { /* Copy from end to our bank, including our bank */
413 pmap_mem_regions
[i
+ 1].mrStart
= pmap_mem_regions
[i
].mrStart
; /* Set the start of the bank */
414 pmap_mem_regions
[i
+ 1].mrAStart
= pmap_mem_regions
[i
].mrAStart
; /* Set the start of allocatable area */
415 pmap_mem_regions
[i
+ 1].mrEnd
= pmap_mem_regions
[i
].mrEnd
; /* Set the end address of bank */
416 pmap_mem_regions
[i
+ 1].mrAEnd
= pmap_mem_regions
[i
].mrAEnd
; /* Set the end address of allocatable area */
419 pmap_mem_regions
[i
+ 1].mrStart
= (hash_table_base
+ hash_table_size
) >> 12; /* Set the start of the next bank to the start of the slop area */
420 pmap_mem_regions
[i
+ 1].mrAStart
= (hash_table_base
+ hash_table_size
) >> 12; /* Set the start of allocatable area to the start of the slop area */
421 pmap_mem_regions
[i
].mrEnd
= (hash_table_base
+ hash_table_size
- 4096) >> 12; /* Set the end of our bank to the end of the hash table */
425 pmap_mem_regions
[bank
].mrAEnd
= (hash_table_base
- PCAsize
- 4096) >> 12; /* Set the maximum allocatable in this bank */
427 hw_hash_init(); /* Initiaize the hash table and PCA */
428 hw_setup_trans(); /* Set up hardware registers needed for translation */
431 * The hash table is now all initialized and so is the PCA. Go on to do the rest of it.
432 * This allocation is from the bottom up.
435 num
= atop_64(msize
); /* Get number of pages in all of memory */
437 /* Figure out how much we need to allocate */
440 (InitialSaveBloks
* PAGE_SIZE
) + /* Allow space for the initial context saveareas */
441 (BackPocketSaveBloks
* PAGE_SIZE
) + /* For backpocket saveareas */
442 trcWork
.traceSize
+ /* Size of trace table */
443 ((((1 << maxAdrSpb
) * sizeof(pmapTransTab
)) + 4095) & -4096) + /* Size of pmap translate table */
444 (((num
* sizeof(struct phys_entry
)) + 4095) & -4096) /* For the physical entries */
447 mapsize
= size
= round_page(size
); /* Get size of area to map that we just calculated */
448 mapsize
= mapsize
+ kmapsize
; /* Account for the kernel text size */
450 vmpagesz
= round_page(num
* sizeof(struct vm_page
)); /* Allow for all vm_pages needed to map physical mem */
451 vmmapsz
= round_page((num
/ 8) * sizeof(struct vm_map_entry
)); /* Allow for vm_maps */
453 mapsize
= mapsize
+ vmpagesz
+ vmmapsz
; /* Add the VM system estimates into the grand total */
455 mapsize
= mapsize
+ (4 * 1024 * 1024); /* Allow for 4 meg of extra mappings */
456 mapsize
= ((mapsize
/ PAGE_SIZE
) + MAPPERBLOK
- 1) / MAPPERBLOK
; /* Get number of blocks of mappings we need */
457 mapsize
= mapsize
+ ((mapsize
+ MAPPERBLOK
- 1) / MAPPERBLOK
); /* Account for the mappings themselves */
459 size
= size
+ (mapsize
* PAGE_SIZE
); /* Get the true size we need */
461 /* hash table must be aligned to its size */
463 addr
= *first_avail
; /* Set the address to start allocations */
464 first_used_addr
= addr
; /* Remember where we started */
466 bzero((char *)addr
, size
); /* Clear everything that we are allocating */
468 savearea_init(addr
); /* Initialize the savearea chains and data */
470 addr
= (vm_offset_t
)((unsigned int)addr
+ ((InitialSaveBloks
+ BackPocketSaveBloks
) * PAGE_SIZE
)); /* Point past saveareas */
472 trcWork
.traceCurr
= (unsigned int)addr
; /* Set first trace slot to use */
473 trcWork
.traceStart
= (unsigned int)addr
; /* Set start of trace table */
474 trcWork
.traceEnd
= (unsigned int)addr
+ trcWork
.traceSize
; /* Set end of trace table */
476 addr
= (vm_offset_t
)trcWork
.traceEnd
; /* Set next allocatable location */
478 pmapTrans
= (pmapTransTab
*)addr
; /* Point to the pmap to hash translation table */
480 pmapTrans
[PPC_SID_KERNEL
].pmapPAddr
= (addr64_t
)((uintptr_t)kernel_pmap
); /* Initialize the kernel pmap in the translate table */
481 pmapTrans
[PPC_SID_KERNEL
].pmapVAddr
= CAST_DOWN(unsigned int, kernel_pmap
); /* Initialize the kernel pmap in the translate table */
483 addr
+= ((((1 << maxAdrSpb
) * sizeof(pmapTransTab
)) + 4095) & -4096); /* Point past pmap translate table */
485 /* NOTE: the phys_table must be within the first 2GB of physical RAM. This makes sure we only need to do 32-bit arithmetic */
487 phys_entry
= (struct phys_entry
*) addr
; /* Get pointer to physical table */
489 for (bank
= 0; bank
< pmap_mem_regions_count
; bank
++) { /* Set pointer and initialize all banks of ram */
491 pmap_mem_regions
[bank
].mrPhysTab
= phys_entry
; /* Set pointer to the physical table for this bank */
493 phys_entry
= phys_entry
+ (pmap_mem_regions
[bank
].mrEnd
- pmap_mem_regions
[bank
].mrStart
+ 1); /* Point to the next */
496 addr
+= (((num
* sizeof(struct phys_entry
)) + 4095) & -4096); /* Step on past the physical entries */
499 * Remaining space is for mapping entries. Tell the initializer routine that
500 * the mapping system can't release this block because it's permanently assigned
503 mapping_init(); /* Initialize the mapping tables */
505 for(i
= addr
; i
< first_used_addr
+ size
; i
+= PAGE_SIZE
) { /* Add initial mapping blocks */
506 mapping_free_init(i
, 1, 0); /* Pass block address and say that this one is not releasable */
508 mapCtl
.mapcmin
= MAPPERBLOK
; /* Make sure we only adjust one at a time */
510 /* Map V=R the page tables */
511 pmap_map(first_used_addr
, first_used_addr
,
512 round_page(first_used_addr
+ size
), VM_PROT_READ
| VM_PROT_WRITE
);
514 *first_avail
= round_page(first_used_addr
+ size
); /* Set next available page */
515 first_free_virt
= *first_avail
; /* Ditto */
517 /* For 64-bit machines, block map physical memory and the I/O hole into kernel space */
518 if(BootProcInfo
.pf
.Available
& pf64Bit
) { /* Are we on a 64-bit machine? */
519 lowGlo
.lgPMWvaddr
= PHYS_MEM_WINDOW_VADDR
; /* Initialize the physical memory window's virtual address */
521 pmap_map_physical(); /* Block map physical memory into the window */
523 pmap_map_iohole(IO_MEM_WINDOW_VADDR
, IO_MEM_WINDOW_SIZE
);
524 /* Block map the I/O hole */
527 /* All the rest of memory is free - add it to the free
528 * regions so that it can be allocated by pmap_steal
531 pmap_mem_regions
[0].mrAStart
= (*first_avail
>> 12); /* Set up the free area to start allocations (always in the first bank) */
533 current_free_region
= 0; /* Set that we will start allocating in bank 0 */
534 avail_remaining
= 0; /* Clear free page count */
535 for(bank
= 0; bank
< pmap_mem_regions_count
; bank
++) { /* Total up all of the pages in the system that are available */
536 avail_remaining
+= (pmap_mem_regions
[bank
].mrAEnd
- pmap_mem_regions
[bank
].mrAStart
) + 1; /* Add in allocatable pages in this bank */
543 * pmap_init(spa, epa)
544 * finishes the initialization of the pmap module.
545 * This procedure is called from vm_mem_init() in vm/vm_init.c
546 * to initialize any remaining data structures that the pmap module
547 * needs to map virtual memory (VM is already ON).
549 * Note that the pmap needs to be sized and aligned to
550 * a power of two. This is because it is used both in virtual and
551 * real so it can't span a page boundary.
558 pmap_zone
= zinit(pmapSize
, 400 * pmapSize
, 4096, "pmap");
560 zone_debug_disable(pmap_zone
); /* Can't debug this one 'cause it messes with size and alignment */
561 #endif /* ZONE_DEBUG */
563 pmap_initialized
= TRUE
;
566 * Initialize list of freed up pmaps
568 free_pmap_list
= 0; /* Set that there are no free pmaps */
570 simple_lock_init(&free_pmap_lock
, 0);
574 unsigned int pmap_free_pages(void)
576 return avail_remaining
;
580 * This function allocates physical pages.
583 /* Non-optimal, but only used for virtual memory startup.
584 * Allocate memory from a table of free physical addresses
585 * If there are no more free entries, too bad.
588 boolean_t
pmap_next_page(ppnum_t
*addrp
)
592 if(current_free_region
>= pmap_mem_regions_count
) return FALSE
; /* Return failure if we have used everything... */
594 for(i
= current_free_region
; i
< pmap_mem_regions_count
; i
++) { /* Find the next bank with free pages */
595 if(pmap_mem_regions
[i
].mrAStart
<= pmap_mem_regions
[i
].mrAEnd
) break; /* Found one */
598 current_free_region
= i
; /* Set our current bank */
599 if(i
>= pmap_mem_regions_count
) return FALSE
; /* Couldn't find a free page */
601 *addrp
= pmap_mem_regions
[i
].mrAStart
; /* Allocate the page */
602 pmap_mem_regions
[i
].mrAStart
= pmap_mem_regions
[i
].mrAStart
+ 1; /* Set the next one to go */
603 avail_remaining
--; /* Drop free count */
608 void pmap_virtual_space(
612 *startp
= round_page(first_free_virt
);
613 *endp
= vm_last_addr
;
619 * Create and return a physical map.
621 * If the size specified for the map is zero, the map is an actual physical
622 * map, and may be referenced by the hardware.
624 * A pmap is either in the free list or in the in-use list. The only use
625 * of the in-use list (aside from debugging) is to handle the VSID wrap situation.
626 * Whenever a new pmap is allocated (i.e., not recovered from the free list). The
627 * in-use list is matched until a hole in the VSID sequence is found. (Note
628 * that the in-use pmaps are queued in VSID sequence order.) This is all done
629 * while free_pmap_lock is held.
631 * If the size specified is non-zero, the map will be used in software
632 * only, and is bounded by that size.
635 pmap_create(vm_map_size_t size
)
637 pmap_t pmap
, ckpmap
, fore
;
639 unsigned int currSID
;
643 * A software use-only map doesn't even need a pmap structure.
649 * If there is a pmap in the pmap free list, reuse it.
650 * Note that we use free_pmap_list for all chaining of pmaps, both to
651 * the free list and the in use chain (anchored from kernel_pmap).
654 simple_lock(&free_pmap_lock
);
656 if(free_pmap_list
) { /* Any free? */
657 pmap
= free_pmap_list
; /* Yes, allocate it */
658 free_pmap_list
= (pmap_t
)pmap
->freepmap
; /* Dequeue this one (we chain free ones through freepmap) */
662 simple_unlock(&free_pmap_lock
); /* Unlock just in case */
665 pmap
= (pmap_t
) zalloc(pmap_zone
); /* Get one */
666 if (pmap
== PMAP_NULL
) return(PMAP_NULL
); /* Handle out-of-memory condition */
668 bzero((char *)pmap
, pmapSize
); /* Clean up the pmap */
671 simple_lock(&free_pmap_lock
); /* Lock it back up */
673 ckpmap
= cursor_pmap
; /* Get starting point for free ID search */
674 currSID
= ckpmap
->spaceNum
; /* Get the actual space ID number */
676 while(1) { /* Keep trying until something happens */
678 currSID
= (currSID
+ 1) & (maxAdrSp
- 1); /* Get the next in the sequence */
679 if(((currSID
* incrVSID
) & (maxAdrSp
- 1)) == invalSpace
) continue; /* Skip the space we have reserved */
680 ckpmap
= (pmap_t
)ckpmap
->pmap_link
.next
; /* On to the next in-use pmap */
682 if(ckpmap
->spaceNum
!= currSID
) break; /* If we are out of sequence, this is free */
684 if(ckpmap
== cursor_pmap
) { /* See if we have 2^20 already allocated */
685 panic("pmap_create: Maximum number (%d) active address spaces reached\n", maxAdrSp
); /* Die pig dog */
689 pmap
->space
= (currSID
* incrVSID
) & (maxAdrSp
- 1); /* Calculate the actual VSID */
690 pmap
->spaceNum
= currSID
; /* Set the space ID number */
692 * Now we link into the chain just before the out of sequence guy.
695 fore
= (pmap_t
)ckpmap
->pmap_link
.prev
; /* Get the current's previous */
696 pmap
->pmap_link
.next
= (queue_t
)ckpmap
; /* My next points to the current */
697 fore
->pmap_link
.next
= (queue_t
)pmap
; /* Current's previous's next points to me */
698 pmap
->pmap_link
.prev
= (queue_t
)fore
; /* My prev points to what the current pointed to */
699 ckpmap
->pmap_link
.prev
= (queue_t
)pmap
; /* Current's prev points to me */
701 physpmap
= ((addr64_t
)pmap_find_phys(kernel_pmap
, (addr64_t
)((uintptr_t)pmap
)) << 12) | (addr64_t
)((unsigned int)pmap
& 0xFFF); /* Get the physical address of the pmap */
703 pmap
->pmapvr
= (addr64_t
)((uintptr_t)pmap
) ^ physpmap
; /* Make V to R translation mask */
705 pmapTrans
[pmap
->space
].pmapPAddr
= physpmap
; /* Set translate table physical to point to us */
706 pmapTrans
[pmap
->space
].pmapVAddr
= CAST_DOWN(unsigned int, pmap
); /* Set translate table virtual to point to us */
709 pmap
->pmapVmmExt
= 0; /* Clear VMM extension block vaddr */
710 pmap
->pmapVmmExtPhys
= 0; /* and the paddr, too */
711 pmap
->pmapFlags
= pmapKeyDef
; /* Set default key */
712 pmap
->pmapCCtl
= pmapCCtlVal
; /* Initialize cache control */
714 pmap
->stats
.resident_count
= 0;
715 pmap
->stats
.wired_count
= 0;
716 pmap
->pmapSCSubTag
= 0x0000000000000000ULL
; /* Make sure this is clean an tidy */
717 simple_unlock(&free_pmap_lock
);
726 * Gives up a reference to the specified pmap. When the reference count
727 * reaches zero the pmap structure is added to the pmap free list.
729 * Should only be called if the map contains no valid mappings.
732 pmap_destroy(pmap_t pmap
)
738 if (pmap
== PMAP_NULL
)
741 ref_count
=hw_atomic_sub(&pmap
->ref_count
, 1); /* Back off the count */
742 if(ref_count
>0) return; /* Still more users, leave now... */
744 if(ref_count
< 0) /* Did we go too far? */
745 panic("pmap_destroy(): ref_count < 0");
747 if (!(pmap
->pmapFlags
& pmapVMgsaa
)) { /* Don't try this for a shadow assist guest */
748 pmap_unmap_sharedpage(pmap
); /* Remove any mapping of page -1 */
752 if(pmap
->stats
.resident_count
!= 0)
753 panic("PMAP_DESTROY: pmap not empty");
755 if(pmap
->stats
.resident_count
!= 0) {
756 pmap_remove(pmap
, 0, 0xFFFFFFFFFFFFF000ULL
);
761 * Add the pmap to the pmap free list.
766 * Add the pmap to the pmap free list.
768 simple_lock(&free_pmap_lock
);
770 if (free_pmap_count
<= free_pmap_max
) { /* Do we have enough spares? */
772 pmap
->freepmap
= free_pmap_list
; /* Queue in front */
773 free_pmap_list
= pmap
;
775 simple_unlock(&free_pmap_lock
);
778 if(cursor_pmap
== pmap
) cursor_pmap
= (pmap_t
)pmap
->pmap_link
.prev
; /* If we are releasing the cursor, back up */
779 fore
= (pmap_t
)pmap
->pmap_link
.prev
;
780 aft
= (pmap_t
)pmap
->pmap_link
.next
;
781 fore
->pmap_link
.next
= pmap
->pmap_link
.next
; /* My previous's next is my next */
782 aft
->pmap_link
.prev
= pmap
->pmap_link
.prev
; /* My next's previous is my previous */
783 simple_unlock(&free_pmap_lock
);
784 pmapTrans
[pmap
->space
].pmapPAddr
= -1; /* Invalidate the translate table physical */
785 pmapTrans
[pmap
->space
].pmapVAddr
= -1; /* Invalidate the translate table virtual */
786 zfree(pmap_zone
, pmap
);
792 * pmap_reference(pmap)
793 * gains a reference to the specified pmap.
796 pmap_reference(pmap_t pmap
)
798 if (pmap
!= PMAP_NULL
) hw_atomic_add(&pmap
->ref_count
, 1); /* Bump the count */
802 * pmap_remove_some_phys
804 * Removes mappings of the associated page from the specified pmap
807 void pmap_remove_some_phys(
811 register struct phys_entry
*pp
;
812 register struct mapping
*mp
;
815 if (pmap
== PMAP_NULL
) { /* This should never be called with a null pmap */
816 panic("pmap_remove_some_phys: null pmap\n");
819 pp
= mapping_phys_lookup(pa
, &pindex
); /* Get physical entry */
820 if (pp
== 0) return; /* Leave if not in physical RAM */
822 do { /* Keep going until we toss all pages from this pmap */
823 if (pmap
->pmapFlags
& pmapVMhost
) {
824 mp
= hw_purge_phys(pp
); /* Toss a map */
825 switch ((unsigned int)mp
& mapRetCode
) {
827 mapping_free(mp
); /* Return mapping to free inventory */
830 break; /* Don't try to return a guest mapping */
832 break; /* Physent chain empty, we're done */
834 break; /* Mapping disappeared on us, retry */
836 panic("pmap_remove_some_phys: hw_purge_phys failed - pp = %08X, pmap = %08X, code = %08X\n",
837 pp
, pmap
, mp
); /* Handle failure with our usual lack of tact */
840 mp
= hw_purge_space(pp
, pmap
); /* Toss a map */
841 switch ((unsigned int)mp
& mapRetCode
) {
843 mapping_free(mp
); /* Return mapping to free inventory */
846 break; /* Physent chain empty, we're done */
848 break; /* Mapping disappeared on us, retry */
850 panic("pmap_remove_some_phys: hw_purge_phys failed - pp = %08X, pmap = %08X, code = %08X\n",
851 pp
, pmap
, mp
); /* Handle failure with our usual lack of tact */
854 } while (mapRtEmpty
!= ((unsigned int)mp
& mapRetCode
));
857 if ((pmap
->pmapFlags
& pmapVMhost
) && !pmap_verify_free(pa
))
858 panic("pmap_remove_some_phys: cruft left behind - pa = %08X, pmap = %08X\n", pa
, pmap
);
861 return; /* Leave... */
865 * pmap_remove(pmap, s, e)
866 * unmaps all virtual addresses v in the virtual address
867 * range determined by [s, e) and pmap.
868 * s and e must be on machine independent page boundaries and
869 * s must be less than or equal to e.
871 * Note that pmap_remove does not remove any mappings in nested pmaps. We just
872 * skip those segments.
882 if (pmap
== PMAP_NULL
) return; /* Leave if software pmap */
885 /* It is just possible that eva might have wrapped around to zero,
886 * and sometimes we get asked to liberate something of size zero
887 * even though it's dumb (eg. after zero length read_overwrites)
891 /* If these are not page aligned the loop might not terminate */
892 assert((sva
== trunc_page_64(sva
)) && (eva
== trunc_page_64(eva
)));
894 va
= sva
& -4096LL; /* Round start down to a page */
895 endva
= eva
& -4096LL; /* Round end down to a page */
897 while(1) { /* Go until we finish the range */
898 va
= mapping_remove(pmap
, va
); /* Remove the mapping and see what's next */
899 va
= va
& -4096LL; /* Make sure the "not found" indication is clear */
900 if((va
== 0) || (va
>= endva
)) break; /* End loop if we finish range or run off the end */
910 * Lower the permission for all mappings to a given page.
917 register struct phys_entry
*pp
;
925 case VM_PROT_READ
|VM_PROT_EXECUTE
:
936 pp
= mapping_phys_lookup(pa
, &pindex
); /* Get physical entry */
937 if (pp
== 0) return; /* Leave if not in physical RAM */
939 if (remove
) { /* If the protection was set to none, we'll remove all mappings */
941 do { /* Keep going until we toss all pages from this physical page */
942 mp
= hw_purge_phys(pp
); /* Toss a map */
943 switch ((unsigned int)mp
& mapRetCode
) {
945 mapping_free(mp
); /* Return mapping to free inventory */
948 break; /* Don't try to return a guest mapping */
950 break; /* Mapping disappeared on us, retry */
952 break; /* Physent chain empty, we're done */
953 default: panic("pmap_page_protect: hw_purge_phys failed - pp = %08X, code = %08X\n",
954 pp
, mp
); /* Handle failure with our usual lack of tact */
956 } while (mapRtEmpty
!= ((unsigned int)mp
& mapRetCode
));
959 if (!pmap_verify_free(pa
))
960 panic("pmap_page_protect: cruft left behind - pa = %08X\n", pa
);
963 return; /* Leave... */
966 /* When we get here, it means that we are to change the protection for a
970 mapping_protect_phys(pa
, prot
& VM_PROT_ALL
); /* Change protection of all mappings to page. */
979 * Disconnect all mappings for this page and return reference and change status
983 unsigned int pmap_disconnect(
986 register struct phys_entry
*pp
;
990 pp
= mapping_phys_lookup(pa
, &pindex
); /* Get physical entry */
991 if (pp
== 0) return (0); /* Return null ref and chg if not in physical RAM */
992 do { /* Iterate until all mappings are dead and gone */
993 mp
= hw_purge_phys(pp
); /* Disconnect a mapping */
994 if (!mp
) break; /* All mappings are gone, leave the loop */
995 switch ((unsigned int)mp
& mapRetCode
) {
997 mapping_free(mp
); /* Return mapping to free inventory */
1000 break; /* Don't try to return a guest mapping */
1002 break; /* Mapping disappeared on us, retry */
1004 break; /* Physent chain empty, we're done */
1005 default: panic("hw_purge_phys: hw_purge_phys failed - pp = %08X, code = %08X\n",
1006 pp
, mp
); /* Handle failure with our usual lack of tact */
1008 } while (mapRtEmpty
!= ((unsigned int)mp
& mapRetCode
));
1011 if (!pmap_verify_free(pa
))
1012 panic("pmap_disconnect: cruft left behind - pa = %08X\n", pa
);
1015 return (mapping_tst_refmod(pa
)); /* Return page ref and chg in generic format */
1019 * pmap_protect(pmap, s, e, prot)
1020 * changes the protection on all virtual addresses v in the
1021 * virtual address range determined by [s, e] and pmap to prot.
1022 * s and e must be on machine independent page boundaries and
1023 * s must be less than or equal to e.
1025 * Note that any requests to change the protection of a nested pmap are
1026 * ignored. Those changes MUST be done by calling this with the correct pmap.
1030 vm_map_offset_t sva
,
1031 vm_map_offset_t eva
,
1037 if (pmap
== PMAP_NULL
) return; /* Do nothing if no pmap */
1039 if (prot
== VM_PROT_NONE
) { /* Should we kill the address range?? */
1040 pmap_remove(pmap
, (addr64_t
)sva
, (addr64_t
)eva
); /* Yeah, dump 'em */
1041 return; /* Leave... */
1044 va
= sva
& -4096LL; /* Round start down to a page */
1045 endva
= eva
& -4096LL; /* Round end down to a page */
1047 while(1) { /* Go until we finish the range */
1048 mapping_protect(pmap
, va
, prot
& VM_PROT_ALL
, &va
); /* Change the protection and see what's next */
1049 if((va
== 0) || (va
>= endva
)) break; /* End loop if we finish range or run off the end */
1059 * Create a translation for the virtual address (virt) to the physical
1060 * address (phys) in the pmap with the protection requested. If the
1061 * translation is wired then we can not allow a full page fault, i.e.,
1062 * the mapping control block is not eligible to be stolen in a low memory
1065 * NB: This is the only routine which MAY NOT lazy-evaluate
1066 * or lose information. That is, this routine must actually
1067 * insert this page into the given map NOW.
1070 pmap_enter(pmap_t pmap
, vm_map_offset_t va
, ppnum_t pa
, vm_prot_t prot
,
1071 unsigned int flags
, __unused boolean_t wired
)
1073 unsigned int mflags
;
1076 if (pmap
== PMAP_NULL
) return; /* Leave if software pmap */
1078 mflags
= 0; /* Make sure this is initialized to nothing special */
1079 if(!(flags
& VM_WIMG_USE_DEFAULT
)) { /* Are they supplying the attributes? */
1080 mflags
= mmFlgUseAttr
| (flags
& VM_MEM_GUARDED
) | ((flags
& VM_MEM_NOT_CACHEABLE
) >> 1); /* Convert to our mapping_make flags */
1084 * It is possible to hang here if another processor is remapping any pages we collide with and are removing
1087 while(1) { /* Keep trying the enter until it goes in */
1089 colva
= mapping_make(pmap
, va
, pa
, mflags
, 1, prot
& VM_PROT_ALL
); /* Enter the mapping into the pmap */
1091 if(!colva
) break; /* If there were no collisions, we are done... */
1093 mapping_remove(pmap
, colva
); /* Remove the mapping that collided */
1098 * Enters translations for odd-sized V=F blocks.
1100 * The higher level VM map should be locked to insure that we don't have a
1101 * double diddle here.
1103 * We panic if we get a block that overlaps with another. We do not merge adjacent
1104 * blocks because removing any address within a block removes the entire block and if
1105 * would really mess things up if we trashed too much.
1107 * Once a block is mapped, it is unmutable, that is, protection, catch mode, etc. can
1108 * not be changed. The block must be unmapped and then remapped with the new stuff.
1109 * We also do not keep track of reference or change flags.
1111 * Note that pmap_map_block_rc is the same but doesn't panic if collision.
1115 void pmap_map_block(pmap_t pmap
, addr64_t va
, ppnum_t pa
, vm_size_t size
, vm_prot_t prot
, int attr
, unsigned int flags
) { /* Map an autogenned block */
1117 unsigned int mflags
;
1121 if (pmap
== PMAP_NULL
) { /* Did they give us a pmap? */
1122 panic("pmap_map_block: null pmap\n"); /* No, like that's dumb... */
1125 // kprintf("pmap_map_block: (%08X) va = %016llX, pa = %08X, size = %08X, prot = %08X, attr = %08X, flags = %08X\n", /* (BRINGUP) */
1126 // current_thread(), va, pa, size, prot, attr, flags); /* (BRINGUP) */
1129 mflags
= mmFlgBlock
| mmFlgUseAttr
| (attr
& VM_MEM_GUARDED
) | ((attr
& VM_MEM_NOT_CACHEABLE
) >> 1); /* Convert to our mapping_make flags */
1130 if(flags
) mflags
|= mmFlgPerm
; /* Mark permanent if requested */
1132 colva
= mapping_make(pmap
, va
, pa
, mflags
, (size
>> 12), prot
); /* Enter the mapping into the pmap */
1134 if(colva
) { /* If there was a collision, panic */
1135 panic("pmap_map_block: collision at %016llX, pmap = %08X\n", colva
, pmap
);
1138 return; /* Return */
1141 int pmap_map_block_rc(pmap_t pmap
, addr64_t va
, ppnum_t pa
, vm_size_t size
, vm_prot_t prot
, int attr
, unsigned int flags
) { /* Map an autogenned block */
1143 unsigned int mflags
;
1147 if (pmap
== PMAP_NULL
) { /* Did they give us a pmap? */
1148 panic("pmap_map_block_rc: null pmap\n"); /* No, like that's dumb... */
1151 mflags
= mmFlgBlock
| mmFlgUseAttr
| (attr
& VM_MEM_GUARDED
) | ((attr
& VM_MEM_NOT_CACHEABLE
) >> 1); /* Convert to our mapping_make flags */
1152 if(flags
) mflags
|= mmFlgPerm
; /* Mark permanent if requested */
1154 colva
= mapping_make(pmap
, va
, pa
, mflags
, (size
>> 12), prot
); /* Enter the mapping into the pmap */
1156 if(colva
) return 0; /* If there was a collision, fail */
1158 return 1; /* Return true of we worked */
1162 * pmap_extract(pmap, va)
1163 * returns the physical address corrsponding to the
1164 * virtual address specified by pmap and va if the
1165 * virtual address is mapped and 0 if it is not.
1166 * Note: we assume nothing is ever mapped to phys 0.
1168 * NOTE: This call always will fail for physical addresses greater than 0xFFFFF000.
1170 vm_offset_t
pmap_extract(pmap_t pmap
, vm_map_offset_t va
) {
1173 register struct mapping
*mp
;
1174 register vm_offset_t pa
;
1180 panic("pmap_extract: THIS CALL IS BOGUS. NEVER USE IT EVER. So there...\n"); /* Don't use this */
1183 gva
= (unsigned int)va
; /* Make sure we don't have a sign */
1185 spl
= splhigh(); /* We can't allow any loss of control here */
1187 mp
= mapping_find(pmap
, (addr64_t
)gva
, &nextva
,1); /* Find the mapping for this address */
1189 if(!mp
) { /* Is the page mapped? */
1190 splx(spl
); /* Enable interrupts */
1191 return 0; /* Pass back 0 if not found */
1194 ppoffset
= (ppnum_t
)(((gva
& -4096LL) - (mp
->mpVAddr
& -4096LL)) >> 12); /* Get offset from va to base va */
1197 pa
= mp
->mpPAddr
+ ppoffset
; /* Remember ppage because mapping may vanish after drop call */
1199 mapping_drop_busy(mp
); /* We have everything we need from the mapping */
1200 splx(spl
); /* Restore 'rupts */
1202 if(pa
> maxPPage32
) return 0; /* Force large addresses to fail */
1204 pa
= (pa
<< 12) | (va
& 0xFFF); /* Convert physical page number to address */
1207 return pa
; /* Return physical address or 0 */
1211 * ppnum_t pmap_find_phys(pmap, addr64_t va)
1212 * returns the physical page corrsponding to the
1213 * virtual address specified by pmap and va if the
1214 * virtual address is mapped and 0 if it is not.
1215 * Note: we assume nothing is ever mapped to phys 0.
1218 ppnum_t
pmap_find_phys(pmap_t pmap
, addr64_t va
) {
1221 register struct mapping
*mp
;
1222 ppnum_t pa
, ppoffset
;
1225 spl
= splhigh(); /* We can't allow any loss of control here */
1227 mp
= mapping_find(pmap
, va
, &nextva
, 1); /* Find the mapping for this address */
1229 if(!mp
) { /* Is the page mapped? */
1230 splx(spl
); /* Enable interrupts */
1231 return 0; /* Pass back 0 if not found */
1235 ppoffset
= (ppnum_t
)(((va
& -4096LL) - (mp
->mpVAddr
& -4096LL)) >> 12); /* Get offset from va to base va */
1237 pa
= mp
->mpPAddr
+ ppoffset
; /* Get the actual physical address */
1239 mapping_drop_busy(mp
); /* We have everything we need from the mapping */
1241 splx(spl
); /* Restore 'rupts */
1242 return pa
; /* Return physical address or 0 */
1249 * Set/Get special memory attributes; not implemented.
1251 * Note: 'VAL_GET_INFO' is used to return info about a page.
1252 * If less than 1 page is specified, return the physical page
1253 * mapping and a count of the number of mappings to that page.
1254 * If more than one page is specified, return the number
1255 * of resident pages and the number of shared (more than
1256 * one mapping) pages in the range;
1262 __unused pmap_t pmap
,
1263 __unused vm_map_offset_t address
,
1264 __unused vm_map_size_t size
,
1265 __unused vm_machine_attribute_t attribute
,
1266 __unused vm_machine_attribute_val_t
* value
)
1269 return KERN_INVALID_ARGUMENT
;
1274 * pmap_attribute_cache_sync(vm_offset_t pa)
1276 * Invalidates all of the instruction cache on a physical page and
1277 * pushes any dirty data from the data cache for the same physical page
1280 kern_return_t
pmap_attribute_cache_sync(ppnum_t pp
, vm_size_t size
,
1281 __unused vm_machine_attribute_t attribute
,
1282 __unused vm_machine_attribute_val_t
* value
) {
1285 unsigned int i
, npages
;
1287 npages
= round_page(size
) >> 12; /* Get the number of pages to do */
1289 for(i
= 0; i
< npages
; i
++) { /* Do all requested pages */
1290 s
= splhigh(); /* No interruptions here */
1291 sync_ppage(pp
+ i
); /* Go flush data cache and invalidate icache */
1292 splx(s
); /* Allow interruptions */
1295 return KERN_SUCCESS
;
1299 * pmap_sync_page_data_phys(ppnum_t pa)
1301 * Invalidates all of the instruction cache on a physical page and
1302 * pushes any dirty data from the data cache for the same physical page
1305 void pmap_sync_page_data_phys(ppnum_t pa
) {
1309 s
= splhigh(); /* No interruptions here */
1310 sync_ppage(pa
); /* Sync up dem caches */
1311 splx(s
); /* Allow interruptions */
1316 pmap_sync_page_attributes_phys(ppnum_t pa
)
1318 pmap_sync_page_data_phys(pa
);
1324 * Garbage collects the physical map system for pages that are no longer used.
1325 * It isn't implemented or needed or wanted.
1328 pmap_collect(__unused pmap_t pmap
)
1334 * Routine: pmap_activate
1336 * Binds the given physical map to the given
1337 * processor, and returns a hardware map description.
1338 * It isn't implemented or needed or wanted.
1342 __unused pmap_t pmap
,
1343 __unused thread_t th
,
1344 __unused
int which_cpu
)
1350 * It isn't implemented or needed or wanted.
1354 __unused pmap_t pmap
,
1355 __unused thread_t th
,
1356 __unused
int which_cpu
)
1363 * pmap_pageable(pmap, s, e, pageable)
1364 * Make the specified pages (by pmap, offset)
1365 * pageable (or not) as requested.
1367 * A page which is not pageable may not take
1368 * a fault; therefore, its page table entry
1369 * must remain valid for the duration.
1371 * This routine is merely advisory; pmap_enter()
1372 * will specify that these pages are to be wired
1373 * down (or not) as appropriate.
1375 * (called from vm/vm_fault.c).
1379 __unused pmap_t pmap
,
1380 __unused vm_map_offset_t start
,
1381 __unused vm_map_offset_t end
,
1382 __unused boolean_t pageable
)
1385 return; /* This is not used... */
1389 * Routine: pmap_change_wiring
1394 __unused pmap_t pmap
,
1395 __unused vm_map_offset_t va
,
1396 __unused boolean_t wired
)
1398 return; /* This is not used... */
1402 * pmap_modify_pages(pmap, s, e)
1403 * sets the modified bit on all virtual addresses v in the
1404 * virtual address range determined by [s, e] and pmap,
1405 * s and e must be on machine independent page boundaries and
1406 * s must be less than or equal to e.
1408 * Note that this function will not descend nested pmaps.
1413 vm_map_offset_t sva
,
1414 vm_map_offset_t eva
)
1420 unsigned int savetype
;
1422 if (pmap
== PMAP_NULL
) return; /* If no pmap, can't do it... */
1424 va
= sva
& -4096; /* Round to page */
1425 endva
= eva
& -4096; /* Round to page */
1427 while (va
< endva
) { /* Walk through all pages */
1429 spl
= splhigh(); /* We can't allow any loss of control here */
1431 mp
= mapping_find(pmap
, (addr64_t
)va
, &va
, 0); /* Find the mapping for this address */
1433 if(!mp
) { /* Is the page mapped? */
1434 splx(spl
); /* Page not mapped, restore interruptions */
1435 if((va
== 0) || (va
>= endva
)) break; /* We are done if there are no more or we hit the end... */
1436 continue; /* We are not done and there is more to check... */
1439 savetype
= mp
->mpFlags
& mpType
; /* Remember the type */
1440 pa
= mp
->mpPAddr
; /* Remember ppage because mapping may vanish after drop call */
1442 mapping_drop_busy(mp
); /* We have everything we need from the mapping */
1444 splx(spl
); /* Restore 'rupts */
1446 if(savetype
!= mpNormal
) continue; /* Can't mess around with these guys... */
1448 mapping_set_mod(pa
); /* Set the modfied bit for this page */
1450 if(va
== 0) break; /* We hit the end of the pmap, might as well leave now... */
1452 return; /* Leave... */
1456 * pmap_clear_modify(phys)
1457 * clears the hardware modified ("dirty") bit for one
1458 * machine independant page starting at the given
1459 * physical address. phys must be aligned on a machine
1460 * independant page boundary.
1463 pmap_clear_modify(ppnum_t pa
)
1466 mapping_clr_mod(pa
); /* Clear all change bits for physical page */
1471 * pmap_is_modified(phys)
1472 * returns TRUE if the given physical page has been modified
1473 * since the last call to pmap_clear_modify().
1476 pmap_is_modified(register ppnum_t pa
)
1478 return mapping_tst_mod(pa
); /* Check for modified */
1483 * pmap_clear_reference(phys)
1484 * clears the hardware referenced bit in the given machine
1485 * independant physical page.
1489 pmap_clear_reference(ppnum_t pa
)
1491 mapping_clr_ref(pa
); /* Check for modified */
1495 * pmap_is_referenced(phys)
1496 * returns TRUE if the given physical page has been referenced
1497 * since the last call to pmap_clear_reference().
1500 pmap_is_referenced(ppnum_t pa
)
1502 return mapping_tst_ref(pa
); /* Check for referenced */
1506 * pmap_get_refmod(phys)
1507 * returns the referenced and modified bits of the specified
1511 pmap_get_refmod(ppnum_t pa
)
1513 return (mapping_tst_refmod(pa
));
1517 * pmap_clear_refmod(phys, mask)
1518 * clears the referenced and modified bits as specified by the mask
1519 * of the specified physical page.
1522 pmap_clear_refmod(ppnum_t pa
, unsigned int mask
)
1524 mapping_clr_refmod(pa
, mask
);
1528 * pmap_eligible_for_execute(ppnum_t pa)
1529 * return true if physical address is eligible to contain executable code;
1530 * otherwise, return false
1533 pmap_eligible_for_execute(ppnum_t pa
)
1535 phys_entry_t
*physent
;
1536 unsigned int pindex
;
1538 physent
= mapping_phys_lookup(pa
, &pindex
); /* Get physical entry */
1540 if((!physent
) || (physent
->ppLink
& ppG
))
1541 return 0; /* If there is no physical entry or marked guarded,
1542 the entry is not eligible for execute */
1544 return 1; /* Otherwise, entry is eligible for execute */
1549 pmap_list_resident_pages(
1550 __unused pmap_t pmap
,
1551 __unused vm_offset_t
*listp
,
1556 #endif /* MACH_VM_DEBUG */
1563 pmap_copy_part_page(
1565 vm_offset_t src_offset
,
1567 vm_offset_t dst_offset
,
1570 addr64_t fsrc
, fdst
;
1572 assert(((dst
<<12) & PAGE_MASK
+dst_offset
+len
) <= PAGE_SIZE
);
1573 assert(((src
<<12) & PAGE_MASK
+src_offset
+len
) <= PAGE_SIZE
);
1575 fsrc
= ((addr64_t
)src
<< 12) + src_offset
;
1576 fdst
= ((addr64_t
)dst
<< 12) + dst_offset
;
1578 phys_copy(fsrc
, fdst
, len
); /* Copy the stuff physically */
1582 pmap_zero_part_page(
1583 __unused vm_offset_t p
,
1584 __unused vm_offset_t offset
,
1585 __unused vm_size_t len
)
1587 panic("pmap_zero_part_page");
1590 boolean_t
pmap_verify_free(ppnum_t pa
) {
1592 struct phys_entry
*pp
;
1593 unsigned int pindex
;
1595 pp
= mapping_phys_lookup(pa
, &pindex
); /* Get physical entry */
1596 if (pp
== 0) return FALSE
; /* If there isn't one, show no mapping... */
1598 if(pp
->ppLink
& ~(ppLock
| ppFlags
)) return FALSE
; /* We have at least one mapping */
1599 return TRUE
; /* No mappings */
1603 /* Determine if we need to switch space and set up for it if so */
1605 void pmap_switch(pmap_t map
)
1607 hw_blow_seg(lowGlo
.lgUMWvaddr
); /* Blow off the first segment */
1608 hw_blow_seg(lowGlo
.lgUMWvaddr
+ 0x10000000ULL
); /* Blow off the second segment */
1610 /* when changing to kernel space, don't bother
1611 * doing anything, the kernel is mapped from here already.
1613 if (map
->space
== PPC_SID_KERNEL
) { /* Are we switching into kernel space? */
1614 return; /* If so, we don't do anything... */
1617 hw_set_user_space(map
); /* Indicate if we need to load the SRs or not */
1618 return; /* Bye, bye, butterfly... */
1622 * kern_return_t pmap_nest(grand, subord, vstart, size)
1624 * grand = the pmap that we will nest subord into
1625 * subord = the pmap that goes into the grand
1626 * vstart = start of range in pmap to be inserted
1627 * nstart = start of range in pmap nested pmap
1628 * size = Size of nest area (up to 16TB)
1630 * Inserts a pmap into another. This is used to implement shared segments.
1631 * On the current PPC processors, this is limited to segment (256MB) aligned
1632 * segment sized ranges.
1634 * We actually kinda allow recursive nests. The gating factor is that we do not allow
1635 * nesting on top of something that is already mapped, i.e., the range must be empty.
1639 * Note that we depend upon higher level VM locks to insure that things don't change while
1640 * we are doing this. For example, VM should not be doing any pmap enters while it is nesting
1641 * or do 2 nests at once.
1644 kern_return_t
pmap_nest(pmap_t grand
, pmap_t subord
, addr64_t vstart
, addr64_t nstart
, uint64_t size
) {
1646 addr64_t vend
, colladdr
;
1652 if(size
& 0x0FFFFFFFULL
) return KERN_INVALID_VALUE
; /* We can only do this for multiples of 256MB */
1653 if((size
>> 28) > 65536) return KERN_INVALID_VALUE
; /* Max size we can nest is 16TB */
1654 if(vstart
& 0x0FFFFFFFULL
) return KERN_INVALID_VALUE
; /* We can only do this aligned to 256MB */
1655 if(nstart
& 0x0FFFFFFFULL
) return KERN_INVALID_VALUE
; /* We can only do this aligned to 256MB */
1657 if(size
== 0) { /* Is the size valid? */
1658 panic("pmap_nest: size is invalid - %016llX\n", size
);
1661 msize
= (size
>> 28) - 1; /* Change size to blocks of 256MB */
1663 nlists
= mapSetLists(grand
); /* Set number of lists this will be on */
1665 mp
= mapping_alloc(nlists
); /* Get a spare mapping block */
1667 mp
->mpFlags
= 0x01000000 | mpNest
| mpPerm
| nlists
;
1668 /* Set the flags. Make sure busy count is 1 */
1669 mp
->mpSpace
= subord
->space
; /* Set the address space/pmap lookup ID */
1670 mp
->u
.mpBSize
= msize
; /* Set the size */
1671 mp
->mpPte
= 0; /* Set the PTE invalid */
1672 mp
->mpPAddr
= 0; /* Set the physical page number */
1673 mp
->mpVAddr
= vstart
; /* Set the address */
1674 mp
->mpNestReloc
= nstart
- vstart
; /* Set grand to nested vaddr relocation value */
1676 colladdr
= hw_add_map(grand
, mp
); /* Go add the mapping to the pmap */
1678 if(colladdr
) { /* Did it collide? */
1679 vend
= vstart
+ size
- 4096; /* Point to the last page we would cover in nest */
1680 panic("pmap_nest: attempt to nest into a non-empty range - pmap = %08X, start = %016llX, end = %016llX\n",
1681 grand
, vstart
, vend
);
1684 return KERN_SUCCESS
;
1688 * kern_return_t pmap_unnest(grand, vaddr)
1690 * grand = the pmap that we will nest subord into
1691 * vaddr = start of range in pmap to be unnested
1693 * Removes a pmap from another. This is used to implement shared segments.
1694 * On the current PPC processors, this is limited to segment (256MB) aligned
1695 * segment sized ranges.
1698 kern_return_t
pmap_unnest(pmap_t grand
, addr64_t vaddr
) {
1700 unsigned int tstamp
, i
, mycpu
;
1705 s
= splhigh(); /* Make sure interruptions are disabled */
1707 mp
= mapping_find(grand
, vaddr
, &nextva
, 0); /* Find the nested map */
1709 if(((unsigned int)mp
& mapRetCode
) != mapRtOK
) { /* See if it was even nested */
1710 panic("pmap_unnest: Attempt to unnest an unnested segment - va = %016llX\n", vaddr
);
1713 if((mp
->mpFlags
& mpType
) != mpNest
) { /* Did we find something other than a nest? */
1714 panic("pmap_unnest: Attempt to unnest something that is not a nest - va = %016llX\n", vaddr
);
1717 if(mp
->mpVAddr
!= vaddr
) { /* Make sure the address is the same */
1718 panic("pmap_unnest: Attempt to unnest something that is not at start of nest - va = %016llX\n", vaddr
);
1721 (void)hw_atomic_and(&mp
->mpFlags
, ~mpPerm
); /* Show that this mapping is now removable */
1723 mapping_drop_busy(mp
); /* Go ahead and release the mapping now */
1725 splx(s
); /* Restore 'rupts */
1727 (void)mapping_remove(grand
, vaddr
); /* Toss the nested pmap mapping */
1729 invalidateSegs(grand
); /* Invalidate the pmap segment cache */
1732 * Note that the following will force the segment registers to be reloaded
1733 * on all processors (if they are using the pmap we just changed) before returning.
1735 * This is needed. The reason is that until the segment register is
1736 * reloaded, another thread in the same task on a different processor will
1737 * be able to access memory that it isn't allowed to anymore. That can happen
1738 * because access to the subordinate pmap is being removed, but the pmap is still
1741 * Note that we only kick the other processor if we see that it was using the pmap while we
1746 for(i
=0; i
< real_ncpus
; i
++) { /* Cycle through processors */
1747 disable_preemption();
1748 mycpu
= cpu_number(); /* Who am I? Am I just a dream? */
1749 if((unsigned int)grand
== PerProcTable
[i
].ppe_vaddr
->ppUserPmapVirt
) { /* Is this guy using the changed pmap? */
1751 PerProcTable
[i
].ppe_vaddr
->ppInvSeg
= 1; /* Show that we need to invalidate the segments */
1755 tstamp
= PerProcTable
[i
].ppe_vaddr
->ruptStamp
[1]; /* Save the processor's last interrupt time stamp */
1756 if(cpu_signal(i
, SIGPcpureq
, CPRQsegload
, 0) == KERN_SUCCESS
) { /* Make sure we see the pmap change */
1757 if(!hw_cpu_wcng(&PerProcTable
[i
].ppe_vaddr
->ruptStamp
[1], tstamp
, LockTimeOut
)) { /* Wait for the other processors to enter debug */
1758 panic("pmap_unnest: Other processor (%d) did not see interruption request\n", i
);
1763 enable_preemption();
1766 return KERN_SUCCESS
; /* Bye, bye, butterfly... */
1771 * void MapUserMemoryWindowInit(void)
1773 * Initialize anything we need to in order to map user address space slices into
1774 * the kernel. Primarily used for copy in/out.
1776 * Currently we only support one 512MB slot for this purpose. There are two special
1777 * mappings defined for the purpose: the special pmap nest, and linkage mapping.
1779 * The special pmap nest (which is allocated in this function) is used as a place holder
1780 * in the kernel's pmap search list. It is 512MB long and covers the address range
1781 * starting at lgUMWvaddr. It points to no actual memory and when the fault handler
1782 * hits in it, it knows to look in the per_proc and start using the linkage
1783 * mapping contained therin.
1785 * The linkage mapping is used to glue the user address space slice into the
1786 * kernel. It contains the relocation information used to transform the faulting
1787 * kernel address into the user address space. It also provides the link to the
1788 * user's pmap. This is pointed to by the per_proc and is switched in and out
1789 * whenever there is a context switch.
1793 void MapUserMemoryWindowInit(void) {
1799 nlists
= mapSetLists(kernel_pmap
); /* Set number of lists this will be on */
1801 mp
= mapping_alloc(nlists
); /* Get a spare mapping block */
1803 mp
->mpFlags
= 0x01000000 | mpLinkage
| mpPerm
| nlists
;
1804 /* Set the flags. Make sure busy count is 1 */
1805 mp
->mpSpace
= kernel_pmap
->space
; /* Set the address space/pmap lookup ID */
1806 mp
->u
.mpBSize
= 1; /* Set the size to 2 segments */
1807 mp
->mpPte
= 0; /* Means nothing */
1808 mp
->mpPAddr
= 0; /* Means nothing */
1809 mp
->mpVAddr
= lowGlo
.lgUMWvaddr
; /* Set the address range we cover */
1810 mp
->mpNestReloc
= 0; /* Means nothing */
1812 colladdr
= hw_add_map(kernel_pmap
, mp
); /* Go add the mapping to the pmap */
1814 if(colladdr
) { /* Did it collide? */
1815 panic("MapUserMemoryWindowInit: MapUserMemoryWindow range already mapped\n");
1822 * addr64_t MapUserMemoryWindow(vm_map_t map, vm_offset_t va, size)
1824 * map = the vm_map that we are mapping into the kernel
1825 * va = start of the address range we are mapping
1826 * Note that we do not test validty, we chose to trust our fellows...
1828 * Maps a 512M slice of a user address space into a predefined kernel range
1829 * on a per-thread basis. We map only the first 256M segment, allowing the
1830 * second 256M segment to fault in as needed. This allows our clients to access
1831 * an arbitrarily aligned operand up to 256M in size.
1833 * In the future, the restriction of a predefined range may be loosened.
1835 * Builds the proper linkage map to map the user range
1836 * We will round this down to the previous segment boundary and calculate
1837 * the relocation to the kernel slot
1839 * We always make a segment table entry here if we need to. This is mainly because of
1840 * copyin/out and if we don't, there will be multiple segment faults for
1841 * each system call. I have seen upwards of 30000 per second.
1843 * We do check, however, to see if the slice is already mapped and if so,
1844 * we just exit. This is done for performance reasons. It was found that
1845 * there was a considerable boost in copyin/out performance if we did not
1846 * invalidate the segment at ReleaseUserAddressSpace time, so we dumped the
1847 * restriction that you had to bracket MapUserMemoryWindow. Further, there
1848 * is a yet further boost if you didn't need to map it each time. The theory
1849 * behind this is that many times copies are to or from the same segment and
1850 * done multiple times within the same system call. To take advantage of that,
1851 * we check umwSpace and umwRelo to see if we've already got it.
1853 * We also need to half-invalidate the slice when we context switch or go
1854 * back to user state. A half-invalidate does not clear the actual mapping,
1855 * but it does force the MapUserMemoryWindow function to reload the segment
1856 * register/SLBE. If this is not done, we can end up some pretty severe
1857 * performance penalties. If we map a slice, and the cached space/relocation is
1858 * the same, we won't reload the segment registers. Howver, since we ran someone else,
1859 * our SR is cleared and we will take a fault. This is reasonable if we block
1860 * while copying (e.g., we took a page fault), but it is not reasonable when we
1861 * just start. For this reason, we half-invalidate to make sure that the SR is
1862 * explicitly reloaded.
1864 * Note that we do not go to the trouble of making a pmap segment cache
1865 * entry for these guys because they are very short term -- 99.99% of the time
1866 * they will be unmapped before the next context switch.
1870 addr64_t
MapUserMemoryWindow(
1874 addr64_t baddrs
, reladd
;
1878 baddrs
= va
& 0xFFFFFFFFF0000000ULL
; /* Isolate the segment */
1879 thread
= current_thread(); /* Remember our activation */
1881 reladd
= baddrs
- lowGlo
.lgUMWvaddr
; /* Get the relocation from user to kernel */
1883 if((thread
->machine
.umwSpace
== map
->pmap
->space
) && (thread
->machine
.umwRelo
== reladd
)) { /* Already mapped? */
1884 return ((va
& 0x0FFFFFFFULL
) | lowGlo
.lgUMWvaddr
); /* Pass back the kernel address we are to use */
1887 disable_preemption(); /* Don't move... */
1889 mp
= (mapping_t
*)&(getPerProc()->ppUMWmp
); /* Make up for C */
1890 thread
->machine
.umwRelo
= reladd
; /* Relocation from user to kernel */
1891 mp
->mpNestReloc
= reladd
; /* Relocation from user to kernel */
1893 thread
->machine
.umwSpace
= map
->pmap
->space
; /* Set the address space/pmap lookup ID */
1894 mp
->mpSpace
= map
->pmap
->space
; /* Set the address space/pmap lookup ID */
1897 * Here we make an assumption that we are going to be using the base pmap's address space.
1898 * If we are wrong, and that would be very, very, very rare, the fault handler will fix us up.
1901 hw_map_seg(map
->pmap
, lowGlo
.lgUMWvaddr
, baddrs
); /* Make the entry for the first segment */
1903 enable_preemption(); /* Let's move */
1904 return ((va
& 0x0FFFFFFFULL
) | lowGlo
.lgUMWvaddr
); /* Pass back the kernel address we are to use */
1909 * kern_return_t pmap_boot_map(size)
1911 * size = size of virtual address range to be mapped
1913 * This function is used to assign a range of virtual addresses before VM in
1914 * initialized. It starts at VM_MAX_KERNEL_ADDRESS and works downward.
1915 * The variable vm_last_addr contains the current highest possible VM
1916 * assignable address. It is a panic to attempt to call this after VM has
1917 * started up. The only problem is, is that we may not have the serial or
1918 * framebuffer mapped, so we'll never know we died.........
1921 vm_offset_t
pmap_boot_map(vm_size_t size
) {
1923 if(kernel_map
!= VM_MAP_NULL
) { /* Has VM already started? */
1924 panic("pmap_boot_map: VM started\n");
1927 size
= round_page(size
); /* Make sure this is in pages */
1928 vm_last_addr
= vm_last_addr
- size
; /* Allocate the memory */
1929 return (vm_last_addr
+ 1); /* Return the vaddr we just allocated */
1935 * void pmap_init_sharedpage(void);
1937 * Hack map for the 64-bit commpage
1940 void pmap_init_sharedpage(vm_offset_t cpg
){
1942 addr64_t cva
, cpoff
;
1945 sharedPmap
= pmap_create(0); /* Get a pmap to hold the common segment */
1946 if(!sharedPmap
) { /* Check for errors */
1947 panic("pmap_init_sharedpage: couldn't make sharedPmap\n");
1950 for(cpoff
= 0; cpoff
< _COMM_PAGE_AREA_USED
; cpoff
+= 4096) { /* Step along now */
1952 cpphys
= pmap_find_phys(kernel_pmap
, (addr64_t
)cpg
+ cpoff
);
1954 panic("pmap_init_sharedpage: compage %08X not mapped in kernel\n", cpg
+ cpoff
);
1957 cva
= mapping_make(sharedPmap
, (addr64_t
)((uint32_t)_COMM_PAGE_BASE_ADDRESS
) + cpoff
,
1958 cpphys
, mmFlgPerm
, 1, VM_PROT_READ
); /* Map the page read only */
1959 if(cva
) { /* Check for errors */
1960 panic("pmap_init_sharedpage: couldn't map commpage page - cva = %016llX\n", cva
);
1970 * void pmap_map_sharedpage(pmap_t pmap);
1972 * Maps the last segment in a 64-bit address space
1977 void pmap_map_sharedpage(task_t task
, pmap_t pmap
){
1981 if(task_has_64BitAddr(task
) || _cpu_capabilities
& k64Bit
) { /* Should we map the 64-bit page -1? */
1982 ret
= pmap_nest(pmap
, sharedPmap
, 0xFFFFFFFFF0000000ULL
, 0x00000000F0000000ULL
,
1983 0x0000000010000000ULL
); /* Nest the highest possible segment to map comm page */
1984 if(ret
!= KERN_SUCCESS
) { /* Did it work? */
1985 panic("pmap_map_sharedpage: couldn't nest shared page - ret = %08X\n", ret
);
1994 * void pmap_unmap_sharedpage(pmap_t pmap);
1996 * Unmaps the last segment in a 64-bit address space
2000 void pmap_unmap_sharedpage(pmap_t pmap
){
2008 if(BootProcInfo
.pf
.Available
& pf64Bit
) { /* Are we on a 64-bit machine? */
2010 inter
= ml_set_interrupts_enabled(FALSE
); /* Disable interruptions for now */
2011 mp
= hw_find_map(pmap
, 0xFFFFFFFFF0000000ULL
, &nextva
); /* Find the mapping for this address */
2012 if((unsigned int)mp
== mapRtBadLk
) { /* Did we lock up ok? */
2013 panic("pmap_unmap_sharedpage: mapping lock failure - rc = %08X, pmap = %08X\n", mp
, pmap
); /* Die... */
2016 gotnest
= 0; /* Assume nothing here */
2018 gotnest
= ((mp
->mpFlags
& mpType
) == mpNest
);
2019 /* Remember if we have a nest here */
2020 mapping_drop_busy(mp
); /* We have everything we need from the mapping */
2022 ml_set_interrupts_enabled(inter
); /* Put interrupts back to what they were */
2024 if(!gotnest
) return; /* Leave if there isn't any nesting here */
2026 ret
= pmap_unnest(pmap
, 0xFFFFFFFFF0000000ULL
); /* Unnest the max 64-bit page */
2028 if(ret
!= KERN_SUCCESS
) { /* Did it work? */
2029 panic("pmap_unmap_sharedpage: couldn't unnest shared page - ret = %08X\n", ret
);
2037 /* temporary workaround */
2040 __unused vm_map_t map
,
2041 __unused vm_offset_t va
)
2047 ;;; Local Variables: ***