3 * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
5 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
7 * This file contains Original Code and/or Modifications of Original Code
8 * as defined in and that are subject to the Apple Public Source License
9 * Version 2.0 (the 'License'). You may not use this file except in
10 * compliance with the License. The rights granted to you under the License
11 * may not be used to create, or enable the creation or redistribution of,
12 * unlawful or unlicensed copies of an Apple operating system, or to
13 * circumvent, violate, or enable the circumvention or violation of, any
14 * terms of an Apple operating system software license agreement.
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this file.
19 * The Original Code and all software distributed under the License are
20 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
21 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
22 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
23 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
24 * Please see the License for the specific language governing rights and
25 * limitations under the License.
27 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
33 * Mach Operating System
34 * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
35 * All Rights Reserved.
37 * Permission to use, copy, modify and distribute this software and its
38 * documentation is hereby granted, provided that both the copyright
39 * notice and this permission notice appear in all copies of the
40 * software, derivative works or modified versions, and any portions
41 * thereof, and that both notices appear in supporting documentation.
43 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
44 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
45 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
47 * Carnegie Mellon requests users of this software to return to
49 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
50 * School of Computer Science
51 * Carnegie Mellon University
52 * Pittsburgh PA 15213-3890
54 * any improvements or extensions that they make and grant Carnegie Mellon
55 * the rights to redistribute these changes.
63 * Authors: Avadis Tevanian, Jr., Michael Wayne Young
66 * Machine-dependent structures for the physical map module.
69 #ifndef _PMAP_MACHINE_
70 #define _PMAP_MACHINE_ 1
74 #include <platforms.h>
76 #include <mach/kern_return.h>
77 #include <mach/machine/vm_types.h>
78 #include <mach/vm_prot.h>
79 #include <mach/vm_statistics.h>
80 #include <mach/machine/vm_param.h>
81 #include <kern/kern_types.h>
82 #include <kern/thread.h>
83 #include <kern/lock.h>
86 #include <i386/proc_reg.h>
89 * Define the generic in terms of the specific
92 #define INTEL_PGBYTES I386_PGBYTES
93 #define INTEL_PGSHIFT I386_PGSHIFT
94 #define intel_btop(x) i386_btop(x)
95 #define intel_ptob(x) i386_ptob(x)
96 #define intel_round_page(x) i386_round_page(x)
97 #define intel_trunc_page(x) i386_trunc_page(x)
98 #define trunc_intel_to_vm(x) trunc_i386_to_vm(x)
99 #define round_intel_to_vm(x) round_i386_to_vm(x)
100 #define vm_to_intel(x) vm_to_i386(x)
103 * i386/i486/i860 Page Table Entry
106 #endif /* ASSEMBLER */
110 #define PTEMASK 0x1ff
115 #define PDESIZE sizeof(pd_entry_t) /* for assembly files */
116 #define PTESIZE sizeof(pt_entry_t) /* for assembly files */
118 #define INTEL_OFFMASK (I386_PGBYTES - 1)
119 #define PG_FRAME 0x000FFFFFFFFFF000ULL
120 #define NPTEPG (PAGE_SIZE/(sizeof (pt_entry_t)))
121 #define NPTDPG (PAGE_SIZE/(sizeof (pd_entry_t)))
123 #define NBPTD (NPGPTD << PAGE_SHIFT)
124 #define NPDEPTD (NBPTD / (sizeof (pd_entry_t)))
125 #define NPDEPG (PAGE_SIZE/(sizeof (pd_entry_t)))
126 #define NBPDE (1 << PDESHIFT)
127 #define PDEMASK (NBPDE - 1)
129 /* cleanly define parameters for all the page table levels */
130 typedef uint64_t pml4_entry_t
;
131 #define NPML4PG (PAGE_SIZE/(sizeof (pml4_entry_t)))
133 #define PML4PGSHIFT 9
134 #define NBPML4 (1ULL << PML4SHIFT)
135 #define PML4MASK (NBPML4-1)
136 #define PML4_ENTRY_NULL ((pml4_entry_t *) 0)
138 typedef uint64_t pdpt_entry_t
;
139 #define NPDPTPG (PAGE_SIZE/(sizeof (pdpt_entry_t)))
141 #define PDPTPGSHIFT 9
142 #define NBPDPT (1 << PDPTSHIFT)
143 #define PDPTMASK (NBPDPT-1)
144 #define PDPT_ENTRY_NULL ((pdpt_entry_t *) 0)
146 typedef uint64_t pd_entry_t
;
147 #define NPDPG (PAGE_SIZE/(sizeof (pd_entry_t)))
150 #define NBPD (1 << PDSHIFT)
151 #define PDMASK (NBPD-1)
152 #define PD_ENTRY_NULL ((pd_entry_t *) 0)
154 typedef uint64_t pt_entry_t
;
155 #define NPTPG (PAGE_SIZE/(sizeof (pt_entry_t)))
158 #define NBPT (1 << PTSHIFT)
159 #define PTMASK (NBPT-1)
160 #define PT_ENTRY_NULL ((pt_entry_t *) 0)
162 typedef uint64_t pmap_paddr_t
;
165 * Atomic 64-bit store of a page table entry.
168 pmap_store_pte(pt_entry_t
*entryp
, pt_entry_t value
)
171 * Load the new value into %ecx:%ebx
172 * Load the old value into %edx:%eax
173 * Compare-exchange-8bytes at address entryp (loaded in %edi)
174 * If the compare succeeds, the new value will have been stored.
175 * Otherwise, the old value changed and reloaded, so try again.
178 " movl (%0), %%eax \n\t"
179 " movl 4(%0), %%edx \n\t"
181 " cmpxchg8b (%0) \n\t"
185 "b" ((uint32_t)value
),
186 "c" ((uint32_t)(value
>> 32))
187 : "eax", "edx", "memory");
190 /* in 64 bit spaces, the number of each type of page in the page tables */
191 #define NPML4PGS (1ULL * (PAGE_SIZE/(sizeof (pml4_entry_t))))
192 #define NPDPTPGS (NPML4PGS * (PAGE_SIZE/(sizeof (pdpt_entry_t))))
193 #define NPDEPGS (NPDPTPGS * (PAGE_SIZE/(sizeof (pd_entry_t))))
194 #define NPTEPGS (NPDEPGS * (PAGE_SIZE/(sizeof (pt_entry_t))))
197 * The 64-bit kernel is remapped in uber-space which is at the base
198 * the highest 4th-level directory (KERNEL_UBER_PML4_INDEX). That is,
199 * 512GB from the top of virtual space (or zero).
201 #define KERNEL_UBER_PML4_INDEX 511
202 #define KERNEL_UBER_BASE (0ULL - NBPML4)
203 #define KERNEL_UBER_BASE_HI32 ((uint32_t)(KERNEL_UBER_BASE >> 32))
205 #define VM_WIMG_COPYBACK VM_MEM_COHERENT
206 #define VM_WIMG_DEFAULT VM_MEM_COHERENT
208 #define VM_WIMG_IO (VM_MEM_COHERENT | \
209 VM_MEM_NOT_CACHEABLE | VM_MEM_GUARDED)
210 #define VM_WIMG_WTHRU (VM_MEM_WRITE_THROUGH | VM_MEM_COHERENT | VM_MEM_GUARDED)
211 /* write combining mode, aka store gather */
212 #define VM_WIMG_WCOMB (VM_MEM_NOT_CACHEABLE | VM_MEM_COHERENT)
217 #define VADDR(pdi, pti) ((vm_offset_t)(((pdi)<<PDESHIFT)|((pti)<<PTESHIFT)))
218 #define VADDR64(pmi, pdi, pti) ((vm_offset_t)(((pmi)<<PLM4SHIFT))((pdi)<<PDESHIFT)|((pti)<<PTESHIFT))
221 * Size of Kernel address space. This is the number of page table pages
222 * (4MB each) to use for the kernel. 256 pages == 1 Gigabyte.
223 * This **MUST** be a multiple of 4 (eg: 252, 256, 260, etc).
226 #define KVA_PAGES 1024
230 #define NKPT 500 /* actual number of kernel page tables */
233 #define NKPDE (KVA_PAGES - 1) /* addressable number of page tables/pde's */
237 enum high_cpu_types
{
242 HIGH_CPU_LDT_END
= HIGH_CPU_LDT_BEGIN
+ (LDTSZ
/ 512) - 1,
246 enum high_fixed_addresses
{
247 HIGH_FIXED_TRAMPS
, /* must be first */
248 HIGH_FIXED_TRAMPS_END
,
251 HIGH_FIXED_LDT_BEGIN
,
252 HIGH_FIXED_LDT_END
= HIGH_FIXED_LDT_BEGIN
+ (LDTSZ
/ 512) - 1,
256 HIGH_FIXED_CPUS_BEGIN
,
257 HIGH_FIXED_CPUS_END
= HIGH_FIXED_CPUS_BEGIN
+ (HIGH_CPU_END
* MAX_CPUS
) - 1,
261 /* XXX64 below PTDI values need cleanup */
263 * The *PTDI values control the layout of virtual memory
266 #define KPTDI (0x000)/* start of kernel virtual pde's */
267 #define PTDPTDI (0x7F4) /* ptd entry that points to ptd! */
268 #define APTDPTDI (0x7F8) /* alt ptd entry that points to APTD */
269 #define UMAXPTDI (0x7F8) /* ptd entry for user space end */
270 #define UMAXPTEOFF (NPTEPG) /* pte entry for user space end */
272 #define KERNBASE VADDR(KPTDI,0)
275 * Convert address offset to directory address
276 * containing the page table pointer - legacy
278 /*#define pmap_pde(m,v) (&((m)->dirbase[(vm_offset_t)(v) >> PDESHIFT]))*/
280 #define HIGH_MEM_BASE ((uint32_t)( -NBPDE) ) /* shared gdt etc seg addr */ /* XXX64 ?? */
281 #define pmap_index_to_virt(x) (HIGH_MEM_BASE | ((unsigned)(x) << PAGE_SHIFT))
284 * Convert address offset to page descriptor index
286 #define pdenum(pmap, a) (((vm_offset_t)(a) >> PDESHIFT) & PDEMASK)
288 #define pdeidx(pmap, a) (((a) >> PDSHIFT) & ((1ULL<<(48 - PDSHIFT)) -1))
289 #define pdptidx(pmap, a) (((a) >> PDPTSHIFT) & ((1ULL<<(48 - PDPTSHIFT)) -1))
290 #define pml4idx(pmap, a) (((a) >> PML4SHIFT) & ((1ULL<<(48 - PML4SHIFT)) -1))
293 * Convert page descriptor index to user virtual address
295 #define pdetova(a) ((vm_offset_t)(a) << PDESHIFT)
298 * Convert address offset to page table index
300 #define ptenum(a) (((vm_offset_t)(a) >> PTESHIFT) & PTEMASK)
303 * Hardware pte bit definitions (to be used directly on the ptes
304 * without using the bit fields).
307 #define INTEL_PTE_VALID 0x00000001
308 #define INTEL_PTE_WRITE 0x00000002
309 #define INTEL_PTE_RW 0x00000002
310 #define INTEL_PTE_USER 0x00000004
311 #define INTEL_PTE_WTHRU 0x00000008
312 #define INTEL_PTE_NCACHE 0x00000010
313 #define INTEL_PTE_REF 0x00000020
314 #define INTEL_PTE_MOD 0x00000040
315 #define INTEL_PTE_PS 0x00000080
316 #define INTEL_PTE_GLOBAL 0x00000100
317 #define INTEL_PTE_WIRED 0x00000200
318 #define INTEL_PTE_PFN PG_FRAME
319 #define INTEL_PTE_PTA 0x00000080
321 #define INTEL_PTE_NX (1ULL << 63)
323 #define INTEL_PTE_INVALID 0
325 #define pa_to_pte(a) ((a) & INTEL_PTE_PFN) /* XXX */
326 #define pte_to_pa(p) ((p) & INTEL_PTE_PFN) /* XXX */
327 #define pte_increment_pa(p) ((p) += INTEL_OFFMASK+1)
329 #define pte_kernel_rw(p) ((pt_entry_t)(pa_to_pte(p) | INTEL_PTE_VALID|INTEL_PTE_RW))
330 #define pte_kernel_ro(p) ((pt_entry_t)(pa_to_pte(p) | INTEL_PTE_VALID))
331 #define pte_user_rw(p) ((pt_entry)t)(pa_to_pte(p) | INTEL_PTE_VALID|INTEL_PTE_USER|INTEL_PTE_RW))
332 #define pte_user_ro(p) ((pt_entry_t)(pa_to_pte(p) | INTEL_PTE_VALID|INTEL_PTE_USER))
334 #define PMAP_DEFAULT_CACHE 0
335 #define PMAP_INHIBIT_CACHE 1
336 #define PMAP_GUARDED_CACHE 2
337 #define PMAP_ACTIVATE_CACHE 4
338 #define PMAP_NO_GUARD_CACHE 8
343 #include <sys/queue.h>
346 * Address of current and alternate address space page table maps
350 extern pt_entry_t PTmap
[], APTmap
[], Upte
;
351 extern pd_entry_t PTD
[], APTD
[], PTDpde
[], APTDpde
[], Upde
;
353 extern pd_entry_t
*IdlePTD
; /* physical address of "Idle" state directory */
354 extern pdpt_entry_t
*IdlePDPT
;
356 extern pmap_paddr_t lo_kernel_cr3
;
358 extern pml4_entry_t
*IdlePML4
;
359 extern pdpt_entry_t
*IdlePDPT64
;
360 extern addr64_t kernel64_cr3
;
361 extern boolean_t no_shared_cr3
;
364 * virtual address to page table entry and
365 * to physical address. Likewise for alternate address space.
366 * Note: these work recursively, thus vtopte of a pte will give
367 * the corresponding pde that in turn maps it.
369 #define vtopte(va) (PTmap + i386_btop((vm_offset_t)va))
372 typedef volatile long cpu_set
; /* set of CPUs - must be <= 32 */
373 /* changed by other processors */
376 TAILQ_HEAD(,pv_entry
) pv_list
;
379 #include <vm/vm_page.h>
382 * For each vm_page_t, there is a list of all currently
383 * valid virtual mappings of that page. An entry is
384 * a pv_entry_t; the list is the pv_table.
388 pd_entry_t
*dirbase
; /* page directory pointer */
389 pmap_paddr_t pdirbase
; /* phys. address of dirbase */
390 vm_object_t pm_obj
; /* object to hold pde's */
391 int ref_count
; /* reference count */
394 boolean_t pm_kernel_cr3
;
396 decl_simple_lock_data(,lock
) /* lock on map */
397 struct pmap_statistics stats
; /* map statistics */
398 vm_offset_t pm_hold
; /* true pdpt zalloc addr */
399 pmap_paddr_t pm_cr3
; /* physical addr */
400 pdpt_entry_t
*pm_pdpt
; /* KVA of 3rd level page */
401 pml4_entry_t
*pm_pml4
; /* VKA of top level */
402 vm_object_t pm_obj_pdpt
; /* holds pdpt pages */
403 vm_object_t pm_obj_pml4
; /* holds pml4 pages */
404 vm_object_t pm_obj_top
; /* holds single top level page */
408 #define PMAP_PDPT_FIRST_WINDOW 0
409 #define PMAP_PDPT_NWINDOWS 4
410 #define PMAP_PDE_FIRST_WINDOW (PMAP_PDPT_NWINDOWS)
411 #define PMAP_PDE_NWINDOWS 4
412 #define PMAP_PTE_FIRST_WINDOW (PMAP_PDE_FIRST_WINDOW + PMAP_PDE_NWINDOWS)
413 #define PMAP_PTE_NWINDOWS 4
415 #define PMAP_NWINDOWS_FIRSTFREE (PMAP_PTE_FIRST_WINDOW + PMAP_PTE_NWINDOWS)
416 #define PMAP_WINDOW_SIZE 8
417 #define PMAP_NWINDOWS (PMAP_NWINDOWS_FIRSTFREE + PMAP_WINDOW_SIZE)
420 pt_entry_t
*prv_CMAP
;
424 typedef struct cpu_pmap
{
425 int pdpt_window_index
;
426 int pde_window_index
;
427 int pte_window_index
;
428 mapwindow_t mapwindow
[PMAP_NWINDOWS
];
432 extern mapwindow_t
*pmap_get_mapwindow(pt_entry_t pentry
);
434 typedef struct pmap_memory_regions
{
439 } pmap_memory_region_t
;
441 unsigned pmap_memory_region_count
;
442 unsigned pmap_memory_region_current
;
444 #define PMAP_MEMORY_REGIONS_SIZE 128
446 extern pmap_memory_region_t pmap_memory_regions
[];
448 static inline void set_dirbase(pmap_t tpmap
, __unused
int tcpu
) {
449 current_cpu_datap()->cpu_task_cr3
= (pmap_paddr_t
)((tpmap
)->pm_cr3
);
450 current_cpu_datap()->cpu_task_map
= tpmap
->pm_64bit
? TASK_MAP_64BIT
: TASK_MAP_32BIT
;
454 * External declarations for PMAP_ACTIVATE.
457 extern void process_pmap_updates(void);
458 extern void pmap_update_interrupt(void);
461 * Machine dependent routines that are used only for i386/i486/i860.
464 extern addr64_t (kvtophys
)(
467 extern pt_entry_t
*pmap_pte(
469 vm_map_offset_t addr
);
471 extern pd_entry_t
*pmap_pde(
473 vm_map_offset_t addr
);
475 extern pd_entry_t
*pmap64_pde(
477 vm_map_offset_t addr
);
479 extern pdpt_entry_t
*pmap64_pdpt(
481 vm_map_offset_t addr
);
483 extern vm_offset_t
pmap_map(
485 vm_map_offset_t start
,
490 extern vm_offset_t
pmap_map_bd(
492 vm_map_offset_t start
,
497 extern void pmap_bootstrap(
498 vm_offset_t load_start
,
501 extern boolean_t
pmap_valid_page(
504 extern int pmap_list_resident_pages(
509 extern void pmap_commpage32_init(
513 extern void pmap_commpage64_init(
515 vm_map_offset_t user
,
518 extern struct cpu_pmap
*pmap_cpu_alloc(
519 boolean_t is_boot_cpu
);
520 extern void pmap_cpu_free(
521 struct cpu_pmap
*cp
);
523 extern void pmap_map_block(
532 extern void invalidate_icache(vm_offset_t addr
, unsigned cnt
, int phys
);
533 extern void flush_dcache(vm_offset_t addr
, unsigned count
, int phys
);
534 extern ppnum_t
pmap_find_phys(pmap_t map
, addr64_t va
);
535 extern void pmap_sync_page_data_phys(ppnum_t pa
);
536 extern void pmap_sync_page_attributes_phys(ppnum_t pa
);
538 extern kern_return_t
pmap_nest(pmap_t grand
, pmap_t subord
, addr64_t vstart
, addr64_t nstart
, uint64_t size
);
539 extern kern_return_t
pmap_unnest(pmap_t grand
, addr64_t vaddr
);
540 extern void pmap_map_sharedpage(task_t task
, pmap_t pmap
);
541 extern void pmap_unmap_sharedpage(pmap_t pmap
);
542 extern void pmap_disable_NX(pmap_t pmap
);
543 extern void pmap_set_4GB_pagezero(pmap_t pmap
);
544 extern void pmap_clear_4GB_pagezero(pmap_t pmap
);
545 extern void pmap_load_kernel_cr3(void);
546 extern vm_offset_t
pmap_cpu_high_map_vaddr(int, enum high_cpu_types
);
547 extern vm_offset_t
pmap_high_map_vaddr(enum high_cpu_types
);
548 extern vm_offset_t
pmap_high_map(pt_entry_t
, enum high_cpu_types
);
549 extern vm_offset_t
pmap_cpu_high_shared_remap(int, enum high_cpu_types
, vm_offset_t
, int);
550 extern vm_offset_t
pmap_high_shared_remap(enum high_fixed_addresses
, vm_offset_t
, int);
552 extern void pt_fake_zone_info(int *, vm_size_t
*, vm_size_t
*, vm_size_t
*, vm_size_t
*, int *, int *);
561 #include <kern/spl.h>
563 #if defined(PMAP_ACTIVATE_KERNEL)
564 #undef PMAP_ACTIVATE_KERNEL
565 #undef PMAP_DEACTIVATE_KERNEL
566 #undef PMAP_ACTIVATE_USER
567 #undef PMAP_DEACTIVATE_USER
571 #define PMAP_ACTIVATE_KERNEL(my_cpu) { \
575 if (current_cpu_datap()->cpu_tlb_invalid) \
576 process_pmap_updates(); \
580 #define PMAP_DEACTIVATE_KERNEL(my_cpu) { \
584 process_pmap_updates(); \
589 #define PMAP_ACTIVATE_MAP(map, my_cpu) { \
590 register pmap_t tpmap; \
592 tpmap = vm_map_pmap(map); \
593 set_dirbase(tpmap, my_cpu); \
596 #define PMAP_DEACTIVATE_MAP(map, my_cpu) \
597 if (current_cpu_datap()->cpu_task_map == TASK_MAP_64BIT_SHARED) \
598 pmap_load_kernel_cr3();
600 #define PMAP_ACTIVATE_USER(th, my_cpu) { \
604 PMAP_ACTIVATE_MAP(th->map, my_cpu) \
608 #define PMAP_DEACTIVATE_USER(th, my_cpu)
611 #define PMAP_SWITCH_CONTEXT(old_th, new_th, my_cpu) { \
620 if (old_th->map != new_th->map) { \
621 PMAP_DEACTIVATE_MAP(old_th->map, my_cpu); \
622 PMAP_ACTIVATE_MAP(new_th->map, my_cpu); \
624 kpdp = current_cpu_datap()->cpu_copywindow_pdp; \
625 for (i = 0; i < NCOPY_WINDOWS; i++) { \
626 if (new_th->machine.copy_window[i].user_base != (user_addr_t)-1) { \
627 updp = pmap_pde(new_th->map->pmap, \
628 new_th->machine.copy_window[i].user_base);\
629 pmap_store_pte(kpdp, updp ? *updp : 0); \
634 if (new_th->machine.copyio_state == WINDOWS_OPENED) \
637 new_th->machine.copyio_state = WINDOWS_DIRTY; \
638 if (new_th->machine.physwindow_pte) { \
639 pmap_store_pte((current_cpu_datap()->cpu_physwindow_ptep), \
640 new_th->machine.physwindow_pte); \
641 if (need_flush == 0) \
642 invlpg((uintptr_t)current_cpu_datap()->cpu_physwindow_base);\
648 #define PMAP_SWITCH_USER(th, new_map, my_cpu) { \
652 PMAP_DEACTIVATE_MAP(th->map, my_cpu); \
654 PMAP_ACTIVATE_MAP(th->map, my_cpu); \
656 inval_copy_windows(th); \
660 * Marking the current cpu's cr3 inactive is achieved by setting its lsb.
661 * Marking the current cpu's cr3 active once more involves clearng this bit.
662 * Note that valid page tables are page-aligned and so the bottom 12 bits
664 * We can only mark the current cpu active/inactive but we can test any cpu.
666 #define CPU_CR3_MARK_INACTIVE() \
667 current_cpu_datap()->cpu_active_cr3 |= 1
669 #define CPU_CR3_MARK_ACTIVE() \
670 current_cpu_datap()->cpu_active_cr3 &= ~1
672 #define CPU_CR3_IS_ACTIVE(cpu) \
673 ((cpu_datap(cpu)->cpu_active_cr3 & 1) == 0)
675 #define CPU_GET_ACTIVE_CR3(cpu) \
676 (cpu_datap(cpu)->cpu_active_cr3 & ~1)
678 #define MARK_CPU_IDLE(my_cpu) { \
680 * Mark this cpu idle, and remove it from the active set, \
681 * since it is not actively using any pmap. Signal_cpus \
682 * will notice that it is idle, and avoid signaling it, \
683 * but will queue the update request for when the cpu \
687 if (!cpu_mode_is64bit() || no_shared_cr3) \
688 process_pmap_updates(); \
690 pmap_load_kernel_cr3(); \
691 CPU_CR3_MARK_INACTIVE(); \
692 __asm__ volatile("mfence"); \
696 #define MARK_CPU_ACTIVE(my_cpu) { \
700 * If a kernel_pmap update was requested while this cpu \
701 * was idle, process it as if we got the interrupt. \
702 * Before doing so, remove this cpu from the idle set. \
703 * Since we do not grab any pmap locks while we flush \
704 * our TLB, another cpu may start an update operation \
705 * before we finish. Removing this cpu from the idle \
706 * set assures that we will receive another update \
707 * interrupt if this happens. \
709 CPU_CR3_MARK_ACTIVE(); \
710 __asm__ volatile("mfence"); \
712 if (current_cpu_datap()->cpu_tlb_invalid) \
713 process_pmap_updates(); \
717 #define PMAP_CONTEXT(pmap, thread)
719 #define pmap_kernel_va(VA) \
720 ((((vm_offset_t) (VA)) >= vm_min_kernel_address) && \
721 (((vm_offset_t) (VA)) <= vm_max_kernel_address))
724 #define pmap_resident_count(pmap) ((pmap)->stats.resident_count)
725 #define pmap_copy(dst_pmap,src_pmap,dst_addr,len,src_addr)
726 #define pmap_attribute(pmap,addr,size,attr,value) \
727 (KERN_INVALID_ADDRESS)
728 #define pmap_attribute_cache_sync(addr,size,attr,value) \
729 (KERN_INVALID_ADDRESS)
731 #endif /* ASSEMBLER */
734 #endif /* _PMAP_MACHINE_ */
737 #endif /* KERNEL_PRIVATE */