/*
* 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 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
#include <sys/sysmacros.h>
#include <sys/tuneable.h>
#include <sys/archsystm.h>
#include <vm/seg_kmem.h>
#include <sys/autoconf.h>
#ifdef __sparc
#endif
/*
* Routine which sets a user error; placed in
* illegal entries in the bdevsw and cdevsw tables.
*/
int
nodev()
{
}
/*
* Null routine; placed in insignificant entries
* in the bdevsw and cdevsw tables.
*/
int
nulldev()
{
return (0);
}
/*
* Generate an unused major device number.
*/
getudev()
{
/*
* Ensure that we start allocating major numbers above the 'devcnt'
* count. The only limit we place on the number is that it should be a
* legal 32-bit SVR4 major number and be greater than or equal to devcnt
* in the current system).
*/
if (next == 0)
else {
/*
* If we fail to allocate a major number because devcnt has
* reached L_MAXMAJ32, we may be the victim of a sparsely
* populated devnames array. We scan the array backwards
* looking for an empty slot; if we find one, mark it as
* DN_GETUDEV so it doesn't get taken by subsequent consumers
* users of the devnames array, and issue a warning.
* It is vital for this routine to take drastic measures to
* succeed, since the kernel really needs it to boot.
*/
int i;
for (i = devcnt - 1; i >= 0; i--) {
break;
}
if (i != -1) {
} else {
}
}
return (ret);
}
/*
* Compress 'long' device number encoding to 32-bit device number
* encoding. If it won't fit, we return failure, but set the
* device number to 32-bit NODEV for the sake of our callers.
*/
int
{
#if defined(_LP64)
} else {
return (0);
}
}
#else
#endif
return (1);
}
/*
* Expand 32-bit dev_t's to long dev_t's. Expansion always "fits"
* into the return type, but we're careful to expand NODEV explicitly.
*/
{
#ifdef _LP64
return (NODEV);
dev32 & L_MAXMIN32));
#else
#endif
}
#ifndef _LP64
/*
* Keep these entry points for 32-bit systems but enforce the use
*/
int
min(int a, int b)
{
return (a < b ? a : b);
}
int
max(int a, int b)
{
return (a > b ? a : b);
}
{
return (a < b ? a : b);
}
{
return (a > b ? a : b);
}
#endif /* !_LP64 */
/*
* Parse suboptions from a string.
* Same as getsubopt(3C).
*/
int
{
char *s = *optionsp, *p;
int i;
if (*s == '\0')
return (-1);
if (p == NULL) {
p = s + strlen(s);
} else {
*p++ = '\0'; /* mark end and point to next */
}
*optionsp = p; /* point to next option */
if (p == NULL) {
} else {
optlen = p - s;
*valuep = ++p;
}
return (i);
}
/* no match, point value at option and return error */
*valuep = s;
return (-1);
}
/*
* Append the suboption string 'opt' starting at the position 'str'
* within the buffer defined by 'buf' and 'len'. If 'buf' is not null,
* a comma is appended first.
* Return a pointer to the end of the resulting string (the null byte).
* Return NULL if there isn't enough space left to append 'opt'.
*/
char *
{
/*
* Include a ',' if this is not the first option.
* Include space for the null byte.
*/
return (NULL);
if (buf[0] != '\0')
*str++ = ',';
return (str + l);
}
/*
*/
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29,
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39,
0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49,
0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59,
0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79,
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99,
};
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0,
10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 0, 0, 0, 0, 0, 0,
20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 0, 0, 0, 0, 0, 0,
30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 0, 0, 0, 0, 0, 0,
40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 0, 0, 0, 0, 0, 0,
50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 0, 0, 0, 0, 0, 0,
60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 0, 0, 0, 0, 0, 0,
70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 0, 0, 0, 0, 0, 0,
80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 0, 0, 0, 0, 0, 0,
90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
};
/*
* Hot-patch a single instruction in the kernel's text.
* If you want to patch multiple instructions you must
* arrange to do it so that all intermediate stages are
* sane -- we don't stop other cpus while doing this.
* Size must be 1, 2, or 4 bytes with iaddr aligned accordingly.
*/
void
{
switch (size) {
case 1:
break;
case 2:
break;
case 4:
break;
default:
panic("illegal hot-patch");
}
membar_enter();
}
/*
* Routine to report an attempt to execute non-executable data. If the
* address executed lies in the stack, explicitly say so.
*/
void
{
if (!noexec_user_stack_log)
return;
} else {
}
}
/*
* Determine whether the address range [addr, addr + len) is in memlist mp.
*/
int
{
while (mp != 0) {
return (1); /* TRUE */
}
return (0); /* FALSE */
}
/*
* Pop the topmost element from the t_ontrap stack, removing the current set of
* stack is already empty, no_trap() just returns.
*/
void
no_trap(void)
{
#ifdef __sparc
membar_sync(); /* deferred error barrier (see sparcv9_subr.s) */
#endif
}
}
/*
* Return utsname.nodename outside a zone, or the zone name within.
*/
char *
uts_nodename(void)
{
}