macOS libc headers: add mach-o/dyld.h

libcxx depends on it
This commit is contained in:
Andrew Kelley 2020-11-08 19:51:30 -08:00
parent 25e78bd007
commit 1213e26ba8
7 changed files with 2824 additions and 0 deletions

View File

@ -0,0 +1,381 @@
/*
* Copyright (c) 1999-2008 Apple Computer, Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this
* file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
/*
* Copyright (c) 1992 NeXT Computer, Inc.
*
* Byte ordering conversion.
*
*/
#ifndef _ARCHITECTURE_BYTE_ORDER_H_
#define _ARCHITECTURE_BYTE_ORDER_H_
/*
* Please note that the byte ordering functions in this file are deprecated.
* A replacement API exists in libkern/OSByteOrder.h
*/
#include <libkern/OSByteOrder.h>
typedef unsigned long NXSwappedFloat;
typedef unsigned long long NXSwappedDouble;
static __inline__ __attribute__((deprecated))
unsigned short
NXSwapShort(
unsigned short inv
)
{
return (unsigned short)OSSwapInt16((uint16_t)inv);
}
static __inline__ __attribute__((deprecated))
unsigned int
NXSwapInt(
unsigned int inv
)
{
return (unsigned int)OSSwapInt32((uint32_t)inv);
}
static __inline__ __attribute__((deprecated))
unsigned long
NXSwapLong(
unsigned long inv
)
{
return (unsigned long)OSSwapInt32((uint32_t)inv);
}
static __inline__ __attribute__((deprecated))
unsigned long long
NXSwapLongLong(
unsigned long long inv
)
{
return (unsigned long long)OSSwapInt64((uint64_t)inv);
}
static __inline__ __attribute__((deprecated))
NXSwappedFloat
NXConvertHostFloatToSwapped(float x)
{
union fconv {
float number;
NXSwappedFloat sf;
} u;
u.number = x;
return u.sf;
}
static __inline__ __attribute__((deprecated))
float
NXConvertSwappedFloatToHost(NXSwappedFloat x)
{
union fconv {
float number;
NXSwappedFloat sf;
} u;
u.sf = x;
return u.number;
}
static __inline__ __attribute__((deprecated))
NXSwappedDouble
NXConvertHostDoubleToSwapped(double x)
{
union dconv {
double number;
NXSwappedDouble sd;
} u;
u.number = x;
return u.sd;
}
static __inline__ __attribute__((deprecated))
double
NXConvertSwappedDoubleToHost(NXSwappedDouble x)
{
union dconv {
double number;
NXSwappedDouble sd;
} u;
u.sd = x;
return u.number;
}
static __inline__ __attribute__((deprecated))
NXSwappedFloat
NXSwapFloat(NXSwappedFloat x)
{
return (NXSwappedFloat)OSSwapInt32((uint32_t)x);
}
static __inline__ __attribute__((deprecated))
NXSwappedDouble
NXSwapDouble(NXSwappedDouble x)
{
return (NXSwappedDouble)OSSwapInt64((uint64_t)x);
}
/*
* Identify the byte order
* of the current host.
*/
enum NXByteOrder {
NX_UnknownByteOrder,
NX_LittleEndian,
NX_BigEndian
};
static __inline__
enum NXByteOrder
NXHostByteOrder(void)
{
#if defined(__LITTLE_ENDIAN__)
return NX_LittleEndian;
#elif defined(__BIG_ENDIAN__)
return NX_BigEndian;
#else
return NX_UnknownByteOrder;
#endif
}
static __inline__ __attribute__((deprecated))
unsigned short
NXSwapBigShortToHost(
unsigned short x
)
{
return (unsigned short)OSSwapBigToHostInt16((uint16_t)x);
}
static __inline__ __attribute__((deprecated))
unsigned int
NXSwapBigIntToHost(
unsigned int x
)
{
return (unsigned int)OSSwapBigToHostInt32((uint32_t)x);
}
static __inline__ __attribute__((deprecated))
unsigned long
NXSwapBigLongToHost(
unsigned long x
)
{
return (unsigned long)OSSwapBigToHostInt32((uint32_t)x);
}
static __inline__ __attribute__((deprecated))
unsigned long long
NXSwapBigLongLongToHost(
unsigned long long x
)
{
return (unsigned long long)OSSwapBigToHostInt64((uint64_t)x);
}
static __inline__ __attribute__((deprecated))
double
NXSwapBigDoubleToHost(
NXSwappedDouble x
)
{
return NXConvertSwappedDoubleToHost((NXSwappedDouble)OSSwapBigToHostInt64((uint64_t)x));
}
static __inline__ __attribute__((deprecated))
float
NXSwapBigFloatToHost(
NXSwappedFloat x
)
{
return NXConvertSwappedFloatToHost((NXSwappedFloat)OSSwapBigToHostInt32((uint32_t)x));
}
static __inline__ __attribute__((deprecated))
unsigned short
NXSwapHostShortToBig(
unsigned short x
)
{
return (unsigned short)OSSwapHostToBigInt16((uint16_t)x);
}
static __inline__ __attribute__((deprecated))
unsigned int
NXSwapHostIntToBig(
unsigned int x
)
{
return (unsigned int)OSSwapHostToBigInt32((uint32_t)x);
}
static __inline__ __attribute__((deprecated))
unsigned long
NXSwapHostLongToBig(
unsigned long x
)
{
return (unsigned long)OSSwapHostToBigInt32((uint32_t)x);
}
static __inline__ __attribute__((deprecated))
unsigned long long
NXSwapHostLongLongToBig(
unsigned long long x
)
{
return (unsigned long long)OSSwapHostToBigInt64((uint64_t)x);
}
static __inline__ __attribute__((deprecated))
NXSwappedDouble
NXSwapHostDoubleToBig(
double x
)
{
return (NXSwappedDouble)OSSwapHostToBigInt64((uint64_t)NXConvertHostDoubleToSwapped(x));
}
static __inline__ __attribute__((deprecated))
NXSwappedFloat
NXSwapHostFloatToBig(
float x
)
{
return (NXSwappedFloat)OSSwapHostToBigInt32((uint32_t)NXConvertHostFloatToSwapped(x));
}
static __inline__ __attribute__((deprecated))
unsigned short
NXSwapLittleShortToHost(
unsigned short x
)
{
return (unsigned short)OSSwapLittleToHostInt16((uint16_t)x);
}
static __inline__ __attribute__((deprecated))
unsigned int
NXSwapLittleIntToHost(
unsigned int x
)
{
return (unsigned int)OSSwapLittleToHostInt32((uint32_t)x);
}
static __inline__ __attribute__((deprecated))
unsigned long
NXSwapLittleLongToHost(
unsigned long x
)
{
return (unsigned long)OSSwapLittleToHostInt32((uint32_t)x);
}
static __inline__ __attribute__((deprecated))
unsigned long long
NXSwapLittleLongLongToHost(
unsigned long long x
)
{
return (unsigned long long)OSSwapLittleToHostInt64((uint64_t)x);
}
static __inline__ __attribute__((deprecated))
double
NXSwapLittleDoubleToHost(
NXSwappedDouble x
)
{
return NXConvertSwappedDoubleToHost((NXSwappedDouble)OSSwapLittleToHostInt64((uint64_t)x));
}
static __inline__ __attribute__((deprecated))
float
NXSwapLittleFloatToHost(
NXSwappedFloat x
)
{
return NXConvertSwappedFloatToHost((NXSwappedFloat)OSSwapLittleToHostInt32((uint32_t)x));
}
static __inline__ __attribute__((deprecated))
unsigned short
NXSwapHostShortToLittle(
unsigned short x
)
{
return (unsigned short)OSSwapHostToLittleInt16((uint16_t)x);
}
static __inline__ __attribute__((deprecated))
unsigned int
NXSwapHostIntToLittle(
unsigned int x
)
{
return (unsigned int)OSSwapHostToLittleInt32((uint32_t)x);
}
static __inline__ __attribute__((deprecated))
unsigned long
NXSwapHostLongToLittle(
unsigned long x
)
{
return (unsigned long)OSSwapHostToLittleInt32((uint32_t)x);
}
static __inline__ __attribute__((deprecated))
unsigned long long
NXSwapHostLongLongToLittle(
unsigned long long x
)
{
return (unsigned long long)OSSwapHostToLittleInt64((uint64_t)x);
}
static __inline__ __attribute__((deprecated))
NXSwappedDouble
NXSwapHostDoubleToLittle(
double x
)
{
return (NXSwappedDouble)OSSwapHostToLittleInt64((uint64_t)NXConvertHostDoubleToSwapped(x));
}
static __inline__ __attribute__((deprecated))
NXSwappedFloat
NXSwapHostFloatToLittle(
float x
)
{
return (NXSwappedFloat)OSSwapHostToLittleInt32((uint32_t)NXConvertHostFloatToSwapped(x));
}
#endif /* _ARCHITECTURE_BYTE_ORDER_H_ */

View File

@ -0,0 +1,305 @@
/*
* Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#ifndef _OS_OSBYTEORDER_H
#define _OS_OSBYTEORDER_H
#include <stdint.h>
#include <libkern/_OSByteOrder.h>
/* Macros for swapping constant values in the preprocessing stage. */
#define OSSwapConstInt16(x) __DARWIN_OSSwapConstInt16(x)
#define OSSwapConstInt32(x) __DARWIN_OSSwapConstInt32(x)
#define OSSwapConstInt64(x) __DARWIN_OSSwapConstInt64(x)
#if defined(__GNUC__)
#if (defined(__i386__) || defined(__x86_64__))
#include <libkern/i386/OSByteOrder.h>
#else
#include <libkern/machine/OSByteOrder.h>
#endif
#else /* ! __GNUC__ */
#include <libkern/machine/OSByteOrder.h>
#endif /* __GNUC__ */
#define OSSwapInt16(x) __DARWIN_OSSwapInt16(x)
#define OSSwapInt32(x) __DARWIN_OSSwapInt32(x)
#define OSSwapInt64(x) __DARWIN_OSSwapInt64(x)
enum {
OSUnknownByteOrder,
OSLittleEndian,
OSBigEndian
};
OS_INLINE
int32_t
OSHostByteOrder(void)
{
#if defined(__LITTLE_ENDIAN__)
return OSLittleEndian;
#elif defined(__BIG_ENDIAN__)
return OSBigEndian;
#else
return OSUnknownByteOrder;
#endif
}
#define OSReadBigInt(x, y) OSReadBigInt32(x, y)
#define OSWriteBigInt(x, y, z) OSWriteBigInt32(x, y, z)
#define OSSwapBigToHostInt(x) OSSwapBigToHostInt32(x)
#define OSSwapHostToBigInt(x) OSSwapHostToBigInt32(x)
#define OSReadLittleInt(x, y) OSReadLittleInt32(x, y)
#define OSWriteLittleInt(x, y, z) OSWriteLittleInt32(x, y, z)
#define OSSwapHostToLittleInt(x) OSSwapHostToLittleInt32(x)
#define OSSwapLittleToHostInt(x) OSSwapLittleToHostInt32(x)
/* Functions for loading native endian values. */
OS_INLINE
uint16_t
_OSReadInt16(
const volatile void * base,
uintptr_t byteOffset
)
{
return *(volatile uint16_t *)((uintptr_t)base + byteOffset);
}
OS_INLINE
uint32_t
_OSReadInt32(
const volatile void * base,
uintptr_t byteOffset
)
{
return *(volatile uint32_t *)((uintptr_t)base + byteOffset);
}
OS_INLINE
uint64_t
_OSReadInt64(
const volatile void * base,
uintptr_t byteOffset
)
{
return *(volatile uint64_t *)((uintptr_t)base + byteOffset);
}
/* Functions for storing native endian values. */
OS_INLINE
void
_OSWriteInt16(
volatile void * base,
uintptr_t byteOffset,
uint16_t data
)
{
*(volatile uint16_t *)((uintptr_t)base + byteOffset) = data;
}
OS_INLINE
void
_OSWriteInt32(
volatile void * base,
uintptr_t byteOffset,
uint32_t data
)
{
*(volatile uint32_t *)((uintptr_t)base + byteOffset) = data;
}
OS_INLINE
void
_OSWriteInt64(
volatile void * base,
uintptr_t byteOffset,
uint64_t data
)
{
*(volatile uint64_t *)((uintptr_t)base + byteOffset) = data;
}
#if defined(__BIG_ENDIAN__)
/* Functions for loading big endian to host endianess. */
#define OSReadBigInt16(base, byteOffset) _OSReadInt16(base, byteOffset)
#define OSReadBigInt32(base, byteOffset) _OSReadInt32(base, byteOffset)
#define OSReadBigInt64(base, byteOffset) _OSReadInt64(base, byteOffset)
/* Functions for storing host endianess to big endian. */
#define OSWriteBigInt16(base, byteOffset, data) _OSWriteInt16(base, byteOffset, data)
#define OSWriteBigInt32(base, byteOffset, data) _OSWriteInt32(base, byteOffset, data)
#define OSWriteBigInt64(base, byteOffset, data) _OSWriteInt64(base, byteOffset, data)
/* Functions for loading little endian to host endianess. */
#define OSReadLittleInt16(base, byteOffset) OSReadSwapInt16(base, byteOffset)
#define OSReadLittleInt32(base, byteOffset) OSReadSwapInt32(base, byteOffset)
#define OSReadLittleInt64(base, byteOffset) OSReadSwapInt64(base, byteOffset)
/* Functions for storing host endianess to little endian. */
#define OSWriteLittleInt16(base, byteOffset, data) OSWriteSwapInt16(base, byteOffset, data)
#define OSWriteLittleInt32(base, byteOffset, data) OSWriteSwapInt32(base, byteOffset, data)
#define OSWriteLittleInt64(base, byteOffset, data) OSWriteSwapInt64(base, byteOffset, data)
/* Host endianess to big endian byte swapping macros for constants. */
#define OSSwapHostToBigConstInt16(x) ((uint16_t)(x))
#define OSSwapHostToBigConstInt32(x) ((uint32_t)(x))
#define OSSwapHostToBigConstInt64(x) ((uint64_t)(x))
/* Generic host endianess to big endian byte swapping functions. */
#define OSSwapHostToBigInt16(x) ((uint16_t)(x))
#define OSSwapHostToBigInt32(x) ((uint32_t)(x))
#define OSSwapHostToBigInt64(x) ((uint64_t)(x))
/* Host endianess to little endian byte swapping macros for constants. */
#define OSSwapHostToLittleConstInt16(x) OSSwapConstInt16(x)
#define OSSwapHostToLittleConstInt32(x) OSSwapConstInt32(x)
#define OSSwapHostToLittleConstInt64(x) OSSwapConstInt64(x)
/* Generic host endianess to little endian byte swapping functions. */
#define OSSwapHostToLittleInt16(x) OSSwapInt16(x)
#define OSSwapHostToLittleInt32(x) OSSwapInt32(x)
#define OSSwapHostToLittleInt64(x) OSSwapInt64(x)
/* Big endian to host endianess byte swapping macros for constants. */
#define OSSwapBigToHostConstInt16(x) ((uint16_t)(x))
#define OSSwapBigToHostConstInt32(x) ((uint32_t)(x))
#define OSSwapBigToHostConstInt64(x) ((uint64_t)(x))
/* Generic big endian to host endianess byte swapping functions. */
#define OSSwapBigToHostInt16(x) ((uint16_t)(x))
#define OSSwapBigToHostInt32(x) ((uint32_t)(x))
#define OSSwapBigToHostInt64(x) ((uint64_t)(x))
/* Little endian to host endianess byte swapping macros for constants. */
#define OSSwapLittleToHostConstInt16(x) OSSwapConstInt16(x)
#define OSSwapLittleToHostConstInt32(x) OSSwapConstInt32(x)
#define OSSwapLittleToHostConstInt64(x) OSSwapConstInt64(x)
/* Generic little endian to host endianess byte swapping functions. */
#define OSSwapLittleToHostInt16(x) OSSwapInt16(x)
#define OSSwapLittleToHostInt32(x) OSSwapInt32(x)
#define OSSwapLittleToHostInt64(x) OSSwapInt64(x)
#elif defined(__LITTLE_ENDIAN__)
/* Functions for loading big endian to host endianess. */
#define OSReadBigInt16(base, byteOffset) OSReadSwapInt16(base, byteOffset)
#define OSReadBigInt32(base, byteOffset) OSReadSwapInt32(base, byteOffset)
#define OSReadBigInt64(base, byteOffset) OSReadSwapInt64(base, byteOffset)
/* Functions for storing host endianess to big endian. */
#define OSWriteBigInt16(base, byteOffset, data) OSWriteSwapInt16(base, byteOffset, data)
#define OSWriteBigInt32(base, byteOffset, data) OSWriteSwapInt32(base, byteOffset, data)
#define OSWriteBigInt64(base, byteOffset, data) OSWriteSwapInt64(base, byteOffset, data)
/* Functions for loading little endian to host endianess. */
#define OSReadLittleInt16(base, byteOffset) _OSReadInt16(base, byteOffset)
#define OSReadLittleInt32(base, byteOffset) _OSReadInt32(base, byteOffset)
#define OSReadLittleInt64(base, byteOffset) _OSReadInt64(base, byteOffset)
/* Functions for storing host endianess to little endian. */
#define OSWriteLittleInt16(base, byteOffset, data) _OSWriteInt16(base, byteOffset, data)
#define OSWriteLittleInt32(base, byteOffset, data) _OSWriteInt32(base, byteOffset, data)
#define OSWriteLittleInt64(base, byteOffset, data) _OSWriteInt64(base, byteOffset, data)
/* Host endianess to big endian byte swapping macros for constants. */
#define OSSwapHostToBigConstInt16(x) OSSwapConstInt16(x)
#define OSSwapHostToBigConstInt32(x) OSSwapConstInt32(x)
#define OSSwapHostToBigConstInt64(x) OSSwapConstInt64(x)
/* Generic host endianess to big endian byte swapping functions. */
#define OSSwapHostToBigInt16(x) OSSwapInt16(x)
#define OSSwapHostToBigInt32(x) OSSwapInt32(x)
#define OSSwapHostToBigInt64(x) OSSwapInt64(x)
/* Host endianess to little endian byte swapping macros for constants. */
#define OSSwapHostToLittleConstInt16(x) ((uint16_t)(x))
#define OSSwapHostToLittleConstInt32(x) ((uint32_t)(x))
#define OSSwapHostToLittleConstInt64(x) ((uint64_t)(x))
/* Generic host endianess to little endian byte swapping functions. */
#define OSSwapHostToLittleInt16(x) ((uint16_t)(x))
#define OSSwapHostToLittleInt32(x) ((uint32_t)(x))
#define OSSwapHostToLittleInt64(x) ((uint64_t)(x))
/* Big endian to host endianess byte swapping macros for constants. */
#define OSSwapBigToHostConstInt16(x) OSSwapConstInt16(x)
#define OSSwapBigToHostConstInt32(x) OSSwapConstInt32(x)
#define OSSwapBigToHostConstInt64(x) OSSwapConstInt64(x)
/* Generic big endian to host endianess byte swapping functions. */
#define OSSwapBigToHostInt16(x) OSSwapInt16(x)
#define OSSwapBigToHostInt32(x) OSSwapInt32(x)
#define OSSwapBigToHostInt64(x) OSSwapInt64(x)
/* Little endian to host endianess byte swapping macros for constants. */
#define OSSwapLittleToHostConstInt16(x) ((uint16_t)(x))
#define OSSwapLittleToHostConstInt32(x) ((uint32_t)(x))
#define OSSwapLittleToHostConstInt64(x) ((uint64_t)(x))
/* Generic little endian to host endianess byte swapping functions. */
#define OSSwapLittleToHostInt16(x) ((uint16_t)(x))
#define OSSwapLittleToHostInt32(x) ((uint32_t)(x))
#define OSSwapLittleToHostInt64(x) ((uint64_t)(x))
#else
#error Unknown endianess.
#endif
#endif /* ! _OS_OSBYTEORDER_H */

View File

@ -0,0 +1,112 @@
/*
* Copyright (c) 1999-2006 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#ifndef _OS_OSBYTEORDERI386_H
#define _OS_OSBYTEORDERI386_H
#include <stdint.h>
#include <libkern/i386/_OSByteOrder.h>
#include <sys/_types/_os_inline.h>
/* Functions for byte reversed loads. */
OS_INLINE
uint16_t
OSReadSwapInt16(
const volatile void * base,
uintptr_t byteOffset
)
{
uint16_t result;
result = *(volatile uint16_t *)((uintptr_t)base + byteOffset);
return _OSSwapInt16(result);
}
OS_INLINE
uint32_t
OSReadSwapInt32(
const volatile void * base,
uintptr_t byteOffset
)
{
uint32_t result;
result = *(volatile uint32_t *)((uintptr_t)base + byteOffset);
return _OSSwapInt32(result);
}
OS_INLINE
uint64_t
OSReadSwapInt64(
const volatile void * base,
uintptr_t byteOffset
)
{
uint64_t result;
result = *(volatile uint64_t *)((uintptr_t)base + byteOffset);
return _OSSwapInt64(result);
}
/* Functions for byte reversed stores. */
OS_INLINE
void
OSWriteSwapInt16(
volatile void * base,
uintptr_t byteOffset,
uint16_t data
)
{
*(volatile uint16_t *)((uintptr_t)base + byteOffset) = _OSSwapInt16(data);
}
OS_INLINE
void
OSWriteSwapInt32(
volatile void * base,
uintptr_t byteOffset,
uint32_t data
)
{
*(volatile uint32_t *)((uintptr_t)base + byteOffset) = _OSSwapInt32(data);
}
OS_INLINE
void
OSWriteSwapInt64(
volatile void * base,
uintptr_t byteOffset,
uint64_t data
)
{
*(volatile uint64_t *)((uintptr_t)base + byteOffset) = _OSSwapInt64(data);
}
#endif /* ! _OS_OSBYTEORDERI386_H */

View File

@ -0,0 +1,263 @@
/*
* Copyright (c) 1999-2008 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this
* file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
#ifndef _MACH_O_DYLD_H_
#define _MACH_O_DYLD_H_
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
#include <mach-o/loader.h>
#include <Availability.h>
#if __cplusplus
extern "C" {
#endif
#ifdef __DRIVERKIT_19_0
#define DYLD_DRIVERKIT_UNAVAILABLE __API_UNAVAILABLE(driverkit)
#else
#define DYLD_DRIVERKIT_UNAVAILABLE
#endif
/*
* The following functions allow you to iterate through all loaded images.
* This is not a thread safe operation. Another thread can add or remove
* an image during the iteration.
*
* Many uses of these routines can be replace by a call to dladdr() which
* will return the mach_header and name of an image, given an address in
* the image. dladdr() is thread safe.
*/
extern uint32_t _dyld_image_count(void) __OSX_AVAILABLE_STARTING(__MAC_10_1, __IPHONE_2_0);
extern const struct mach_header* _dyld_get_image_header(uint32_t image_index) __OSX_AVAILABLE_STARTING(__MAC_10_1, __IPHONE_2_0);
extern intptr_t _dyld_get_image_vmaddr_slide(uint32_t image_index) __OSX_AVAILABLE_STARTING(__MAC_10_1, __IPHONE_2_0);
extern const char* _dyld_get_image_name(uint32_t image_index) __OSX_AVAILABLE_STARTING(__MAC_10_1, __IPHONE_2_0);
/*
* The following functions allow you to install callbacks which will be called
* by dyld whenever an image is loaded or unloaded. During a call to _dyld_register_func_for_add_image()
* the callback func is called for every existing image. Later, it is called as each new image
* is loaded and bound (but initializers not yet run). The callback registered with
* _dyld_register_func_for_remove_image() is called after any terminators in an image are run
* and before the image is un-memory-mapped.
*/
extern void _dyld_register_func_for_add_image(void (*func)(const struct mach_header* mh, intptr_t vmaddr_slide)) __OSX_AVAILABLE_STARTING(__MAC_10_1, __IPHONE_2_0);
extern void _dyld_register_func_for_remove_image(void (*func)(const struct mach_header* mh, intptr_t vmaddr_slide)) __OSX_AVAILABLE_STARTING(__MAC_10_1, __IPHONE_2_0);
/*
* NSVersionOfRunTimeLibrary() returns the current_version number of the currently dylib
* specifed by the libraryName. The libraryName parameter would be "bar" for /path/libbar.3.dylib and
* "Foo" for /path/Foo.framework/Versions/A/Foo. It returns -1 if no such library is loaded.
*/
extern int32_t NSVersionOfRunTimeLibrary(const char* libraryName) __OSX_AVAILABLE_STARTING(__MAC_10_1, __IPHONE_2_0);
/*
* NSVersionOfLinkTimeLibrary() returns the current_version number that the main executable was linked
* against at build time. The libraryName parameter would be "bar" for /path/libbar.3.dylib and
* "Foo" for /path/Foo.framework/Versions/A/Foo. It returns -1 if the main executable did not link
* against the specified library.
*/
extern int32_t NSVersionOfLinkTimeLibrary(const char* libraryName) __OSX_AVAILABLE_STARTING(__MAC_10_1, __IPHONE_2_0);
/*
* _NSGetExecutablePath() copies the path of the main executable into the buffer. The bufsize parameter
* should initially be the size of the buffer. The function returns 0 if the path was successfully copied,
* and *bufsize is left unchanged. It returns -1 if the buffer is not large enough, and *bufsize is set
* to the size required.
*
* Note that _NSGetExecutablePath will return "a path" to the executable not a "real path" to the executable.
* That is the path may be a symbolic link and not the real file. With deep directories the total bufsize
* needed could be more than MAXPATHLEN.
*/
extern int _NSGetExecutablePath(char* buf, uint32_t* bufsize) __OSX_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_2_0);
/*
* Registers a function to be called when the current thread terminates.
* Called by c++ compiler to implement destructors on thread_local object variables.
*/
extern void _tlv_atexit(void (*termFunc)(void* objAddr), void* objAddr) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0);
/*
* Never called. On-disk thread local variables contain a pointer to this. Once
* the thread local is prepared, the pointer changes to a real handler such as tlv_get_addr.
*/
extern void _tlv_bootstrap(void) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0) DYLD_DRIVERKIT_UNAVAILABLE ;
/*
* The following dyld API's are deprecated as of Mac OS X 10.5. They are either
* no longer necessary or are superceeded by dlopen and friends in <dlfcn.h>.
* dlopen/dlsym/dlclose have been available since Mac OS X 10.3 and work with
* dylibs and bundles.
*
* NSAddImage -> dlopen
* NSLookupSymbolInImage -> dlsym
* NSCreateObjectFileImageFromFile -> dlopen
* NSDestroyObjectFileImage -> dlclose
* NSLinkModule -> not needed when dlopen used
* NSUnLinkModule -> not needed when dlclose used
* NSLookupSymbolInModule -> dlsym
* _dyld_image_containing_address -> dladdr
* NSLinkEditError -> dlerror
*
*/
#ifndef ENUM_DYLD_BOOL
#define ENUM_DYLD_BOOL
#undef FALSE
#undef TRUE
enum DYLD_BOOL { FALSE, TRUE };
#endif /* ENUM_DYLD_BOOL */
/* Object file image API */
typedef enum {
NSObjectFileImageFailure, /* for this a message is printed on stderr */
NSObjectFileImageSuccess,
NSObjectFileImageInappropriateFile,
NSObjectFileImageArch,
NSObjectFileImageFormat, /* for this a message is printed on stderr */
NSObjectFileImageAccess
} NSObjectFileImageReturnCode;
typedef struct __NSObjectFileImage* NSObjectFileImage;
/* NSObjectFileImage can only be used with MH_BUNDLE files */
extern NSObjectFileImageReturnCode NSCreateObjectFileImageFromFile(const char* pathName, NSObjectFileImage *objectFileImage) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "dlopen()");
extern NSObjectFileImageReturnCode NSCreateObjectFileImageFromMemory(const void *address, size_t size, NSObjectFileImage *objectFileImage) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "");
extern bool NSDestroyObjectFileImage(NSObjectFileImage objectFileImage) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "dlclose()");
extern uint32_t NSSymbolDefinitionCountInObjectFileImage(NSObjectFileImage objectFileImage) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "");
extern const char* NSSymbolDefinitionNameInObjectFileImage(NSObjectFileImage objectFileImage, uint32_t ordinal) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "");
extern uint32_t NSSymbolReferenceCountInObjectFileImage(NSObjectFileImage objectFileImage) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "");
extern const char* NSSymbolReferenceNameInObjectFileImage(NSObjectFileImage objectFileImage, uint32_t ordinal, bool *tentative_definition) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "");
extern bool NSIsSymbolDefinedInObjectFileImage(NSObjectFileImage objectFileImage, const char* symbolName) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.4, "dlsym()");
extern void* NSGetSectionDataInObjectFileImage(NSObjectFileImage objectFileImage, const char* segmentName, const char* sectionName, size_t *size) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "getsectiondata()");
typedef struct __NSModule* NSModule;
extern const char* NSNameOfModule(NSModule m) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "");
extern const char* NSLibraryNameForModule(NSModule m) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "");
extern NSModule NSLinkModule(NSObjectFileImage objectFileImage, const char* moduleName, uint32_t options) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "dlopen()");
#define NSLINKMODULE_OPTION_NONE 0x0
#define NSLINKMODULE_OPTION_BINDNOW 0x1
#define NSLINKMODULE_OPTION_PRIVATE 0x2
#define NSLINKMODULE_OPTION_RETURN_ON_ERROR 0x4
#define NSLINKMODULE_OPTION_DONT_CALL_MOD_INIT_ROUTINES 0x8
#define NSLINKMODULE_OPTION_TRAILING_PHYS_NAME 0x10
extern bool NSUnLinkModule(NSModule module, uint32_t options) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "");
#define NSUNLINKMODULE_OPTION_NONE 0x0
#define NSUNLINKMODULE_OPTION_KEEP_MEMORY_MAPPED 0x1
#define NSUNLINKMODULE_OPTION_RESET_LAZY_REFERENCES 0x2
/* symbol API */
typedef struct __NSSymbol* NSSymbol;
extern bool NSIsSymbolNameDefined(const char* symbolName) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.4, "dlsym()");
extern bool NSIsSymbolNameDefinedWithHint(const char* symbolName, const char* libraryNameHint) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.4, "dlsym()");
extern bool NSIsSymbolNameDefinedInImage(const struct mach_header* image, const char* symbolName) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.4, "dlsym()");
extern NSSymbol NSLookupAndBindSymbol(const char* symbolName) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.4, "dlsym()");
extern NSSymbol NSLookupAndBindSymbolWithHint(const char* symbolName, const char* libraryNameHint) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.4, "dlsym()");
extern NSSymbol NSLookupSymbolInModule(NSModule module, const char* symbolName) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "dlsym()");
extern NSSymbol NSLookupSymbolInImage(const struct mach_header* image, const char* symbolName, uint32_t options) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "dlsym()");
#define NSLOOKUPSYMBOLINIMAGE_OPTION_BIND 0x0
#define NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_NOW 0x1
#define NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_FULLY 0x2
#define NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR 0x4
extern const char* NSNameOfSymbol(NSSymbol symbol) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "");
extern void * NSAddressOfSymbol(NSSymbol symbol) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "dlsym()");
extern NSModule NSModuleForSymbol(NSSymbol symbol) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "dladdr()");
/* error handling API */
typedef enum {
NSLinkEditFileAccessError,
NSLinkEditFileFormatError,
NSLinkEditMachResourceError,
NSLinkEditUnixResourceError,
NSLinkEditOtherError,
NSLinkEditWarningError,
NSLinkEditMultiplyDefinedError,
NSLinkEditUndefinedError
} NSLinkEditErrors;
/*
* For the NSLinkEditErrors value NSLinkEditOtherError these are the values
* passed to the link edit error handler as the errorNumber (what would be an
* errno value for NSLinkEditUnixResourceError or a kern_return_t value for
* NSLinkEditMachResourceError).
*/
typedef enum {
NSOtherErrorRelocation,
NSOtherErrorLazyBind,
NSOtherErrorIndrLoop,
NSOtherErrorLazyInit,
NSOtherErrorInvalidArgs
} NSOtherErrorNumbers;
extern void NSLinkEditError(NSLinkEditErrors *c, int *errorNumber, const char** fileName, const char** errorString) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "dlerror()");
typedef struct {
void (*undefined)(const char* symbolName);
NSModule (*multiple)(NSSymbol s, NSModule oldModule, NSModule newModule);
void (*linkEdit)(NSLinkEditErrors errorClass, int errorNumber,
const char* fileName, const char* errorString);
} NSLinkEditErrorHandlers;
extern void NSInstallLinkEditErrorHandlers(const NSLinkEditErrorHandlers *handlers) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "");
extern bool NSAddLibrary(const char* pathName) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.4, "dlopen()");
extern bool NSAddLibraryWithSearching(const char* pathName) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.4, "dlopen()");
extern const struct mach_header* NSAddImage(const char* image_name, uint32_t options) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "dlopen()");
#define NSADDIMAGE_OPTION_NONE 0x0
#define NSADDIMAGE_OPTION_RETURN_ON_ERROR 0x1
#define NSADDIMAGE_OPTION_WITH_SEARCHING 0x2
#define NSADDIMAGE_OPTION_RETURN_ONLY_IF_LOADED 0x4
#define NSADDIMAGE_OPTION_MATCH_FILENAME_BY_INSTALLNAME 0x8
extern bool _dyld_present(void) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "always true");
extern bool _dyld_launched_prebound(void) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "moot");
extern bool _dyld_all_twolevel_modules_prebound(void) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.3, 10.5, "moot");
extern bool _dyld_bind_fully_image_containing_address(const void* address) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "dlopen(RTLD_NOW)");
extern bool _dyld_image_containing_address(const void* address) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.3, 10.5, "dladdr()");
extern void _dyld_lookup_and_bind(const char* symbol_name, void **address, NSModule* module) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.4, "dlsym()");
extern void _dyld_lookup_and_bind_with_hint(const char* symbol_name, const char* library_name_hint, void** address, NSModule* module) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.4, "dlsym()");
extern void _dyld_lookup_and_bind_fully(const char* symbol_name, void** address, NSModule* module) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "dlsym()");
extern const struct mach_header* _dyld_get_image_header_containing_address(const void* address) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.3, 10.5, "dladdr()");
#if __cplusplus
}
#endif
#endif /* _MACH_O_DYLD_H_ */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,152 @@
/*
* Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
/*
* Mach Operating System
* Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
/*
*/
/*
* File: mach/vm_prot.h
* Author: Avadis Tevanian, Jr., Michael Wayne Young
*
* Virtual memory protection definitions.
*
*/
#ifndef _MACH_VM_PROT_H_
#define _MACH_VM_PROT_H_
/*
* Types defined:
*
* vm_prot_t VM protection values.
*/
typedef int vm_prot_t;
/*
* Protection values, defined as bits within the vm_prot_t type
*/
#define VM_PROT_NONE ((vm_prot_t) 0x00)
#define VM_PROT_READ ((vm_prot_t) 0x01) /* read permission */
#define VM_PROT_WRITE ((vm_prot_t) 0x02) /* write permission */
#define VM_PROT_EXECUTE ((vm_prot_t) 0x04) /* execute permission */
/*
* The default protection for newly-created virtual memory
*/
#define VM_PROT_DEFAULT (VM_PROT_READ|VM_PROT_WRITE)
/*
* The maximum privileges possible, for parameter checking.
*/
#define VM_PROT_ALL (VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE)
/*
* An invalid protection value.
* Used only by memory_object_lock_request to indicate no change
* to page locks. Using -1 here is a bad idea because it
* looks like VM_PROT_ALL and then some.
*/
#define VM_PROT_NO_CHANGE ((vm_prot_t) 0x08)
/*
* When a caller finds that he cannot obtain write permission on a
* mapped entry, the following flag can be used. The entry will
* be made "needs copy" effectively copying the object (using COW),
* and write permission will be added to the maximum protections
* for the associated entry.
*/
#define VM_PROT_COPY ((vm_prot_t) 0x10)
/*
* Another invalid protection value.
* Used only by memory_object_data_request upon an object
* which has specified a copy_call copy strategy. It is used
* when the kernel wants a page belonging to a copy of the
* object, and is only asking the object as a result of
* following a shadow chain. This solves the race between pages
* being pushed up by the memory manager and the kernel
* walking down the shadow chain.
*/
#define VM_PROT_WANTS_COPY ((vm_prot_t) 0x10)
/*
* Another invalid protection value.
* Indicates that the other protection bits are to be applied as a mask
* against the actual protection bits of the map entry.
*/
#define VM_PROT_IS_MASK ((vm_prot_t) 0x40)
/*
* Another invalid protection value to support execute-only protection.
* VM_PROT_STRIP_READ is a special marker that tells mprotect to not
* set VM_PROT_READ. We have to do it this way because existing code
* expects the system to set VM_PROT_READ if VM_PROT_EXECUTE is set.
* VM_PROT_EXECUTE_ONLY is just a convenience value to indicate that
* the memory should be executable and explicitly not readable. It will
* be ignored on platforms that do not support this type of protection.
*/
#define VM_PROT_STRIP_READ ((vm_prot_t) 0x80)
#define VM_PROT_EXECUTE_ONLY (VM_PROT_EXECUTE|VM_PROT_STRIP_READ)
#endif /* _MACH_VM_PROT_H_ */

View File

@ -0,0 +1,34 @@
/*
* Copyright (c) 2003-2012 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#if !defined(OS_INLINE)
# if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
# define OS_INLINE static inline
# else
# define OS_INLINE static __inline__
# endif
#endif /* OS_INLINE */