/*
* 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.
*/
#ifndef _SYS_NSCTL_MODEL_H
#define _SYS_NSCTL_MODEL_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* Stolen from Solaris 8
* Only used for Solaris 2.6
*/
#define _ILP32
#ifdef _KERNEL
#endif
#ifndef DS_DDICT
#include <sys/isa_defs.h>
#endif
/*
* These bits are used in various places to specify the data model
*
* This state should only be known to the kernel implementation.
*/
#define DATAMODEL_NONE 0
#if defined(_LP64)
#else
#error "No DATAMODEL_NATIVE specified"
#endif /* _LP64 || _ILP32 */
#endif /* _KERNEL || _KMEMUSER */
#ifndef _ASM
/*
* XXX Ick. This type needs to be visible outside the above guard because
* the proc structure is visible outside the _KERNEL | _KMEMUSER guard.
* If we can make proc internals less visible, (which we obviously should)
* then this can be invisible too.
*/
typedef unsigned int model_t;
#endif /* _ASM */
/*
* These macros allow two views of the same piece of memory depending
* on the originating user-mode program's data model. See the manual
* pages (or uts/README.XX64).
*/
#if defined(_LP64)
union { \
struct struct_type *m64; \
} ptr; \
/*
* In STRUCT_FADDR and STRUCT_FGETP a sleight of hand is employed to make
* the compiler cope with having two different pointer types within ?:.
* The (void *) case on the ILP32 case makes it a pointer which can be
* converted to the pointer on the LP64 case, thus quieting the compiler.
*/
sizeof (caddr32_t) : \
sizeof (caddr_t))
sizeof (struct struct_type##32) : \
sizeof (struct struct_type))
#else /* _LP64 */
struct struct_type *ptr; \
}; \
#ifdef lint
(void) (umodel); \
#else
#endif /* lint */
#endif /* _LP64 */
struct _klwp;
extern model_t get_udatamodel(void);
#else
/*
* If we're the 32-bit kernel, the result of these function
* calls is completely predictable, so let's just cheat. A
* good compiler should be able to elide all the unreachable code
* that results. Optimism about optimization reigns supreme ;-)
*/
#endif /* _LP64 || lint || __lint */
#endif /* _KERNEL && !_ASM */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_NSCTL_MODEL_H */