/*
* 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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <sys/sysmacros.h>
/*
* We will "allocate" this many mmapobj_result_t segments on the stack
* in an attempt to avoid the need to call kmem_alloc. This value should
* cover 99% of the known ELF libraries as well as AOUT (4.x) libraries.
*/
static void
{
int i;
for (i = 0; i < num; i++) {
}
}
int
{
int error;
int old_error;
int convert_64to32 = 0;
/* Verify flags */
if ((flags & ~MMOBJ_ALL_FLAGS) != 0) {
}
}
}
goto out;
}
if (error) {
goto out;
}
num_in = num_mapped;
model = get_udatamodel();
if (model != DATAMODEL_NATIVE) {
convert_64to32 = 1;
}
if (flags & MMOBJ_PADDING) {
if (convert_64to32) {
} else {
}
if (error) {
goto out;
}
/*
* Need to catch overflow here for the 64 bit case. For the
* 32 bit case, overflow would round up to 4G which would
* not be able to fit in any address space and thus ENOMEM
* would be returned after calling into mmapobj.
*/
if (padding) {
if (padding == 0) {
goto out;
}
}
/* turn off padding if no bytes were requested */
if (padding == 0) {
}
}
if (num_mapped > MOBJ_STACK_SEGS) {
}
KM_SLEEP);
goto retry;
}
}
if (error) {
/*
* We only mapped in segments if the mmapobj call
* succeeded, so only unmap for that case.
*/
if (old_error == 0) {
}
} else if (num_in < num_mapped) {
} else {
if (convert_64to32) {
/* Need to translate from 64bit to 32bit */
KM_SLEEP);
num_mapped * sizeof (mmapobj_result32_t));
} else {
num_mapped * sizeof (mmapobj_result_t));
}
if (error) {
}
}
}
/*
* If stack_mr was not large enough, then we had to allocate
* a larger piece of memory to hold the mmapobj_result array.
*/
if (alloc_num != 0) {
alloc_num * sizeof (mmapobj_result_t));
}
out:
if (error) {
} else {
return (0);
}
}