1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 /* 28 * UNIX machine dependent virtual memory support. 29 */ 30 31 #ifndef _VM_DEP_H 32 #define _VM_DEP_H 33 34 #pragma ident "%Z%%M% %I% %E% SMI" 35 36 #ifdef __cplusplus 37 extern "C" { 38 #endif 39 40 #include <vm/hat_sfmmu.h> 41 #include <sys/archsystm.h> 42 #include <sys/memnode.h> 43 44 #define GETTICK() gettick() 45 46 /* 47 * Per page size free lists. Allocated dynamically. 48 */ 49 #define MAX_MEM_TYPES 2 /* 0 = reloc, 1 = noreloc */ 50 #define MTYPE_RELOC 0 51 #define MTYPE_NORELOC 1 52 53 #define PP_2_MTYPE(pp) (PP_ISNORELOC(pp) ? MTYPE_NORELOC : MTYPE_RELOC) 54 55 #define MTYPE_INIT(mtype, vp, vaddr, flags) \ 56 mtype = (flags & PG_NORELOC) ? MTYPE_NORELOC : MTYPE_RELOC; 57 58 /* mtype init for page_get_replacement_page */ 59 60 #define MTYPE_PGR_INIT(mtype, flags, pp, mnode) \ 61 mtype = (flags & PG_NORELOC) ? MTYPE_NORELOC : MTYPE_RELOC; 62 63 #define MNODETYPE_2_PFN(mnode, mtype, pfnlo, pfnhi) \ 64 ASSERT(mtype != MTYPE_NORELOC); \ 65 pfnlo = mem_node_config[mnode].physbase; \ 66 pfnhi = mem_node_config[mnode].physmax; 67 68 /* 69 * Internal PG_ flags. 70 */ 71 #define PGI_RELOCONLY 0x10000 /* acts in the opposite sense to PG_NORELOC */ 72 #define PGI_NOCAGE 0x20000 /* indicates Cage is disabled */ 73 #define PGI_PGCPHIPRI 0x40000 /* page_get_contig_page priority allocation */ 74 #define PGI_PGCPSZC0 0x80000 /* relocate base pagesize page */ 75 76 /* 77 * PGI mtype flags - should not overlap PGI flags 78 */ 79 #define PGI_MT_RANGE 0x1000000 /* mtype range */ 80 #define PGI_MT_NEXT 0x2000000 /* get next mtype */ 81 82 extern page_t ***page_freelists[MMU_PAGE_SIZES][MAX_MEM_TYPES]; 83 extern page_t ***page_cachelists[MAX_MEM_TYPES]; 84 85 #define PAGE_FREELISTS(mnode, szc, color, mtype) \ 86 (*(page_freelists[szc][mtype][mnode] + (color))) 87 88 #define PAGE_CACHELISTS(mnode, color, mtype) \ 89 (*(page_cachelists[mtype][mnode] + (color))) 90 91 /* 92 * There are 'page_colors' colors/bins. Spread them out under a 93 * couple of locks. There are mutexes for both the page freelist 94 * and the page cachelist. We want enough locks to make contention 95 * reasonable, but not too many -- otherwise page_freelist_lock() gets 96 * so expensive that it becomes the bottleneck! 97 */ 98 #define NPC_MUTEX 16 99 100 extern kmutex_t *fpc_mutex[NPC_MUTEX]; 101 extern kmutex_t *cpc_mutex[NPC_MUTEX]; 102 103 /* Find the bin for the given page if it was of size szc */ 104 #define PP_2_BIN_SZC(pp, szc) \ 105 (((pp->p_pagenum) & page_colors_mask) >> \ 106 (hw_page_array[szc].hp_shift - hw_page_array[0].hp_shift)) 107 108 #define PP_2_BIN(pp) (PP_2_BIN_SZC(pp, pp->p_szc)) 109 110 #define PP_2_MEM_NODE(pp) (PFN_2_MEM_NODE(pp->p_pagenum)) 111 112 #define PC_BIN_MUTEX(mnode, bin, flags) ((flags & PG_FREE_LIST) ? \ 113 &fpc_mutex[(bin) & (NPC_MUTEX - 1)][mnode] : \ 114 &cpc_mutex[(bin) & (NPC_MUTEX - 1)][mnode]) 115 116 #define FPC_MUTEX(mnode, i) (&fpc_mutex[i][mnode]) 117 #define CPC_MUTEX(mnode, i) (&cpc_mutex[i][mnode]) 118 119 #define PFN_BASE(pfnum, szc) (pfnum & ~((1 << PAGE_BSZS_SHIFT(szc)) - 1)) 120 121 typedef char hpmctr_t; 122 123 #ifdef DEBUG 124 #define CHK_LPG(pp, szc) chk_lpg(pp, szc) 125 extern void chk_lpg(page_t *, uchar_t); 126 #else 127 #define CHK_LPG(pp, szc) 128 #endif 129 130 /* 131 * page list count per mnode and type. 132 */ 133 typedef struct { 134 pgcnt_t plc_mt_pgmax; /* max page cnt */ 135 pgcnt_t plc_mt_clpgcnt; /* cache list cnt */ 136 pgcnt_t plc_mt_flpgcnt; /* free list cnt - small pages */ 137 pgcnt_t plc_mt_lgpgcnt; /* free list cnt - large pages */ 138 #ifdef DEBUG 139 struct { 140 pgcnt_t plc_mts_pgcnt; /* per page size count */ 141 int plc_mts_colors; 142 pgcnt_t *plc_mtsc_pgcnt; /* per color bin count */ 143 } plc_mts[MMU_PAGE_SIZES]; 144 #endif 145 } plcnt_t[MAX_MEM_NODES][MAX_MEM_TYPES]; 146 147 #ifdef DEBUG 148 149 #define PLCNT_SZ(ctrs_sz) { \ 150 int szc; \ 151 for (szc = 0; szc <= mmu_page_sizes; szc++) { \ 152 int colors = page_get_pagecolors(szc); \ 153 ctrs_sz += (max_mem_nodes * MAX_MEM_TYPES * \ 154 colors * sizeof (pgcnt_t)); \ 155 } \ 156 } 157 158 #define PLCNT_INIT(base) { \ 159 int mn, mt, szc, colors; \ 160 for (szc = 0; szc < mmu_page_sizes; szc++) { \ 161 colors = page_get_pagecolors(szc); \ 162 for (mn = 0; mn < max_mem_nodes; mn++) { \ 163 for (mt = 0; mt < MAX_MEM_TYPES; mt++) { \ 164 plcnt[mn][mt].plc_mts[szc]. \ 165 plc_mts_colors = colors; \ 166 plcnt[mn][mt].plc_mts[szc]. \ 167 plc_mtsc_pgcnt = (pgcnt_t *)base; \ 168 base += (colors * sizeof (pgcnt_t)); \ 169 } \ 170 } \ 171 } \ 172 } 173 174 #define PLCNT_DO(pp, mn, mtype, szc, cnt, flags) { \ 175 int bin = PP_2_BIN(pp); \ 176 if (flags & (PG_LIST_ISINIT | PG_LIST_ISCAGE)) \ 177 atomic_add_long(&plcnt[mn][mtype].plc_mt_pgmax, \ 178 cnt); \ 179 if (flags & PG_CACHE_LIST) \ 180 atomic_add_long(&plcnt[mn][mtype].plc_mt_clpgcnt, cnt); \ 181 else if (szc) \ 182 atomic_add_long(&plcnt[mn][mtype].plc_mt_lgpgcnt, cnt); \ 183 else \ 184 atomic_add_long(&plcnt[mn][mtype].plc_mt_flpgcnt, cnt); \ 185 atomic_add_long(&plcnt[mn][mtype].plc_mts[szc].plc_mts_pgcnt, \ 186 cnt); \ 187 atomic_add_long(&plcnt[mn][mtype].plc_mts[szc]. \ 188 plc_mtsc_pgcnt[bin], cnt); \ 189 } 190 191 #else 192 193 #define PLCNT_SZ(ctrs_sz) 194 195 #define PLCNT_INIT(base) 196 197 /* PG_FREE_LIST may not be explicitly set in flags for large pages */ 198 199 #define PLCNT_DO(pp, mn, mtype, szc, cnt, flags) { \ 200 if (flags & (PG_LIST_ISINIT | PG_LIST_ISCAGE)) \ 201 atomic_add_long(&plcnt[mn][mtype].plc_mt_pgmax, cnt); \ 202 if (flags & PG_CACHE_LIST) \ 203 atomic_add_long(&plcnt[mn][mtype].plc_mt_clpgcnt, cnt); \ 204 else if (szc) \ 205 atomic_add_long(&plcnt[mn][mtype].plc_mt_lgpgcnt, cnt); \ 206 else \ 207 atomic_add_long(&plcnt[mn][mtype].plc_mt_flpgcnt, cnt); \ 208 } 209 210 #endif 211 212 #define PLCNT_INCR(pp, mn, mtype, szc, flags) { \ 213 long cnt = (1 << PAGE_BSZS_SHIFT(szc)); \ 214 PLCNT_DO(pp, mn, mtype, szc, cnt, flags); \ 215 } 216 217 #define PLCNT_DECR(pp, mn, mtype, szc, flags) { \ 218 long cnt = ((-1) << PAGE_BSZS_SHIFT(szc)); \ 219 PLCNT_DO(pp, mn, mtype, szc, cnt, flags); \ 220 } 221 222 /* 223 * macros to update page list max counts - done when pages transferred 224 * between mtypes (as in kcage_assimilate_page). 225 */ 226 #define PLCNT_MAX_INCR(pp, mn, mtype, szc) { \ 227 long cnt = (1 << PAGE_BSZS_SHIFT(szc)); \ 228 atomic_add_long(&plcnt[mn][mtype].plc_mt_pgmax, cnt); \ 229 } 230 231 #define PLCNT_MAX_DECR(pp, mn, mtype, szc) { \ 232 long cnt = ((-1) << PAGE_BSZS_SHIFT(szc)); \ 233 atomic_add_long(&plcnt[mn][mtype].plc_mt_pgmax, cnt); \ 234 } 235 236 extern plcnt_t plcnt; 237 238 #define MNODE_PGCNT(mn) \ 239 (plcnt[mn][MTYPE_RELOC].plc_mt_clpgcnt + \ 240 plcnt[mn][MTYPE_NORELOC].plc_mt_clpgcnt + \ 241 plcnt[mn][MTYPE_RELOC].plc_mt_flpgcnt + \ 242 plcnt[mn][MTYPE_NORELOC].plc_mt_flpgcnt + \ 243 plcnt[mn][MTYPE_RELOC].plc_mt_lgpgcnt + \ 244 plcnt[mn][MTYPE_NORELOC].plc_mt_lgpgcnt) 245 246 #define MNODETYPE_PGCNT(mn, mtype) \ 247 (plcnt[mn][mtype].plc_mt_clpgcnt + \ 248 plcnt[mn][mtype].plc_mt_flpgcnt + \ 249 plcnt[mn][mtype].plc_mt_lgpgcnt) 250 251 /* 252 * macros to loop through the mtype range - MTYPE_START returns -1 in 253 * mtype if no pages in mnode/mtype and possibly NEXT mtype. 254 */ 255 #define MTYPE_START(mnode, mtype, flags) { \ 256 if (plcnt[mnode][mtype].plc_mt_pgmax == 0) { \ 257 ASSERT(MNODETYPE_PGCNT(mnode, mtype) == 0); \ 258 MTYPE_NEXT(mnode, mtype, flags); \ 259 } \ 260 } 261 262 /* 263 * if allocation from the RELOC pool failed and there is sufficient cage 264 * memory, attempt to allocate from the NORELOC pool. 265 */ 266 #define MTYPE_NEXT(mnode, mtype, flags) { \ 267 if (!(flags & (PG_NORELOC | PGI_NOCAGE | PGI_RELOCONLY)) && \ 268 (kcage_freemem >= kcage_lotsfree)) { \ 269 if (plcnt[mnode][mtype].plc_mt_pgmax == 0) { \ 270 ASSERT(MNODETYPE_PGCNT(mnode, mtype) == 0); \ 271 mtype = -1; \ 272 } else { \ 273 mtype = MTYPE_NORELOC; \ 274 flags |= PG_NORELOC; \ 275 } \ 276 } else { \ 277 mtype = -1; \ 278 } \ 279 } 280 281 /* 282 * get the ecache setsize for the current cpu. 283 */ 284 #define CPUSETSIZE() (cpunodes[CPU->cpu_id].ecache_setsize) 285 286 extern struct cpu cpu0; 287 #define CPU0 &cpu0 288 289 #define PAGE_BSZS_SHIFT(szc) TTE_BSZS_SHIFT(szc) 290 /* 291 * For sfmmu each larger page is 8 times the size of the previous 292 * size page. 293 */ 294 #define FULL_REGION_CNT(rg_szc) (8) 295 296 /* 297 * The counter base must be per page_counter element to prevent 298 * races when re-indexing, and the base page size element should 299 * be aligned on a boundary of the given region size. 300 * 301 * We also round up the number of pages spanned by the counters 302 * for a given region to PC_BASE_ALIGN in certain situations to simplify 303 * the coding for some non-performance critical routines. 304 */ 305 #define PC_BASE_ALIGN ((pfn_t)1 << PAGE_BSZS_SHIFT(mmu_page_sizes-1)) 306 #define PC_BASE_ALIGN_MASK (PC_BASE_ALIGN - 1) 307 308 extern int ecache_alignsize; 309 #define L2CACHE_ALIGN ecache_alignsize 310 #define L2CACHE_ALIGN_MAX 64 311 312 extern int consistent_coloring; 313 extern uint_t vac_colors_mask; 314 extern int vac_size; 315 extern int vac_shift; 316 317 /* 318 * Auto large page selection support variables. Some CPU 319 * implementations may differ from the defaults and will need 320 * to change these. 321 */ 322 extern int auto_lpg_tlb_threshold; 323 extern int auto_lpg_minszc; 324 extern int auto_lpg_maxszc; 325 extern size_t auto_lpg_heap_default; 326 extern size_t auto_lpg_stack_default; 327 extern size_t auto_lpg_va_default; 328 extern size_t auto_lpg_remap_threshold; 329 extern pgcnt_t auto_lpg_min_physmem; 330 331 /* 332 * AS_2_BIN macro controls the page coloring policy. 333 * 0 (default) uses various vaddr bits 334 * 1 virtual=paddr 335 * 2 bin hopping 336 */ 337 #define AS_2_BIN(as, seg, vp, addr, bin) \ 338 switch (consistent_coloring) { \ 339 default: \ 340 cmn_err(CE_WARN, \ 341 "AS_2_BIN: bad consistent coloring value"); \ 342 /* assume default algorithm -> continue */ \ 343 case 0: { \ 344 uint32_t ndx, new; \ 345 int slew = 0; \ 346 \ 347 if (vp != NULL && IS_SWAPVP(vp) && \ 348 seg->s_ops == &segvn_ops) \ 349 slew = as_color_bin(as); \ 350 \ 351 bin = (((uintptr_t)addr >> MMU_PAGESHIFT) + \ 352 (((uintptr_t)addr >> page_coloring_shift) << \ 353 (vac_shift - MMU_PAGESHIFT)) + slew) & \ 354 page_colors_mask; \ 355 \ 356 break; \ 357 } \ 358 case 1: \ 359 bin = ((uintptr_t)addr >> MMU_PAGESHIFT) & \ 360 page_colors_mask; \ 361 break; \ 362 case 2: { \ 363 int cnt = as_color_bin(as); \ 364 /* make sure physical color aligns with vac color */ \ 365 while ((cnt & vac_colors_mask) != \ 366 addr_to_vcolor(addr)) { \ 367 cnt++; \ 368 } \ 369 bin = cnt = cnt & page_colors_mask; \ 370 /* update per as page coloring fields */ \ 371 cnt = (cnt + 1) & page_colors_mask; \ 372 if (cnt == (as_color_start(as) & page_colors_mask)) { \ 373 cnt = as_color_start(as) = as_color_start(as) + \ 374 PGCLR_LOOPFACTOR; \ 375 } \ 376 as_color_bin(as) = cnt & page_colors_mask; \ 377 break; \ 378 } \ 379 } \ 380 ASSERT(bin <= page_colors_mask); 381 382 /* 383 * cpu private vm data - accessed thru CPU->cpu_vm_data 384 * vc_pnum_memseg: tracks last memseg visited in page_numtopp_nolock() 385 * vc_pnext_memseg: tracks last memseg visited in page_nextn() 386 * vc_kmptr: unaligned kmem pointer for this vm_cpu_data_t 387 */ 388 389 typedef struct { 390 struct memseg *vc_pnum_memseg; 391 struct memseg *vc_pnext_memseg; 392 void *vc_kmptr; 393 } vm_cpu_data_t; 394 395 /* allocation size to ensure vm_cpu_data_t resides in its own cache line */ 396 #define VM_CPU_DATA_PADSIZE \ 397 (P2ROUNDUP(sizeof (vm_cpu_data_t), L2CACHE_ALIGN_MAX)) 398 399 /* for boot cpu before kmem is initialized */ 400 extern char vm_cpu_data0[]; 401 402 /* 403 * Function to get an ecache color bin: F(as, cnt, vcolor). 404 * the goal of this function is to: 405 * - to spread a processes' physical pages across the entire ecache to 406 * maximize its use. 407 * - to minimize vac flushes caused when we reuse a physical page on a 408 * different vac color than it was previously used. 409 * - to prevent all processes to use the same exact colors and trash each 410 * other. 411 * 412 * cnt is a bin ptr kept on a per as basis. As we page_create we increment 413 * the ptr so we spread out the physical pages to cover the entire ecache. 414 * The virtual color is made a subset of the physical color in order to 415 * in minimize virtual cache flushing. 416 * We add in the as to spread out different as. This happens when we 417 * initialize the start count value. 418 * sizeof(struct as) is 60 so we shift by 3 to get into the bit range 419 * that will tend to change. For example, on spitfire based machines 420 * (vcshft == 1) contigous as are spread bu ~6 bins. 421 * vcshft provides for proper virtual color alignment. 422 * In theory cnt should be updated using cas only but if we are off by one 423 * or 2 it is no big deal. 424 * We also keep a start value which is used to randomize on what bin we 425 * start counting when it is time to start another loop. This avoids 426 * contigous allocations of ecache size to point to the same bin. 427 * Why 3? Seems work ok. Better than 7 or anything larger. 428 */ 429 #define PGCLR_LOOPFACTOR 3 430 431 /* 432 * When a bin is empty, and we can't satisfy a color request correctly, 433 * we scan. If we assume that the programs have reasonable spatial 434 * behavior, then it will not be a good idea to use the adjacent color. 435 * Using the adjacent color would result in virtually adjacent addresses 436 * mapping into the same spot in the cache. So, if we stumble across 437 * an empty bin, skip a bunch before looking. After the first skip, 438 * then just look one bin at a time so we don't miss our cache on 439 * every look. Be sure to check every bin. Page_create() will panic 440 * if we miss a page. 441 * 442 * This also explains the `<=' in the for loops in both page_get_freelist() 443 * and page_get_cachelist(). Since we checked the target bin, skipped 444 * a bunch, then continued one a time, we wind up checking the target bin 445 * twice to make sure we get all of them bins. 446 */ 447 #define BIN_STEP 20 448 449 #ifdef VM_STATS 450 struct vmm_vmstats_str { 451 ulong_t pgf_alloc[MMU_PAGE_SIZES]; /* page_get_freelist */ 452 ulong_t pgf_allocok[MMU_PAGE_SIZES]; 453 ulong_t pgf_allocokrem[MMU_PAGE_SIZES]; 454 ulong_t pgf_allocfailed[MMU_PAGE_SIZES]; 455 ulong_t pgf_allocdeferred; 456 ulong_t pgf_allocretry[MMU_PAGE_SIZES]; 457 ulong_t pgc_alloc; /* page_get_cachelist */ 458 ulong_t pgc_allocok; 459 ulong_t pgc_allocokrem; 460 ulong_t pgc_allocokdeferred; 461 ulong_t pgc_allocfailed; 462 ulong_t pgcp_alloc[MMU_PAGE_SIZES]; /* page_get_contig_pages */ 463 ulong_t pgcp_allocfailed[MMU_PAGE_SIZES]; 464 ulong_t pgcp_allocempty[MMU_PAGE_SIZES]; 465 ulong_t pgcp_allocok[MMU_PAGE_SIZES]; 466 ulong_t ptcp[MMU_PAGE_SIZES]; /* page_trylock_contig_pages */ 467 ulong_t ptcpfreethresh[MMU_PAGE_SIZES]; 468 ulong_t ptcpfailexcl[MMU_PAGE_SIZES]; 469 ulong_t ptcpfailszc[MMU_PAGE_SIZES]; 470 ulong_t ptcpfailcage[MMU_PAGE_SIZES]; 471 ulong_t ptcpok[MMU_PAGE_SIZES]; 472 ulong_t pgmf_alloc[MMU_PAGE_SIZES]; /* page_get_mnode_freelist */ 473 ulong_t pgmf_allocfailed[MMU_PAGE_SIZES]; 474 ulong_t pgmf_allocempty[MMU_PAGE_SIZES]; 475 ulong_t pgmf_allocok[MMU_PAGE_SIZES]; 476 ulong_t pgmc_alloc; /* page_get_mnode_cachelist */ 477 ulong_t pgmc_allocfailed; 478 ulong_t pgmc_allocempty; 479 ulong_t pgmc_allocok; 480 ulong_t pladd_free[MMU_PAGE_SIZES]; /* page_list_add/sub */ 481 ulong_t plsub_free[MMU_PAGE_SIZES]; 482 ulong_t pladd_cache; 483 ulong_t plsub_cache; 484 ulong_t plsubpages_szcbig; 485 ulong_t plsubpages_szc0; 486 ulong_t pff_req[MMU_PAGE_SIZES]; /* page_freelist_fill */ 487 ulong_t pff_demote[MMU_PAGE_SIZES]; 488 ulong_t pff_coalok[MMU_PAGE_SIZES]; 489 ulong_t ppr_reloc[MMU_PAGE_SIZES]; /* page_relocate */ 490 ulong_t ppr_relocok[MMU_PAGE_SIZES]; 491 ulong_t ppr_relocnoroot[MMU_PAGE_SIZES]; 492 ulong_t ppr_reloc_replnoroot[MMU_PAGE_SIZES]; 493 ulong_t ppr_relocnolock[MMU_PAGE_SIZES]; 494 ulong_t ppr_relocnomem[MMU_PAGE_SIZES]; 495 ulong_t ppr_krelocfail[MMU_PAGE_SIZES]; 496 ulong_t page_ctrs_coalesce; /* page coalesce counter */ 497 ulong_t page_ctrs_cands_skip; /* candidates useful */ 498 ulong_t page_ctrs_changed; /* ctrs changed after locking */ 499 ulong_t page_ctrs_failed; /* page_freelist_coalesce failed */ 500 ulong_t page_ctrs_coalesce_all; /* page coalesce all counter */ 501 ulong_t page_ctrs_cands_skip_all; /* candidates useful for all func */ 502 }; 503 extern struct vmm_vmstats_str vmm_vmstats; 504 #endif /* VM_STATS */ 505 506 /* 507 * Used to hold off page relocations into the cage until OBP has completed 508 * its boot-time handoff of its resources to the kernel. 509 */ 510 extern int page_relocate_ready; 511 512 /* 513 * cpu/mmu-dependent vm variables may be reset at bootup. 514 */ 515 extern uint_t mmu_page_sizes; 516 extern uint_t max_mmu_page_sizes; 517 extern uint_t mmu_hashcnt; 518 extern uint_t max_mmu_hashcnt; 519 extern size_t mmu_ism_pagesize; 520 extern int mmu_exported_pagesize_mask; 521 extern uint_t mmu_exported_page_sizes; 522 extern uint_t szc_2_userszc[]; 523 extern uint_t userszc_2_szc[]; 524 525 #define USERSZC_2_SZC(userszc) (userszc_2_szc[userszc]) 526 #define SZC_2_USERSZC(szc) (szc_2_userszc[szc]) 527 528 /* 529 * Platform specific map_pgsz large page hook routines. 530 */ 531 extern size_t map_pgszva(struct proc *p, caddr_t addr, size_t len); 532 extern size_t map_pgszheap(struct proc *p, caddr_t addr, size_t len); 533 extern size_t map_pgszstk(struct proc *p, caddr_t addr, size_t len); 534 535 /* 536 * Platform specific page routines 537 */ 538 extern void mach_page_add(page_t **, page_t *); 539 extern void mach_page_sub(page_t **, page_t *); 540 extern uint_t page_get_pagecolors(uint_t); 541 extern void ppcopy_kernel__relocatable(page_t *, page_t *); 542 #define ppcopy_kernel(p1, p2) ppcopy_kernel__relocatable(p1, p2) 543 544 /* 545 * platform specific large pages for kernel heap support 546 */ 547 extern size_t get_segkmem_lpsize(size_t lpsize); 548 extern size_t mmu_get_kernel_lpsize(size_t lpsize); 549 extern void mmu_init_kernel_pgsz(struct hat *hat); 550 extern void mmu_init_kcontext(); 551 extern uint64_t kcontextreg; 552 553 #ifdef __cplusplus 554 } 555 #endif 556 557 #endif /* _VM_DEP_H */ 558