mach_vm_dep.c revision aaa10e6791d1614700651df2821f84d490c094bf
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Portions of this source code were derived from Berkeley 4.3 BSD
* under license from the Regents of the University of California.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* UNIX machine dependent virtual memory support.
*/
#include <sys/cpu_module.h>
#include <sys/elf_SPARC.h>
#include <sys/archsystm.h>
#include <vm/hat_sfmmu.h>
#include <sys/mem_cage.h>
#if defined(__sparcv9) && defined(SF_ERRATA_57)
#endif
uint_t page_colors = 0;
uint_t page_colors_mask = 0;
int consistent_coloring;
/*
* The sun4u hardware mapping sizes which will always be supported are
* 8K, 64K, 512K and 4M. If sun4u based machines need to support other
* page sizes, platform or cpu specific routines need to modify the value.
* The base pagesize (p_szc == 0) must always be supported by the hardware.
*/
extern uint_t vac_colors_mask;
extern int vac_shift;
hw_pagesize_t hw_page_array[] = {
{0, 0, 0, 0}
};
/*
* Maximum page size used to map 64-bit memory segment kmem64_base..kmem64_end
*/
int max_bootlp_tteszc = TTE4M;
/*
* use_text_pgsz64k and use_text_pgsz512k allow the user to turn on these
* additional text page sizes for USIII-IV+ and OPL by changing the default
*/
int use_text_pgsz64K = 0;
int use_text_pgsz512K = 0;
/*
* Maximum and default segment size tunables for user heap, stack, private
* and shared anonymous memory, and user text and initialized data.
*/
void
{
if (max_uheap_lpsize == MMU_PAGESIZE4M) {
}
if (max_ustack_lpsize == MMU_PAGESIZE4M) {
}
if (max_privmap_lpsize == MMU_PAGESIZE4M) {
}
if (max_shm_lpsize == MMU_PAGESIZE4M) {
}
}
/*
* map_addr_proc() is the routine called when the system is to
* choose an address for the user. We will pick an address
* range which is just below the current stack limit. The
* algorithm used for cache consistency on machines with virtual
* address caches is such that offset 0 in the vnode is always
* on a shm_alignment'ed aligned address. Unfortunately, this
* means that vnodes which are demand paged will not be mapped
* cache consistently with the executable images. When the
* cache alignment for a given object is inconsistent, the
* lower level code must manage the translations so that this
* is not seen here (at the cost of efficiency, of course).
*
* On input it is a hint from the user to be used in a completely
* machine dependent fashion. For MAP_ALIGN, addrp contains the
* minimal alignment.
*
* On output it is NULL if no address can be found in the current
* processes address space or else an address that is currently
* not mapped for len bytes with a page of red zone on either side.
* If vacalign is true, then the selected address will obey the alignment
* constraints of a vac machine based on the given off value.
*/
/*ARGSUSED4*/
void
{
int allow_largepage_alignment = 1;
/*
* This happens when a program wants to map something in
* a range that's accessible to a program in a smaller
* address space. For example, a 64-bit program might
* be calling mmap32(2) to guarantee that the returned
* address is below 4Gbytes.
*/
} else {
& PAGEMASK);
}
/*
* Redzone for each side of the request. This is done to leave
* one page unmapped between segments. This is not required, but
* it's useful for the user because if their program strays across
* a segment boundary, it will catch a fault immediately making
* debugging a little easier.
*/
/*
* If the request is larger than the size of a particular
* mmu level, then we use that level to map the request.
* But this requires that both the virtual and the physical
* addresses be aligned with respect to that level, so we
* do the virtual bit of nastiness here.
*
* For 32-bit processes, only those which have specified
* MAP_ALIGN or an addr will be aligned on a page size > 4MB. Otherwise
* we can potentially waste up to 256MB of the 4G process address
* space just for alignment.
*/
}
if ((mmu_page_sizes == max_mmu_page_sizes) &&
} else if ((mmu_page_sizes == max_mmu_page_sizes) &&
} else {
/*
* Align virtual addresses on a 64K boundary to ensure
* that ELF shared libraries are mapped with the appropriate
* alignment constraints by the run-time linker.
*/
}
/*
* 64-bit processes require 1024K alignment of ELF shared libraries.
*/
if (p->p_model == DATAMODEL_LP64)
#ifdef VAC
#endif
}
len += align_amount;
/*
* Look for a large enough hole starting below the stack limit.
* After finding it, use the upper part. Addition of PAGESIZE is
* for the redzone as described above.
*/
/*
* Round address DOWN to the alignment amount,
* add the offset, and if this address is less
* than the original address, add alignment amount.
*/
addr += align_amount;
}
#if defined(SF_ERRATA_57)
}
#endif
} else {
}
}
/*
* Platform-dependent page scrub call.
*/
void
{
/*
* For now, we rely on the fact that pagezero() will
* always clear UEs.
*/
}
/*ARGSUSED*/
void
{
}
/*
* platform specific large pages for kernel heap support
*/
void
{
extern void set_kcontextreg();
if (kcontextreg)
}
void
contig_mem_init(void)
{
/* not applicable to sun4u */
}
/*ARGSUSED*/
{
/* not applicable to sun4u */
return (alloc_base);
}
exec_get_spslew(void)
{
return (0);
}