mirror of
https://github.com/Karmaz95/Snake_Apple.git
synced 2026-05-15 16:47:58 +02:00
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
// MyBundle.c
|
||||
#include <stdio.h>
|
||||
|
||||
void sayHello() {
|
||||
printf("Hello from MyBundle!\n");
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main() {
|
||||
printf("Hello, World!\n");
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
#include <stdio.h>
|
||||
|
||||
void my_function() {
|
||||
printf("Hello from my_function!\n");
|
||||
}
|
||||
@@ -0,0 +1,374 @@
|
||||
// Extracted from Xcode 15 Beta 7
|
||||
// /Library/Developer/CommandLineTools/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/architecture/byte_order.h */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999-2002 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
|
||||
* Reserved. 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 1.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.apple.com/publicsource 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 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_
|
||||
|
||||
#include <libkern/OSByteOrder.h>
|
||||
|
||||
typedef unsigned long NXSwappedFloat;
|
||||
typedef unsigned long long NXSwappedDouble;
|
||||
|
||||
static __inline__
|
||||
unsigned short
|
||||
NXSwapShort(
|
||||
unsigned short inv
|
||||
)
|
||||
{
|
||||
return (unsigned short)OSSwapInt16((uint16_t)inv);
|
||||
}
|
||||
|
||||
static __inline__
|
||||
unsigned int
|
||||
NXSwapInt(
|
||||
unsigned int inv
|
||||
)
|
||||
{
|
||||
return (unsigned int)OSSwapInt32((uint32_t)inv);
|
||||
}
|
||||
|
||||
static __inline__
|
||||
unsigned long
|
||||
NXSwapLong(
|
||||
unsigned long inv
|
||||
)
|
||||
{
|
||||
return (unsigned long)OSSwapInt32((uint32_t)inv);
|
||||
}
|
||||
|
||||
static __inline__
|
||||
unsigned long long
|
||||
NXSwapLongLong(
|
||||
unsigned long long inv
|
||||
)
|
||||
{
|
||||
return (unsigned long long)OSSwapInt64((uint64_t)inv);
|
||||
}
|
||||
|
||||
static __inline__ NXSwappedFloat
|
||||
NXConvertHostFloatToSwapped(float x)
|
||||
{
|
||||
union fconv {
|
||||
float number;
|
||||
NXSwappedFloat sf;
|
||||
} u;
|
||||
u.number = x;
|
||||
return u.sf;
|
||||
}
|
||||
|
||||
static __inline__ float
|
||||
NXConvertSwappedFloatToHost(NXSwappedFloat x)
|
||||
{
|
||||
union fconv {
|
||||
float number;
|
||||
NXSwappedFloat sf;
|
||||
} u;
|
||||
u.sf = x;
|
||||
return u.number;
|
||||
}
|
||||
|
||||
static __inline__ NXSwappedDouble
|
||||
NXConvertHostDoubleToSwapped(double x)
|
||||
{
|
||||
union dconv {
|
||||
double number;
|
||||
NXSwappedDouble sd;
|
||||
} u;
|
||||
u.number = x;
|
||||
return u.sd;
|
||||
}
|
||||
|
||||
static __inline__ double
|
||||
NXConvertSwappedDoubleToHost(NXSwappedDouble x)
|
||||
{
|
||||
union dconv {
|
||||
double number;
|
||||
NXSwappedDouble sd;
|
||||
} u;
|
||||
u.sd = x;
|
||||
return u.number;
|
||||
}
|
||||
|
||||
static __inline__ NXSwappedFloat
|
||||
NXSwapFloat(NXSwappedFloat x)
|
||||
{
|
||||
return (NXSwappedFloat)OSSwapInt32((uint32_t)x);
|
||||
}
|
||||
|
||||
static __inline__ 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__
|
||||
unsigned short
|
||||
NXSwapBigShortToHost(
|
||||
unsigned short x
|
||||
)
|
||||
{
|
||||
return (unsigned short)OSSwapBigToHostInt16((uint16_t)x);
|
||||
}
|
||||
|
||||
static __inline__
|
||||
unsigned int
|
||||
NXSwapBigIntToHost(
|
||||
unsigned int x
|
||||
)
|
||||
{
|
||||
return (unsigned int)OSSwapBigToHostInt32((uint32_t)x);
|
||||
}
|
||||
|
||||
static __inline__
|
||||
unsigned long
|
||||
NXSwapBigLongToHost(
|
||||
unsigned long x
|
||||
)
|
||||
{
|
||||
return (unsigned long)OSSwapBigToHostInt32((uint32_t)x);
|
||||
}
|
||||
|
||||
static __inline__
|
||||
unsigned long long
|
||||
NXSwapBigLongLongToHost(
|
||||
unsigned long long x
|
||||
)
|
||||
{
|
||||
return (unsigned long long)OSSwapBigToHostInt64((uint64_t)x);
|
||||
}
|
||||
|
||||
static __inline__
|
||||
double
|
||||
NXSwapBigDoubleToHost(
|
||||
NXSwappedDouble x
|
||||
)
|
||||
{
|
||||
return NXConvertSwappedDoubleToHost((NXSwappedDouble)OSSwapBigToHostInt64((uint64_t)x));
|
||||
}
|
||||
|
||||
static __inline__
|
||||
float
|
||||
NXSwapBigFloatToHost(
|
||||
NXSwappedFloat x
|
||||
)
|
||||
{
|
||||
return NXConvertSwappedFloatToHost((NXSwappedFloat)OSSwapBigToHostInt32((uint32_t)x));
|
||||
}
|
||||
|
||||
static __inline__
|
||||
unsigned short
|
||||
NXSwapHostShortToBig(
|
||||
unsigned short x
|
||||
)
|
||||
{
|
||||
return (unsigned short)OSSwapHostToBigInt16((uint16_t)x);
|
||||
}
|
||||
|
||||
static __inline__
|
||||
unsigned int
|
||||
NXSwapHostIntToBig(
|
||||
unsigned int x
|
||||
)
|
||||
{
|
||||
return (unsigned int)OSSwapHostToBigInt32((uint32_t)x);
|
||||
}
|
||||
|
||||
static __inline__
|
||||
unsigned long
|
||||
NXSwapHostLongToBig(
|
||||
unsigned long x
|
||||
)
|
||||
{
|
||||
return (unsigned long)OSSwapHostToBigInt32((uint32_t)x);
|
||||
}
|
||||
|
||||
static __inline__
|
||||
unsigned long long
|
||||
NXSwapHostLongLongToBig(
|
||||
unsigned long long x
|
||||
)
|
||||
{
|
||||
return (unsigned long long)OSSwapHostToBigInt64((uint64_t)x);
|
||||
}
|
||||
|
||||
static __inline__
|
||||
NXSwappedDouble
|
||||
NXSwapHostDoubleToBig(
|
||||
double x
|
||||
)
|
||||
{
|
||||
return (NXSwappedDouble)OSSwapHostToBigInt64((uint64_t)NXConvertHostDoubleToSwapped(x));
|
||||
}
|
||||
|
||||
static __inline__
|
||||
NXSwappedFloat
|
||||
NXSwapHostFloatToBig(
|
||||
float x
|
||||
)
|
||||
{
|
||||
return (NXSwappedFloat)OSSwapHostToBigInt32((uint32_t)NXConvertHostFloatToSwapped(x));
|
||||
}
|
||||
|
||||
static __inline__
|
||||
unsigned short
|
||||
NXSwapLittleShortToHost(
|
||||
unsigned short x
|
||||
)
|
||||
{
|
||||
return (unsigned short)OSSwapLittleToHostInt16((uint16_t)x);
|
||||
}
|
||||
|
||||
static __inline__
|
||||
unsigned int
|
||||
NXSwapLittleIntToHost(
|
||||
unsigned int x
|
||||
)
|
||||
{
|
||||
return (unsigned int)OSSwapLittleToHostInt32((uint32_t)x);
|
||||
}
|
||||
|
||||
static __inline__
|
||||
unsigned long
|
||||
NXSwapLittleLongToHost(
|
||||
unsigned long x
|
||||
)
|
||||
{
|
||||
return (unsigned long)OSSwapLittleToHostInt32((uint32_t)x);
|
||||
}
|
||||
|
||||
static __inline__
|
||||
unsigned long long
|
||||
NXSwapLittleLongLongToHost(
|
||||
unsigned long long x
|
||||
)
|
||||
{
|
||||
return (unsigned long long)OSSwapLittleToHostInt64((uint64_t)x);
|
||||
}
|
||||
|
||||
static __inline__
|
||||
double
|
||||
NXSwapLittleDoubleToHost(
|
||||
NXSwappedDouble x
|
||||
)
|
||||
{
|
||||
return NXConvertSwappedDoubleToHost((NXSwappedDouble)OSSwapLittleToHostInt64((uint64_t)x));
|
||||
}
|
||||
|
||||
static __inline__
|
||||
float
|
||||
NXSwapLittleFloatToHost(
|
||||
NXSwappedFloat x
|
||||
)
|
||||
{
|
||||
return NXConvertSwappedFloatToHost((NXSwappedFloat)OSSwapLittleToHostInt32((uint32_t)x));
|
||||
}
|
||||
|
||||
static __inline__
|
||||
unsigned short
|
||||
NXSwapHostShortToLittle(
|
||||
unsigned short x
|
||||
)
|
||||
{
|
||||
return (unsigned short)OSSwapHostToLittleInt16((uint16_t)x);
|
||||
}
|
||||
|
||||
static __inline__
|
||||
unsigned int
|
||||
NXSwapHostIntToLittle(
|
||||
unsigned int x
|
||||
)
|
||||
{
|
||||
return (unsigned int)OSSwapHostToLittleInt32((uint32_t)x);
|
||||
}
|
||||
|
||||
static __inline__
|
||||
unsigned long
|
||||
NXSwapHostLongToLittle(
|
||||
unsigned long x
|
||||
)
|
||||
{
|
||||
return (unsigned long)OSSwapHostToLittleInt32((uint32_t)x);
|
||||
}
|
||||
|
||||
static __inline__
|
||||
unsigned long long
|
||||
NXSwapHostLongLongToLittle(
|
||||
unsigned long long x
|
||||
)
|
||||
{
|
||||
return (unsigned long long)OSSwapHostToLittleInt64((uint64_t)x);
|
||||
}
|
||||
|
||||
static __inline__
|
||||
NXSwappedDouble
|
||||
NXSwapHostDoubleToLittle(
|
||||
double x
|
||||
)
|
||||
{
|
||||
return (NXSwappedDouble)OSSwapHostToLittleInt64((uint64_t)NXConvertHostDoubleToSwapped(x));
|
||||
}
|
||||
|
||||
static __inline__
|
||||
NXSwappedFloat
|
||||
NXSwapHostFloatToLittle(
|
||||
float x
|
||||
)
|
||||
{
|
||||
return (NXSwappedFloat)OSSwapHostToLittleInt32((uint32_t)NXConvertHostFloatToSwapped(x));
|
||||
}
|
||||
|
||||
#endif /* _ARCHITECTURE_BYTE_ORDER_H_ */
|
||||
@@ -0,0 +1,67 @@
|
||||
// Extracted from Xcode 15 Beta 7
|
||||
// /Library/Developer/CommandLineTools/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/mach-o/fat.h */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999 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@
|
||||
*/
|
||||
#ifndef _MACH_O_FAT_H_
|
||||
#define _MACH_O_FAT_H_
|
||||
/*
|
||||
* This header file describes the structures of the file format for "fat"
|
||||
* architecture specific file (wrapper design). At the begining of the file
|
||||
* there is one fat_header structure followed by a number of fat_arch
|
||||
* structures. For each architecture in the file, specified by a pair of
|
||||
* cputype and cpusubtype, the fat_header describes the file offset, file
|
||||
* size and alignment in the file of the architecture specific member.
|
||||
* The padded bytes in the file to place each member on it's specific alignment
|
||||
* are defined to be read as zeros and can be left as "holes" if the file system
|
||||
* can support them as long as they read as zeros.
|
||||
*
|
||||
* All structures defined here are always written and read to/from disk
|
||||
* in big-endian order.
|
||||
*/
|
||||
|
||||
/*
|
||||
* <mach/machine.h> is needed here for the cpu_type_t and cpu_subtype_t types
|
||||
* and contains the constants for the possible values of these types.
|
||||
*/
|
||||
#include <stdint.h>
|
||||
#include <mach/machine.h>
|
||||
#include <architecture/byte_order.h>
|
||||
|
||||
#define FAT_MAGIC 0xcafebabe
|
||||
#define FAT_CIGAM 0xbebafeca /* NXSwapLong(FAT_MAGIC) */
|
||||
|
||||
struct fat_header {
|
||||
uint32_t magic; /* FAT_MAGIC */
|
||||
uint32_t nfat_arch; /* number of structs that follow */
|
||||
};
|
||||
|
||||
struct fat_arch {
|
||||
cpu_type_t cputype; /* cpu specifier (int) */
|
||||
cpu_subtype_t cpusubtype; /* machine specifier (int) */
|
||||
uint32_t offset; /* file offset to this object file */
|
||||
uint32_t size; /* size of this object file */
|
||||
uint32_t align; /* alignment as a power of 2 */
|
||||
};
|
||||
|
||||
#endif /* _MACH_O_FAT_H_ */
|
||||
@@ -0,0 +1,259 @@
|
||||
// Extracted from Xcode 15 Beta 7
|
||||
// /Library/Developer/CommandLineTools/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/mach-o/fixup-chains.h */
|
||||
/* -*- mode: C++; c-basic-offset: 4; tab-width: 4 -*-
|
||||
*
|
||||
* Copyright (c) 2018 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_FIXUP_CHAINS__
|
||||
#define __MACH_O_FIXUP_CHAINS__ 5
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
//#define LC_DYLD_EXPORTS_TRIE 0x80000033 // used with linkedit_data_command
|
||||
//#define LC_DYLD_CHAINED_FIXUPS 0x80000034 // used with linkedit_data_command, payload is dyld_chained_fixups_header
|
||||
|
||||
|
||||
// header of the LC_DYLD_CHAINED_FIXUPS payload
|
||||
struct dyld_chained_fixups_header
|
||||
{
|
||||
uint32_t fixups_version; // 0
|
||||
uint32_t starts_offset; // offset of dyld_chained_starts_in_image in chain_data
|
||||
uint32_t imports_offset; // offset of imports table in chain_data
|
||||
uint32_t symbols_offset; // offset of symbol strings in chain_data
|
||||
uint32_t imports_count; // number of imported symbol names
|
||||
uint32_t imports_format; // DYLD_CHAINED_IMPORT*
|
||||
uint32_t symbols_format; // 0 => uncompressed, 1 => zlib compressed
|
||||
};
|
||||
|
||||
// This struct is embedded in LC_DYLD_CHAINED_FIXUPS payload
|
||||
struct dyld_chained_starts_in_image
|
||||
{
|
||||
uint32_t seg_count;
|
||||
uint32_t seg_info_offset[1]; // each entry is offset into this struct for that segment
|
||||
// followed by pool of dyld_chain_starts_in_segment data
|
||||
};
|
||||
|
||||
// This struct is embedded in dyld_chain_starts_in_image
|
||||
// and passed down to the kernel for page-in linking
|
||||
struct dyld_chained_starts_in_segment
|
||||
{
|
||||
uint32_t size; // size of this (amount kernel needs to copy)
|
||||
uint16_t page_size; // 0x1000 or 0x4000
|
||||
uint16_t pointer_format; // DYLD_CHAINED_PTR_*
|
||||
uint64_t segment_offset; // offset in memory to start of segment
|
||||
uint32_t max_valid_pointer; // for 32-bit OS, any value beyond this is not a pointer
|
||||
uint16_t page_count; // how many pages are in array
|
||||
uint16_t page_start[1]; // each entry is offset in each page of first element in chain
|
||||
// or DYLD_CHAINED_PTR_START_NONE if no fixups on page
|
||||
// uint16_t chain_starts[1]; // some 32-bit formats may require multiple starts per page.
|
||||
// for those, if high bit is set in page_starts[], then it
|
||||
// is index into chain_starts[] which is a list of starts
|
||||
// the last of which has the high bit set
|
||||
};
|
||||
|
||||
enum {
|
||||
DYLD_CHAINED_PTR_START_NONE = 0xFFFF, // used in page_start[] to denote a page with no fixups
|
||||
DYLD_CHAINED_PTR_START_MULTI = 0x8000, // used in page_start[] to denote a page which has multiple starts
|
||||
DYLD_CHAINED_PTR_START_LAST = 0x8000, // used in chain_starts[] to denote last start in list for page
|
||||
};
|
||||
|
||||
// This struct is embedded in __TEXT,__chain_starts section in firmware
|
||||
struct dyld_chained_starts_offsets
|
||||
{
|
||||
uint32_t pointer_format; // DYLD_CHAINED_PTR_32_FIRMWARE
|
||||
uint32_t starts_count; // number of starts in array
|
||||
uint32_t chain_starts[1]; // array chain start offsets
|
||||
};
|
||||
|
||||
|
||||
// values for dyld_chained_starts_in_segment.pointer_format
|
||||
enum {
|
||||
DYLD_CHAINED_PTR_ARM64E = 1, // stride 8, unauth target is vmaddr
|
||||
DYLD_CHAINED_PTR_64 = 2, // target is vmaddr
|
||||
DYLD_CHAINED_PTR_32 = 3,
|
||||
DYLD_CHAINED_PTR_32_CACHE = 4,
|
||||
DYLD_CHAINED_PTR_32_FIRMWARE = 5,
|
||||
DYLD_CHAINED_PTR_64_OFFSET = 6, // target is vm offset
|
||||
DYLD_CHAINED_PTR_ARM64E_OFFSET = 7, // old name
|
||||
DYLD_CHAINED_PTR_ARM64E_KERNEL = 7, // stride 4, unauth target is vm offset
|
||||
DYLD_CHAINED_PTR_64_KERNEL_CACHE = 8,
|
||||
DYLD_CHAINED_PTR_ARM64E_USERLAND = 9, // stride 8, unauth target is vm offset
|
||||
DYLD_CHAINED_PTR_ARM64E_FIRMWARE = 10, // stride 4, unauth target is vmaddr
|
||||
DYLD_CHAINED_PTR_X86_64_KERNEL_CACHE = 11, // stride 1, x86_64 kernel caches
|
||||
DYLD_CHAINED_PTR_ARM64E_USERLAND24 = 12, // stride 8, unauth target is vm offset, 24-bit bind
|
||||
};
|
||||
|
||||
|
||||
// DYLD_CHAINED_PTR_ARM64E
|
||||
struct dyld_chained_ptr_arm64e_rebase
|
||||
{
|
||||
uint64_t target : 43,
|
||||
high8 : 8,
|
||||
next : 11, // 4 or 8-byte stide
|
||||
bind : 1, // == 0
|
||||
auth : 1; // == 0
|
||||
};
|
||||
|
||||
// DYLD_CHAINED_PTR_ARM64E
|
||||
struct dyld_chained_ptr_arm64e_bind
|
||||
{
|
||||
uint64_t ordinal : 16,
|
||||
zero : 16,
|
||||
addend : 19, // +/-256K
|
||||
next : 11, // 4 or 8-byte stide
|
||||
bind : 1, // == 1
|
||||
auth : 1; // == 0
|
||||
};
|
||||
|
||||
// DYLD_CHAINED_PTR_ARM64E
|
||||
struct dyld_chained_ptr_arm64e_auth_rebase
|
||||
{
|
||||
uint64_t target : 32, // runtimeOffset
|
||||
diversity : 16,
|
||||
addrDiv : 1,
|
||||
key : 2,
|
||||
next : 11, // 4 or 8-byte stide
|
||||
bind : 1, // == 0
|
||||
auth : 1; // == 1
|
||||
};
|
||||
|
||||
// DYLD_CHAINED_PTR_ARM64E
|
||||
struct dyld_chained_ptr_arm64e_auth_bind
|
||||
{
|
||||
uint64_t ordinal : 16,
|
||||
zero : 16,
|
||||
diversity : 16,
|
||||
addrDiv : 1,
|
||||
key : 2,
|
||||
next : 11, // 4 or 8-byte stide
|
||||
bind : 1, // == 1
|
||||
auth : 1; // == 1
|
||||
};
|
||||
|
||||
// DYLD_CHAINED_PTR_64/DYLD_CHAINED_PTR_64_OFFSET
|
||||
struct dyld_chained_ptr_64_rebase
|
||||
{
|
||||
uint64_t target : 36, // 64GB max image size (DYLD_CHAINED_PTR_64 => vmAddr, DYLD_CHAINED_PTR_64_OFFSET => runtimeOffset)
|
||||
high8 : 8, // top 8 bits set to this (DYLD_CHAINED_PTR_64 => after slide added, DYLD_CHAINED_PTR_64_OFFSET => before slide added)
|
||||
reserved : 7, // all zeros
|
||||
next : 12, // 4-byte stride
|
||||
bind : 1; // == 0
|
||||
};
|
||||
|
||||
// DYLD_CHAINED_PTR_64
|
||||
struct dyld_chained_ptr_64_bind
|
||||
{
|
||||
uint64_t ordinal : 24,
|
||||
addend : 8, // 0 thru 255
|
||||
reserved : 19, // all zeros
|
||||
next : 12, // 4-byte stride
|
||||
bind : 1; // == 1
|
||||
};
|
||||
|
||||
// DYLD_CHAINED_PTR_64_KERNEL_CACHE, DYLD_CHAINED_PTR_X86_64_KERNEL_CACHE
|
||||
struct dyld_chained_ptr_64_kernel_cache_rebase
|
||||
{
|
||||
uint64_t target : 30, // basePointers[cacheLevel] + target
|
||||
cacheLevel : 2, // what level of cache to bind to (indexes a mach_header array)
|
||||
diversity : 16,
|
||||
addrDiv : 1,
|
||||
key : 2,
|
||||
next : 12, // 1 or 4-byte stide
|
||||
isAuth : 1; // 0 -> not authenticated. 1 -> authenticated
|
||||
};
|
||||
|
||||
// DYLD_CHAINED_PTR_32
|
||||
// Note: for DYLD_CHAINED_PTR_32 some non-pointer values are co-opted into the chain
|
||||
// as out of range rebases. If an entry in the chain is > max_valid_pointer, then it
|
||||
// is not a pointer. To restore the value, subtract off the bias, which is
|
||||
// (64MB+max_valid_pointer)/2.
|
||||
struct dyld_chained_ptr_32_rebase
|
||||
{
|
||||
uint32_t target : 26, // vmaddr, 64MB max image size
|
||||
next : 5, // 4-byte stride
|
||||
bind : 1; // == 0
|
||||
};
|
||||
|
||||
// DYLD_CHAINED_PTR_32
|
||||
struct dyld_chained_ptr_32_bind
|
||||
{
|
||||
uint32_t ordinal : 20,
|
||||
addend : 6, // 0 thru 63
|
||||
next : 5, // 4-byte stride
|
||||
bind : 1; // == 1
|
||||
};
|
||||
|
||||
// DYLD_CHAINED_PTR_32_CACHE
|
||||
struct dyld_chained_ptr_32_cache_rebase
|
||||
{
|
||||
uint32_t target : 30, // 1GB max dyld cache TEXT and DATA
|
||||
next : 2; // 4-byte stride
|
||||
};
|
||||
|
||||
|
||||
// DYLD_CHAINED_PTR_32_FIRMWARE
|
||||
struct dyld_chained_ptr_32_firmware_rebase
|
||||
{
|
||||
uint32_t target : 26, // 64MB max firmware TEXT and DATA
|
||||
next : 6; // 4-byte stride
|
||||
};
|
||||
|
||||
|
||||
|
||||
// values for dyld_chained_fixups_header.imports_format
|
||||
enum {
|
||||
DYLD_CHAINED_IMPORT = 1,
|
||||
DYLD_CHAINED_IMPORT_ADDEND = 2,
|
||||
DYLD_CHAINED_IMPORT_ADDEND64 = 3,
|
||||
};
|
||||
|
||||
// DYLD_CHAINED_IMPORT
|
||||
struct dyld_chained_import
|
||||
{
|
||||
uint32_t lib_ordinal : 8,
|
||||
weak_import : 1,
|
||||
name_offset : 23;
|
||||
};
|
||||
|
||||
// DYLD_CHAINED_IMPORT_ADDEND
|
||||
struct dyld_chained_import_addend
|
||||
{
|
||||
uint32_t lib_ordinal : 8,
|
||||
weak_import : 1,
|
||||
name_offset : 23;
|
||||
int32_t addend;
|
||||
};
|
||||
|
||||
// DYLD_CHAINED_IMPORT_ADDEND64
|
||||
struct dyld_chained_import_addend64
|
||||
{
|
||||
uint64_t lib_ordinal : 16,
|
||||
weak_import : 1,
|
||||
reserved : 15,
|
||||
name_offset : 32;
|
||||
uint64_t addend;
|
||||
};
|
||||
|
||||
#endif // __MACH_O_FIXUP_CHAINS__
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,416 @@
|
||||
// Extracted from Xcode 15 Beta 7
|
||||
/* /Library/Developer/CommandLineTools/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/mach/machine.h */
|
||||
/*
|
||||
* Copyright (c) 2007-2016 Apple, Inc. All rights reserved.
|
||||
* Copyright (c) 2000 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@
|
||||
*/
|
||||
/*
|
||||
* 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: machine.h
|
||||
* Author: Avadis Tevanian, Jr.
|
||||
* Date: 1986
|
||||
*
|
||||
* Machine independent machine abstraction.
|
||||
*/
|
||||
|
||||
#ifndef _MACH_MACHINE_H_
|
||||
#define _MACH_MACHINE_H_
|
||||
|
||||
#ifndef __ASSEMBLER__
|
||||
|
||||
#include <stdint.h>
|
||||
#include <mach/machine/vm_types.h>
|
||||
#include <mach/boolean.h>
|
||||
|
||||
typedef integer_t cpu_type_t;
|
||||
typedef integer_t cpu_subtype_t;
|
||||
typedef integer_t cpu_threadtype_t;
|
||||
|
||||
#define CPU_STATE_MAX 4
|
||||
|
||||
#define CPU_STATE_USER 0
|
||||
#define CPU_STATE_SYSTEM 1
|
||||
#define CPU_STATE_IDLE 2
|
||||
#define CPU_STATE_NICE 3
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Capability bits used in the definition of cpu_type.
|
||||
*/
|
||||
#define CPU_ARCH_MASK 0xff000000 /* mask for architecture bits */
|
||||
#define CPU_ARCH_ABI64 0x01000000 /* 64 bit ABI */
|
||||
#define CPU_ARCH_ABI64_32 0x02000000 /* ABI for 64-bit hardware with 32-bit types; LP32 */
|
||||
|
||||
/*
|
||||
* Machine types known by all.
|
||||
*/
|
||||
|
||||
#define CPU_TYPE_ANY ((cpu_type_t) -1)
|
||||
|
||||
#define CPU_TYPE_VAX ((cpu_type_t) 1)
|
||||
/* skip ((cpu_type_t) 2) */
|
||||
/* skip ((cpu_type_t) 3) */
|
||||
/* skip ((cpu_type_t) 4) */
|
||||
/* skip ((cpu_type_t) 5) */
|
||||
#define CPU_TYPE_MC680x0 ((cpu_type_t) 6)
|
||||
#define CPU_TYPE_X86 ((cpu_type_t) 7)
|
||||
#define CPU_TYPE_I386 CPU_TYPE_X86 /* compatibility */
|
||||
#define CPU_TYPE_X86_64 (CPU_TYPE_X86 | CPU_ARCH_ABI64)
|
||||
|
||||
/* skip CPU_TYPE_MIPS ((cpu_type_t) 8) */
|
||||
/* skip ((cpu_type_t) 9) */
|
||||
#define CPU_TYPE_MC98000 ((cpu_type_t) 10)
|
||||
#define CPU_TYPE_HPPA ((cpu_type_t) 11)
|
||||
#define CPU_TYPE_ARM ((cpu_type_t) 12)
|
||||
#define CPU_TYPE_ARM64 (CPU_TYPE_ARM | CPU_ARCH_ABI64)
|
||||
#define CPU_TYPE_ARM64_32 (CPU_TYPE_ARM | CPU_ARCH_ABI64_32)
|
||||
#define CPU_TYPE_MC88000 ((cpu_type_t) 13)
|
||||
#define CPU_TYPE_SPARC ((cpu_type_t) 14)
|
||||
#define CPU_TYPE_I860 ((cpu_type_t) 15)
|
||||
/* skip CPU_TYPE_ALPHA ((cpu_type_t) 16) */
|
||||
/* skip ((cpu_type_t) 17) */
|
||||
#define CPU_TYPE_POWERPC ((cpu_type_t) 18)
|
||||
#define CPU_TYPE_POWERPC64 (CPU_TYPE_POWERPC | CPU_ARCH_ABI64)
|
||||
/* skip ((cpu_type_t) 19) */
|
||||
/* skip ((cpu_type_t) 20 */
|
||||
/* skip ((cpu_type_t) 21 */
|
||||
/* skip ((cpu_type_t) 22 */
|
||||
/* skip ((cpu_type_t) 23 */
|
||||
|
||||
/*
|
||||
* Machine subtypes (these are defined here, instead of in a machine
|
||||
* dependent directory, so that any program can get all definitions
|
||||
* regardless of where is it compiled).
|
||||
*/
|
||||
|
||||
/*
|
||||
* Capability bits used in the definition of cpu_subtype.
|
||||
*/
|
||||
#define CPU_SUBTYPE_MASK 0xff000000 /* mask for feature flags */
|
||||
#define CPU_SUBTYPE_LIB64 0x80000000 /* 64 bit libraries */
|
||||
#define CPU_SUBTYPE_PTRAUTH_ABI 0x80000000 /* pointer authentication with versioned ABI */
|
||||
|
||||
/*
|
||||
* When selecting a slice, ANY will pick the slice with the best
|
||||
* grading for the selected cpu_type_t, unlike the "ALL" subtypes,
|
||||
* which are the slices that can run on any hardware for that cpu type.
|
||||
*/
|
||||
#define CPU_SUBTYPE_ANY ((cpu_subtype_t) -1)
|
||||
|
||||
/*
|
||||
* Object files that are hand-crafted to run on any
|
||||
* implementation of an architecture are tagged with
|
||||
* CPU_SUBTYPE_MULTIPLE. This functions essentially the same as
|
||||
* the "ALL" subtype of an architecture except that it allows us
|
||||
* to easily find object files that may need to be modified
|
||||
* whenever a new implementation of an architecture comes out.
|
||||
*
|
||||
* It is the responsibility of the implementor to make sure the
|
||||
* software handles unsupported implementations elegantly.
|
||||
*/
|
||||
#define CPU_SUBTYPE_MULTIPLE ((cpu_subtype_t) -1)
|
||||
#define CPU_SUBTYPE_LITTLE_ENDIAN ((cpu_subtype_t) 0)
|
||||
#define CPU_SUBTYPE_BIG_ENDIAN ((cpu_subtype_t) 1)
|
||||
|
||||
/*
|
||||
* Machine threadtypes.
|
||||
* This is none - not defined - for most machine types/subtypes.
|
||||
*/
|
||||
#define CPU_THREADTYPE_NONE ((cpu_threadtype_t) 0)
|
||||
|
||||
/*
|
||||
* VAX subtypes (these do *not* necessary conform to the actual cpu
|
||||
* ID assigned by DEC available via the SID register).
|
||||
*/
|
||||
|
||||
#define CPU_SUBTYPE_VAX_ALL ((cpu_subtype_t) 0)
|
||||
#define CPU_SUBTYPE_VAX780 ((cpu_subtype_t) 1)
|
||||
#define CPU_SUBTYPE_VAX785 ((cpu_subtype_t) 2)
|
||||
#define CPU_SUBTYPE_VAX750 ((cpu_subtype_t) 3)
|
||||
#define CPU_SUBTYPE_VAX730 ((cpu_subtype_t) 4)
|
||||
#define CPU_SUBTYPE_UVAXI ((cpu_subtype_t) 5)
|
||||
#define CPU_SUBTYPE_UVAXII ((cpu_subtype_t) 6)
|
||||
#define CPU_SUBTYPE_VAX8200 ((cpu_subtype_t) 7)
|
||||
#define CPU_SUBTYPE_VAX8500 ((cpu_subtype_t) 8)
|
||||
#define CPU_SUBTYPE_VAX8600 ((cpu_subtype_t) 9)
|
||||
#define CPU_SUBTYPE_VAX8650 ((cpu_subtype_t) 10)
|
||||
#define CPU_SUBTYPE_VAX8800 ((cpu_subtype_t) 11)
|
||||
#define CPU_SUBTYPE_UVAXIII ((cpu_subtype_t) 12)
|
||||
|
||||
/*
|
||||
* 680x0 subtypes
|
||||
*
|
||||
* The subtype definitions here are unusual for historical reasons.
|
||||
* NeXT used to consider 68030 code as generic 68000 code. For
|
||||
* backwards compatability:
|
||||
*
|
||||
* CPU_SUBTYPE_MC68030 symbol has been preserved for source code
|
||||
* compatability.
|
||||
*
|
||||
* CPU_SUBTYPE_MC680x0_ALL has been defined to be the same
|
||||
* subtype as CPU_SUBTYPE_MC68030 for binary comatability.
|
||||
*
|
||||
* CPU_SUBTYPE_MC68030_ONLY has been added to allow new object
|
||||
* files to be tagged as containing 68030-specific instructions.
|
||||
*/
|
||||
|
||||
#define CPU_SUBTYPE_MC680x0_ALL ((cpu_subtype_t) 1)
|
||||
#define CPU_SUBTYPE_MC68030 ((cpu_subtype_t) 1) /* compat */
|
||||
#define CPU_SUBTYPE_MC68040 ((cpu_subtype_t) 2)
|
||||
#define CPU_SUBTYPE_MC68030_ONLY ((cpu_subtype_t) 3)
|
||||
|
||||
/*
|
||||
* I386 subtypes
|
||||
*/
|
||||
|
||||
#define CPU_SUBTYPE_INTEL(f, m) ((cpu_subtype_t) (f) + ((m) << 4))
|
||||
|
||||
#define CPU_SUBTYPE_I386_ALL CPU_SUBTYPE_INTEL(3, 0)
|
||||
#define CPU_SUBTYPE_386 CPU_SUBTYPE_INTEL(3, 0)
|
||||
#define CPU_SUBTYPE_486 CPU_SUBTYPE_INTEL(4, 0)
|
||||
#define CPU_SUBTYPE_486SX CPU_SUBTYPE_INTEL(4, 8) // 8 << 4 = 128
|
||||
#define CPU_SUBTYPE_586 CPU_SUBTYPE_INTEL(5, 0)
|
||||
#define CPU_SUBTYPE_PENT CPU_SUBTYPE_INTEL(5, 0)
|
||||
#define CPU_SUBTYPE_PENTPRO CPU_SUBTYPE_INTEL(6, 1)
|
||||
#define CPU_SUBTYPE_PENTII_M3 CPU_SUBTYPE_INTEL(6, 3)
|
||||
#define CPU_SUBTYPE_PENTII_M5 CPU_SUBTYPE_INTEL(6, 5)
|
||||
#define CPU_SUBTYPE_CELERON CPU_SUBTYPE_INTEL(7, 6)
|
||||
#define CPU_SUBTYPE_CELERON_MOBILE CPU_SUBTYPE_INTEL(7, 7)
|
||||
#define CPU_SUBTYPE_PENTIUM_3 CPU_SUBTYPE_INTEL(8, 0)
|
||||
#define CPU_SUBTYPE_PENTIUM_3_M CPU_SUBTYPE_INTEL(8, 1)
|
||||
#define CPU_SUBTYPE_PENTIUM_3_XEON CPU_SUBTYPE_INTEL(8, 2)
|
||||
#define CPU_SUBTYPE_PENTIUM_M CPU_SUBTYPE_INTEL(9, 0)
|
||||
#define CPU_SUBTYPE_PENTIUM_4 CPU_SUBTYPE_INTEL(10, 0)
|
||||
#define CPU_SUBTYPE_PENTIUM_4_M CPU_SUBTYPE_INTEL(10, 1)
|
||||
#define CPU_SUBTYPE_ITANIUM CPU_SUBTYPE_INTEL(11, 0)
|
||||
#define CPU_SUBTYPE_ITANIUM_2 CPU_SUBTYPE_INTEL(11, 1)
|
||||
#define CPU_SUBTYPE_XEON CPU_SUBTYPE_INTEL(12, 0)
|
||||
#define CPU_SUBTYPE_XEON_MP CPU_SUBTYPE_INTEL(12, 1)
|
||||
|
||||
#define CPU_SUBTYPE_INTEL_FAMILY(x) ((x) & 15)
|
||||
#define CPU_SUBTYPE_INTEL_FAMILY_MAX 15
|
||||
|
||||
#define CPU_SUBTYPE_INTEL_MODEL(x) ((x) >> 4)
|
||||
#define CPU_SUBTYPE_INTEL_MODEL_ALL 0
|
||||
|
||||
/*
|
||||
* X86 subtypes.
|
||||
*/
|
||||
|
||||
#define CPU_SUBTYPE_X86_ALL ((cpu_subtype_t)3)
|
||||
#define CPU_SUBTYPE_X86_64_ALL ((cpu_subtype_t)3)
|
||||
#define CPU_SUBTYPE_X86_ARCH1 ((cpu_subtype_t)4)
|
||||
#define CPU_SUBTYPE_X86_64_H ((cpu_subtype_t)8) /* Haswell feature subset */
|
||||
|
||||
|
||||
#define CPU_THREADTYPE_INTEL_HTT ((cpu_threadtype_t) 1)
|
||||
|
||||
/*
|
||||
* Mips subtypes.
|
||||
*/
|
||||
|
||||
#define CPU_SUBTYPE_MIPS_ALL ((cpu_subtype_t) 0)
|
||||
#define CPU_SUBTYPE_MIPS_R2300 ((cpu_subtype_t) 1)
|
||||
#define CPU_SUBTYPE_MIPS_R2600 ((cpu_subtype_t) 2)
|
||||
#define CPU_SUBTYPE_MIPS_R2800 ((cpu_subtype_t) 3)
|
||||
#define CPU_SUBTYPE_MIPS_R2000a ((cpu_subtype_t) 4) /* pmax */
|
||||
#define CPU_SUBTYPE_MIPS_R2000 ((cpu_subtype_t) 5)
|
||||
#define CPU_SUBTYPE_MIPS_R3000a ((cpu_subtype_t) 6) /* 3max */
|
||||
#define CPU_SUBTYPE_MIPS_R3000 ((cpu_subtype_t) 7)
|
||||
|
||||
/*
|
||||
* MC98000 (PowerPC) subtypes
|
||||
*/
|
||||
#define CPU_SUBTYPE_MC98000_ALL ((cpu_subtype_t) 0)
|
||||
#define CPU_SUBTYPE_MC98601 ((cpu_subtype_t) 1)
|
||||
|
||||
/*
|
||||
* HPPA subtypes for Hewlett-Packard HP-PA family of
|
||||
* risc processors. Port by NeXT to 700 series.
|
||||
*/
|
||||
|
||||
#define CPU_SUBTYPE_HPPA_ALL ((cpu_subtype_t) 0)
|
||||
#define CPU_SUBTYPE_HPPA_7100 ((cpu_subtype_t) 0) /* compat */
|
||||
#define CPU_SUBTYPE_HPPA_7100LC ((cpu_subtype_t) 1)
|
||||
|
||||
/*
|
||||
* MC88000 subtypes.
|
||||
*/
|
||||
#define CPU_SUBTYPE_MC88000_ALL ((cpu_subtype_t) 0)
|
||||
#define CPU_SUBTYPE_MC88100 ((cpu_subtype_t) 1)
|
||||
#define CPU_SUBTYPE_MC88110 ((cpu_subtype_t) 2)
|
||||
|
||||
/*
|
||||
* SPARC subtypes
|
||||
*/
|
||||
#define CPU_SUBTYPE_SPARC_ALL ((cpu_subtype_t) 0)
|
||||
|
||||
/*
|
||||
* I860 subtypes
|
||||
*/
|
||||
#define CPU_SUBTYPE_I860_ALL ((cpu_subtype_t) 0)
|
||||
#define CPU_SUBTYPE_I860_860 ((cpu_subtype_t) 1)
|
||||
|
||||
/*
|
||||
* PowerPC subtypes
|
||||
*/
|
||||
#define CPU_SUBTYPE_POWERPC_ALL ((cpu_subtype_t) 0)
|
||||
#define CPU_SUBTYPE_POWERPC_601 ((cpu_subtype_t) 1)
|
||||
#define CPU_SUBTYPE_POWERPC_602 ((cpu_subtype_t) 2)
|
||||
#define CPU_SUBTYPE_POWERPC_603 ((cpu_subtype_t) 3)
|
||||
#define CPU_SUBTYPE_POWERPC_603e ((cpu_subtype_t) 4)
|
||||
#define CPU_SUBTYPE_POWERPC_603ev ((cpu_subtype_t) 5)
|
||||
#define CPU_SUBTYPE_POWERPC_604 ((cpu_subtype_t) 6)
|
||||
#define CPU_SUBTYPE_POWERPC_604e ((cpu_subtype_t) 7)
|
||||
#define CPU_SUBTYPE_POWERPC_620 ((cpu_subtype_t) 8)
|
||||
#define CPU_SUBTYPE_POWERPC_750 ((cpu_subtype_t) 9)
|
||||
#define CPU_SUBTYPE_POWERPC_7400 ((cpu_subtype_t) 10)
|
||||
#define CPU_SUBTYPE_POWERPC_7450 ((cpu_subtype_t) 11)
|
||||
#define CPU_SUBTYPE_POWERPC_970 ((cpu_subtype_t) 100)
|
||||
|
||||
/*
|
||||
* ARM subtypes
|
||||
*/
|
||||
#define CPU_SUBTYPE_ARM_ALL ((cpu_subtype_t) 0)
|
||||
#define CPU_SUBTYPE_ARM_V4T ((cpu_subtype_t) 5)
|
||||
#define CPU_SUBTYPE_ARM_V6 ((cpu_subtype_t) 6)
|
||||
#define CPU_SUBTYPE_ARM_V5TEJ ((cpu_subtype_t) 7)
|
||||
#define CPU_SUBTYPE_ARM_XSCALE ((cpu_subtype_t) 8)
|
||||
#define CPU_SUBTYPE_ARM_V7 ((cpu_subtype_t) 9) /* ARMv7-A and ARMv7-R */
|
||||
#define CPU_SUBTYPE_ARM_V7F ((cpu_subtype_t) 10) /* Cortex A9 */
|
||||
#define CPU_SUBTYPE_ARM_V7S ((cpu_subtype_t) 11) /* Swift */
|
||||
#define CPU_SUBTYPE_ARM_V7K ((cpu_subtype_t) 12)
|
||||
#define CPU_SUBTYPE_ARM_V8 ((cpu_subtype_t) 13)
|
||||
#define CPU_SUBTYPE_ARM_V6M ((cpu_subtype_t) 14) /* Not meant to be run under xnu */
|
||||
#define CPU_SUBTYPE_ARM_V7M ((cpu_subtype_t) 15) /* Not meant to be run under xnu */
|
||||
#define CPU_SUBTYPE_ARM_V7EM ((cpu_subtype_t) 16) /* Not meant to be run under xnu */
|
||||
#define CPU_SUBTYPE_ARM_V8M ((cpu_subtype_t) 17) /* Not meant to be run under xnu */
|
||||
|
||||
/*
|
||||
* ARM64 subtypes
|
||||
*/
|
||||
#define CPU_SUBTYPE_ARM64_ALL ((cpu_subtype_t) 0)
|
||||
#define CPU_SUBTYPE_ARM64_V8 ((cpu_subtype_t) 1)
|
||||
#define CPU_SUBTYPE_ARM64E ((cpu_subtype_t) 2)
|
||||
|
||||
/* CPU subtype feature flags for ptrauth on arm64e platforms */
|
||||
#define CPU_SUBTYPE_ARM64_PTR_AUTH_MASK 0x0f000000
|
||||
#define CPU_SUBTYPE_ARM64_PTR_AUTH_VERSION(x) (((x) & CPU_SUBTYPE_ARM64_PTR_AUTH_MASK) >> 24)
|
||||
|
||||
/*
|
||||
* ARM64_32 subtypes
|
||||
*/
|
||||
#define CPU_SUBTYPE_ARM64_32_ALL ((cpu_subtype_t) 0)
|
||||
#define CPU_SUBTYPE_ARM64_32_V8 ((cpu_subtype_t) 1)
|
||||
|
||||
#endif /* !__ASSEMBLER__ */
|
||||
|
||||
/*
|
||||
* CPU families (sysctl hw.cpufamily)
|
||||
*
|
||||
* These are meant to identify the CPU's marketing name - an
|
||||
* application can map these to (possibly) localized strings.
|
||||
* NB: the encodings of the CPU families are intentionally arbitrary.
|
||||
* There is no ordering, and you should never try to deduce whether
|
||||
* or not some feature is available based on the family.
|
||||
* Use feature flags (eg, hw.optional.altivec) to test for optional
|
||||
* functionality.
|
||||
*/
|
||||
#define CPUFAMILY_UNKNOWN 0
|
||||
#define CPUFAMILY_POWERPC_G3 0xcee41549
|
||||
#define CPUFAMILY_POWERPC_G4 0x77c184ae
|
||||
#define CPUFAMILY_POWERPC_G5 0xed76d8aa
|
||||
#define CPUFAMILY_INTEL_6_13 0xaa33392b
|
||||
#define CPUFAMILY_INTEL_PENRYN 0x78ea4fbc
|
||||
#define CPUFAMILY_INTEL_NEHALEM 0x6b5a4cd2
|
||||
#define CPUFAMILY_INTEL_WESTMERE 0x573b5eec
|
||||
#define CPUFAMILY_INTEL_SANDYBRIDGE 0x5490b78c
|
||||
#define CPUFAMILY_INTEL_IVYBRIDGE 0x1f65e835
|
||||
#define CPUFAMILY_INTEL_HASWELL 0x10b282dc
|
||||
#define CPUFAMILY_INTEL_BROADWELL 0x582ed09c
|
||||
#define CPUFAMILY_INTEL_SKYLAKE 0x37fc219f
|
||||
#define CPUFAMILY_INTEL_KABYLAKE 0x0f817246
|
||||
#define CPUFAMILY_INTEL_ICELAKE 0x38435547
|
||||
#define CPUFAMILY_INTEL_COMETLAKE 0x1cf8a03e
|
||||
#define CPUFAMILY_ARM_9 0xe73283ae
|
||||
#define CPUFAMILY_ARM_11 0x8ff620d8
|
||||
#define CPUFAMILY_ARM_XSCALE 0x53b005f5
|
||||
#define CPUFAMILY_ARM_12 0xbd1b0ae9
|
||||
#define CPUFAMILY_ARM_13 0x0cc90e64
|
||||
#define CPUFAMILY_ARM_14 0x96077ef1
|
||||
#define CPUFAMILY_ARM_15 0xa8511bca
|
||||
#define CPUFAMILY_ARM_SWIFT 0x1e2d6381
|
||||
#define CPUFAMILY_ARM_CYCLONE 0x37a09642
|
||||
#define CPUFAMILY_ARM_TYPHOON 0x2c91a47e
|
||||
#define CPUFAMILY_ARM_TWISTER 0x92fb37c8
|
||||
#define CPUFAMILY_ARM_HURRICANE 0x67ceee93
|
||||
#define CPUFAMILY_ARM_MONSOON_MISTRAL 0xe81e7ef6
|
||||
#define CPUFAMILY_ARM_VORTEX_TEMPEST 0x07d34b9f
|
||||
#define CPUFAMILY_ARM_LIGHTNING_THUNDER 0x462504d2
|
||||
#define CPUFAMILY_ARM_FIRESTORM_ICESTORM 0x1b588bb3
|
||||
#define CPUFAMILY_ARM_BLIZZARD_AVALANCHE 0xda33d83d
|
||||
#define CPUFAMILY_ARM_EVEREST_SAWTOOTH 0x8765edea
|
||||
|
||||
/* Described in rdar://64125549 */
|
||||
#define CPUSUBFAMILY_UNKNOWN 0
|
||||
#define CPUSUBFAMILY_ARM_HP 1
|
||||
#define CPUSUBFAMILY_ARM_HG 2
|
||||
#define CPUSUBFAMILY_ARM_M 3
|
||||
#define CPUSUBFAMILY_ARM_HS 4
|
||||
#define CPUSUBFAMILY_ARM_HC_HD 5
|
||||
#define CPUSUBFAMILY_ARM_HA 6
|
||||
|
||||
/* The following synonyms are deprecated: */
|
||||
#define CPUFAMILY_INTEL_6_23 CPUFAMILY_INTEL_PENRYN
|
||||
#define CPUFAMILY_INTEL_6_26 CPUFAMILY_INTEL_NEHALEM
|
||||
|
||||
|
||||
#endif /* _MACH_MACHINE_H_ */
|
||||
@@ -0,0 +1,320 @@
|
||||
// Extracted from Xcode 15 Beta 7
|
||||
// /Library/Developer/CommandLineTools/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/mach-o/nlist.h */
|
||||
/*
|
||||
* Copyright (c) 1999-2003 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@
|
||||
*/
|
||||
#ifndef _MACHO_NLIST_H_
|
||||
#define _MACHO_NLIST_H_
|
||||
/* $NetBSD: nlist.h,v 1.5 1994/10/26 00:56:11 cgd Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
* (c) UNIX System Laboratories, Inc.
|
||||
* All or some portions of this file are derived from material licensed
|
||||
* to the University of California by American Telephone and Telegraph
|
||||
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
|
||||
* the permission of UNIX System Laboratories, Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)nlist.h 8.2 (Berkeley) 1/21/94
|
||||
*/
|
||||
#include <stdint.h>
|
||||
|
||||
/*
|
||||
* Format of a symbol table entry of a Mach-O file for 32-bit architectures.
|
||||
* Modified from the BSD format. The modifications from the original format
|
||||
* were changing n_other (an unused field) to n_sect and the addition of the
|
||||
* N_SECT type. These modifications are required to support symbols in a larger
|
||||
* number of sections not just the three sections (text, data and bss) in a BSD
|
||||
* file.
|
||||
*/
|
||||
struct nlist {
|
||||
union {
|
||||
#ifndef __LP64__
|
||||
char *n_name; /* for use when in-core */
|
||||
#endif
|
||||
uint32_t n_strx; /* index into the string table */
|
||||
} n_un;
|
||||
uint8_t n_type; /* type flag, see below */
|
||||
uint8_t n_sect; /* section number or NO_SECT */
|
||||
int16_t n_desc; /* see <mach-o/stab.h> */
|
||||
uint32_t n_value; /* value of this symbol (or stab offset) */
|
||||
};
|
||||
|
||||
/*
|
||||
* This is the symbol table entry structure for 64-bit architectures.
|
||||
*/
|
||||
struct nlist_64 {
|
||||
union {
|
||||
uint32_t n_strx; /* index into the string table */
|
||||
} n_un;
|
||||
uint8_t n_type; /* type flag, see below */
|
||||
uint8_t n_sect; /* section number or NO_SECT */
|
||||
uint16_t n_desc; /* see <mach-o/stab.h> */
|
||||
uint64_t n_value; /* value of this symbol (or stab offset) */
|
||||
};
|
||||
|
||||
/*
|
||||
* Symbols with a index into the string table of zero (n_un.n_strx == 0) are
|
||||
* defined to have a null, "", name. Therefore all string indexes to non null
|
||||
* names must not have a zero string index. This is bit historical information
|
||||
* that has never been well documented.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The n_type field really contains four fields:
|
||||
* unsigned char N_STAB:3,
|
||||
* N_PEXT:1,
|
||||
* N_TYPE:3,
|
||||
* N_EXT:1;
|
||||
* which are used via the following masks.
|
||||
*/
|
||||
#define N_STAB 0xe0 /* if any of these bits set, a symbolic debugging entry */
|
||||
#define N_PEXT 0x10 /* private external symbol bit */
|
||||
#define N_TYPE 0x0e /* mask for the type bits */
|
||||
#define N_EXT 0x01 /* external symbol bit, set for external symbols */
|
||||
|
||||
/*
|
||||
* Only symbolic debugging entries have some of the N_STAB bits set and if any
|
||||
* of these bits are set then it is a symbolic debugging entry (a stab). In
|
||||
* which case then the values of the n_type field (the entire field) are given
|
||||
* in <mach-o/stab.h>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Values for N_TYPE bits of the n_type field.
|
||||
*/
|
||||
#define N_UNDF 0x0 /* undefined, n_sect == NO_SECT */
|
||||
#define N_ABS 0x2 /* absolute, n_sect == NO_SECT */
|
||||
#define N_SECT 0xe /* defined in section number n_sect */
|
||||
#define N_PBUD 0xc /* prebound undefined (defined in a dylib) */
|
||||
#define N_INDR 0xa /* indirect */
|
||||
|
||||
/*
|
||||
* If the type is N_INDR then the symbol is defined to be the same as another
|
||||
* symbol. In this case the n_value field is an index into the string table
|
||||
* of the other symbol's name. When the other symbol is defined then they both
|
||||
* take on the defined type and value.
|
||||
*/
|
||||
|
||||
/*
|
||||
* If the type is N_SECT then the n_sect field contains an ordinal of the
|
||||
* section the symbol is defined in. The sections are numbered from 1 and
|
||||
* refer to sections in order they appear in the load commands for the file
|
||||
* they are in. This means the same ordinal may very well refer to different
|
||||
* sections in different files.
|
||||
*
|
||||
* The n_value field for all symbol table entries (including N_STAB's) gets
|
||||
* updated by the link editor based on the value of it's n_sect field and where
|
||||
* the section n_sect references gets relocated. If the value of the n_sect
|
||||
* field is NO_SECT then it's n_value field is not changed by the link editor.
|
||||
*/
|
||||
#define NO_SECT 0 /* symbol is not in any section */
|
||||
#define MAX_SECT 255 /* 1 thru 255 inclusive */
|
||||
|
||||
/*
|
||||
* Common symbols are represented by undefined (N_UNDF) external (N_EXT) types
|
||||
* who's values (n_value) are non-zero. In which case the value of the n_value
|
||||
* field is the size (in bytes) of the common symbol. The n_sect field is set
|
||||
* to NO_SECT. The alignment of a common symbol may be set as a power of 2
|
||||
* between 2^1 and 2^15 as part of the n_desc field using the macros below. If
|
||||
* the alignment is not set (a value of zero) then natural alignment based on
|
||||
* the size is used.
|
||||
*/
|
||||
#define GET_COMM_ALIGN(n_desc) (((n_desc) >> 8) & 0x0f)
|
||||
#define SET_COMM_ALIGN(n_desc,align) \
|
||||
(n_desc) = (((n_desc) & 0xf0ff) | (((align) & 0x0f) << 8))
|
||||
|
||||
/*
|
||||
* To support the lazy binding of undefined symbols in the dynamic link-editor,
|
||||
* the undefined symbols in the symbol table (the nlist structures) are marked
|
||||
* with the indication if the undefined reference is a lazy reference or
|
||||
* non-lazy reference. If both a non-lazy reference and a lazy reference is
|
||||
* made to the same symbol the non-lazy reference takes precedence. A reference
|
||||
* is lazy only when all references to that symbol are made through a symbol
|
||||
* pointer in a lazy symbol pointer section.
|
||||
*
|
||||
* The implementation of marking nlist structures in the symbol table for
|
||||
* undefined symbols will be to use some of the bits of the n_desc field as a
|
||||
* reference type. The mask REFERENCE_TYPE will be applied to the n_desc field
|
||||
* of an nlist structure for an undefined symbol to determine the type of
|
||||
* undefined reference (lazy or non-lazy).
|
||||
*
|
||||
* The constants for the REFERENCE FLAGS are propagated to the reference table
|
||||
* in a shared library file. In that case the constant for a defined symbol,
|
||||
* REFERENCE_FLAG_DEFINED, is also used.
|
||||
*/
|
||||
/* Reference type bits of the n_desc field of undefined symbols */
|
||||
#define REFERENCE_TYPE 0x7
|
||||
/* types of references */
|
||||
#define REFERENCE_FLAG_UNDEFINED_NON_LAZY 0
|
||||
#define REFERENCE_FLAG_UNDEFINED_LAZY 1
|
||||
#define REFERENCE_FLAG_DEFINED 2
|
||||
#define REFERENCE_FLAG_PRIVATE_DEFINED 3
|
||||
#define REFERENCE_FLAG_PRIVATE_UNDEFINED_NON_LAZY 4
|
||||
#define REFERENCE_FLAG_PRIVATE_UNDEFINED_LAZY 5
|
||||
|
||||
/*
|
||||
* To simplify stripping of objects that use are used with the dynamic link
|
||||
* editor, the static link editor marks the symbols defined an object that are
|
||||
* referenced by a dynamicly bound object (dynamic shared libraries, bundles).
|
||||
* With this marking strip knows not to strip these symbols.
|
||||
*/
|
||||
#define REFERENCED_DYNAMICALLY 0x0010
|
||||
|
||||
/*
|
||||
* For images created by the static link editor with the -twolevel_namespace
|
||||
* option in effect the flags field of the mach header is marked with
|
||||
* MH_TWOLEVEL. And the binding of the undefined references of the image are
|
||||
* determined by the static link editor. Which library an undefined symbol is
|
||||
* bound to is recorded by the static linker in the high 8 bits of the n_desc
|
||||
* field using the SET_LIBRARY_ORDINAL macro below. The ordinal recorded
|
||||
* references the libraries listed in the Mach-O's LC_LOAD_DYLIB,
|
||||
* LC_LOAD_WEAK_DYLIB, LC_REEXPORT_DYLIB, LC_LOAD_UPWARD_DYLIB, and
|
||||
* LC_LAZY_LOAD_DYLIB, etc. load commands in the order they appear in the
|
||||
* headers. The library ordinals start from 1.
|
||||
* For a dynamic library that is built as a two-level namespace image the
|
||||
* undefined references from module defined in another use the same nlist struct
|
||||
* an in that case SELF_LIBRARY_ORDINAL is used as the library ordinal. For
|
||||
* defined symbols in all images they also must have the library ordinal set to
|
||||
* SELF_LIBRARY_ORDINAL. The EXECUTABLE_ORDINAL refers to the executable
|
||||
* image for references from plugins that refer to the executable that loads
|
||||
* them.
|
||||
*
|
||||
* The DYNAMIC_LOOKUP_ORDINAL is for undefined symbols in a two-level namespace
|
||||
* image that are looked up by the dynamic linker with flat namespace semantics.
|
||||
* This ordinal was added as a feature in Mac OS X 10.3 by reducing the
|
||||
* value of MAX_LIBRARY_ORDINAL by one. So it is legal for existing binaries
|
||||
* or binaries built with older tools to have 0xfe (254) dynamic libraries. In
|
||||
* this case the ordinal value 0xfe (254) must be treated as a library ordinal
|
||||
* for compatibility.
|
||||
*/
|
||||
#define GET_LIBRARY_ORDINAL(n_desc) (((n_desc) >> 8) & 0xff)
|
||||
#define SET_LIBRARY_ORDINAL(n_desc,ordinal) \
|
||||
(n_desc) = (((n_desc) & 0x00ff) | (((ordinal) & 0xff) << 8))
|
||||
#define SELF_LIBRARY_ORDINAL 0x0
|
||||
#define MAX_LIBRARY_ORDINAL 0xfd
|
||||
#define DYNAMIC_LOOKUP_ORDINAL 0xfe
|
||||
#define EXECUTABLE_ORDINAL 0xff
|
||||
|
||||
/*
|
||||
* The bit 0x0020 of the n_desc field is used for two non-overlapping purposes
|
||||
* and has two different symbolic names, N_NO_DEAD_STRIP and N_DESC_DISCARDED.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The N_NO_DEAD_STRIP bit of the n_desc field only ever appears in a
|
||||
* relocatable .o file (MH_OBJECT filetype). And is used to indicate to the
|
||||
* static link editor it is never to dead strip the symbol.
|
||||
*/
|
||||
#define N_NO_DEAD_STRIP 0x0020 /* symbol is not to be dead stripped */
|
||||
|
||||
/*
|
||||
* The N_DESC_DISCARDED bit of the n_desc field never appears in linked image.
|
||||
* But is used in very rare cases by the dynamic link editor to mark an in
|
||||
* memory symbol as discared and longer used for linking.
|
||||
*/
|
||||
#define N_DESC_DISCARDED 0x0020 /* symbol is discarded */
|
||||
|
||||
/*
|
||||
* The N_WEAK_REF bit of the n_desc field indicates to the dynamic linker that
|
||||
* the undefined symbol is allowed to be missing and is to have the address of
|
||||
* zero when missing.
|
||||
*/
|
||||
#define N_WEAK_REF 0x0040 /* symbol is weak referenced */
|
||||
|
||||
/*
|
||||
* The N_WEAK_DEF bit of the n_desc field indicates to the static and dynamic
|
||||
* linkers that the symbol definition is weak, allowing a non-weak symbol to
|
||||
* also be used which causes the weak definition to be discared. Currently this
|
||||
* is only supported for symbols in coalesed sections.
|
||||
*/
|
||||
#define N_WEAK_DEF 0x0080 /* coalesed symbol is a weak definition */
|
||||
|
||||
/*
|
||||
* The N_REF_TO_WEAK bit of the n_desc field indicates to the dynamic linker
|
||||
* that the undefined symbol should be resolved using flat namespace searching.
|
||||
*/
|
||||
#define N_REF_TO_WEAK 0x0080 /* reference to a weak symbol */
|
||||
|
||||
/*
|
||||
* The N_ARM_THUMB_DEF bit of the n_desc field indicates that the symbol is
|
||||
* a defintion of a Thumb function.
|
||||
*/
|
||||
#define N_ARM_THUMB_DEF 0x0008 /* symbol is a Thumb function (ARM) */
|
||||
|
||||
/*
|
||||
* The N_SYMBOL_RESOLVER bit of the n_desc field indicates that the
|
||||
* that the function is actually a resolver function and should
|
||||
* be called to get the address of the real function to use.
|
||||
* This bit is only available in .o files (MH_OBJECT filetype)
|
||||
*/
|
||||
#define N_SYMBOL_RESOLVER 0x0100
|
||||
|
||||
/*
|
||||
* The N_ALT_ENTRY bit of the n_desc field indicates that the
|
||||
* symbol is pinned to the previous content.
|
||||
*/
|
||||
#define N_ALT_ENTRY 0x0200
|
||||
|
||||
#ifndef __STRICT_BSD__
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
/*
|
||||
* The function nlist(3) from the C library.
|
||||
*/
|
||||
extern int nlist (const char *filename, struct nlist *list);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __STRICT_BSD__ */
|
||||
|
||||
#endif /* _MACHO_LIST_H_ */
|
||||
@@ -0,0 +1,207 @@
|
||||
// Extracted from Xcode 15 Beta 7
|
||||
/* /Library/Developer/CommandLineTools/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/mach/arm/vm_param.h */
|
||||
/*
|
||||
* Copyright (c) 2007 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@
|
||||
*/
|
||||
/*
|
||||
* FILE_ID: vm_param.h
|
||||
*/
|
||||
|
||||
/*
|
||||
* ARM machine dependent virtual memory parameters.
|
||||
*/
|
||||
|
||||
#ifndef _MACH_ARM_VM_PARAM_H_
|
||||
#define _MACH_ARM_VM_PARAM_H_
|
||||
|
||||
#if defined (__arm__) || defined (__arm64__)
|
||||
|
||||
|
||||
|
||||
|
||||
#define BYTE_SIZE 8 /* byte size in bits */
|
||||
|
||||
|
||||
#ifndef __ASSEMBLER__
|
||||
|
||||
#ifdef __arm__
|
||||
#define PAGE_SHIFT_CONST 12
|
||||
#elif defined(__arm64__)
|
||||
extern int PAGE_SHIFT_CONST;
|
||||
#else
|
||||
#error Unsupported arch
|
||||
#endif
|
||||
|
||||
#define PAGE_SHIFT PAGE_SHIFT_CONST
|
||||
#define PAGE_SIZE (1 << PAGE_SHIFT)
|
||||
#define PAGE_MASK (PAGE_SIZE-1)
|
||||
|
||||
#define VM_PAGE_SIZE PAGE_SIZE
|
||||
|
||||
#define machine_ptob(x) ((x) << PAGE_SHIFT)
|
||||
|
||||
/*
|
||||
* Defined for the purpose of testing the pmap advertised page
|
||||
* size; this does not necessarily match the hardware page size.
|
||||
*/
|
||||
#define TEST_PAGE_SIZE_16K ((PAGE_SHIFT_CONST == 14))
|
||||
#define TEST_PAGE_SIZE_4K ((PAGE_SHIFT_CONST == 12))
|
||||
|
||||
#endif /* !__ASSEMBLER__ */
|
||||
|
||||
|
||||
#define PAGE_MAX_SHIFT 14
|
||||
#define PAGE_MAX_SIZE (1 << PAGE_MAX_SHIFT)
|
||||
#define PAGE_MAX_MASK (PAGE_MAX_SIZE-1)
|
||||
|
||||
#define PAGE_MIN_SHIFT 12
|
||||
#define PAGE_MIN_SIZE (1 << PAGE_MIN_SHIFT)
|
||||
#define PAGE_MIN_MASK (PAGE_MIN_SIZE-1)
|
||||
|
||||
#define VM_MAX_PAGE_ADDRESS MACH_VM_MAX_ADDRESS
|
||||
|
||||
#ifndef __ASSEMBLER__
|
||||
|
||||
|
||||
#if defined (__arm__)
|
||||
|
||||
#define VM_MIN_ADDRESS ((vm_address_t) 0x00000000)
|
||||
#define VM_MAX_ADDRESS ((vm_address_t) 0x80000000)
|
||||
|
||||
/* system-wide values */
|
||||
#define MACH_VM_MIN_ADDRESS ((mach_vm_offset_t) 0)
|
||||
#define MACH_VM_MAX_ADDRESS ((mach_vm_offset_t) VM_MAX_ADDRESS)
|
||||
|
||||
#elif defined (__arm64__)
|
||||
|
||||
#define VM_MIN_ADDRESS ((vm_address_t) 0x0000000000000000ULL)
|
||||
#define VM_MAX_ADDRESS ((vm_address_t) 0x00000000F0000000ULL)
|
||||
|
||||
/* system-wide values */
|
||||
#define MACH_VM_MIN_ADDRESS_RAW 0x0ULL
|
||||
#define MACH_VM_MAX_ADDRESS_RAW 0x00007FFFFE000000ULL
|
||||
|
||||
#define MACH_VM_MIN_ADDRESS ((mach_vm_offset_t) MACH_VM_MIN_ADDRESS_RAW)
|
||||
#define MACH_VM_MAX_ADDRESS ((mach_vm_offset_t) MACH_VM_MAX_ADDRESS_RAW)
|
||||
|
||||
#define MACH_VM_MIN_GPU_CARVEOUT_ADDRESS_RAW 0x0000001000000000ULL
|
||||
#define MACH_VM_MAX_GPU_CARVEOUT_ADDRESS_RAW 0x0000007000000000ULL
|
||||
#define MACH_VM_MIN_GPU_CARVEOUT_ADDRESS ((mach_vm_offset_t) MACH_VM_MIN_GPU_CARVEOUT_ADDRESS_RAW)
|
||||
#define MACH_VM_MAX_GPU_CARVEOUT_ADDRESS ((mach_vm_offset_t) MACH_VM_MAX_GPU_CARVEOUT_ADDRESS_RAW)
|
||||
|
||||
#else /* defined(__arm64__) */
|
||||
#error architecture not supported
|
||||
#endif
|
||||
|
||||
#define VM_MAP_MIN_ADDRESS VM_MIN_ADDRESS
|
||||
#define VM_MAP_MAX_ADDRESS VM_MAX_ADDRESS
|
||||
|
||||
|
||||
#if defined (__arm__)
|
||||
#define VM_KERNEL_POINTER_SIGNIFICANT_BITS 31
|
||||
#define VM_MIN_KERNEL_ADDRESS ((vm_address_t) 0x80000000)
|
||||
#define VM_MAX_KERNEL_ADDRESS ((vm_address_t) 0xFFFEFFFF)
|
||||
#define VM_HIGH_KERNEL_WINDOW ((vm_address_t) 0xFFFE0000)
|
||||
|
||||
#elif defined (__arm64__)
|
||||
/*
|
||||
* kalloc() parameters:
|
||||
*
|
||||
* Historically kalloc's underlying zones were power-of-2 sizes, with a
|
||||
* KALLOC_MINSIZE of 16 bytes. Thus the allocator ensured that
|
||||
* (sizeof == alignof) >= 16 for all kalloc allocations.
|
||||
*
|
||||
* Today kalloc may use zones with intermediate (small) sizes, constrained by
|
||||
* KALLOC_MINSIZE and a minimum alignment, expressed by KALLOC_LOG2_MINALIGN.
|
||||
*
|
||||
* Note that most dynamically allocated data structures contain more than
|
||||
* one int/long/pointer member, so KALLOC_MINSIZE should probably start at 8.
|
||||
*/
|
||||
#define TiB(x) ((0ULL + (x)) << 40)
|
||||
#define GiB(x) ((0ULL + (x)) << 30)
|
||||
#define KALLOC_MINSIZE 16 /* minimum allocation size */
|
||||
#define KALLOC_LOG2_MINALIGN 4 /* log2 minimum alignment */
|
||||
|
||||
/*
|
||||
* The minimum and maximum kernel address; some configurations may
|
||||
* constrain the address space further.
|
||||
*/
|
||||
|
||||
// Inform kexts about largest possible kernel address space
|
||||
#define VM_KERNEL_POINTER_SIGNIFICANT_BITS 41
|
||||
#define VM_MIN_KERNEL_ADDRESS ((vm_address_t) (0ULL - TiB(2)))
|
||||
#define VM_MAX_KERNEL_ADDRESS ((vm_address_t) 0xfffffffbffffffffULL)
|
||||
#else
|
||||
#error architecture not supported
|
||||
#endif
|
||||
|
||||
#define VM_MIN_KERNEL_AND_KEXT_ADDRESS VM_MIN_KERNEL_ADDRESS
|
||||
|
||||
#if defined (__arm64__)
|
||||
/* Top-Byte-Ignore */
|
||||
#define ARM_TBI_USER_MASK (0xFF00000000000000ULL)
|
||||
#define VM_USER_STRIP_TBI(_v) ((typeof (_v))(((uintptr_t)(_v)) &~ (ARM_TBI_USER_MASK)))
|
||||
#else /* __arm64__ */
|
||||
#define VM_USER_STRIP_TBI(_v) (_v)
|
||||
#endif /* __arm64__ */
|
||||
|
||||
#if CONFIG_KERNEL_TAGGING
|
||||
#include <vm/vm_memtag.h>
|
||||
/*
|
||||
* 'strip' in PAC sense, therefore replacing the stripped bits sign extending
|
||||
* the sign bit. In kernel space the sign bit is 1, so 0xFF is a valid mask
|
||||
* here.
|
||||
*/
|
||||
#define VM_KERNEL_STRIP_TAG(_v) (vm_memtag_canonicalize_address((vm_offset_t)_v))
|
||||
#else /* CONFIG_KERNEL_TAGGING */
|
||||
#define VM_KERNEL_STRIP_TAG(_v) (_v)
|
||||
#endif /* CONFIG_KERNEL_TAGGING */
|
||||
|
||||
#if __has_feature(ptrauth_calls)
|
||||
#include <ptrauth.h>
|
||||
#define VM_KERNEL_STRIP_PAC(_v) (ptrauth_strip((void *)(uintptr_t)(_v), ptrauth_key_asia))
|
||||
#else /* !ptrauth_calls */
|
||||
#define VM_KERNEL_STRIP_PAC(_v) (_v)
|
||||
#endif /* ptrauth_calls */
|
||||
|
||||
#define VM_KERNEL_STRIP_PTR(_va) ((VM_KERNEL_STRIP_TAG(VM_KERNEL_STRIP_PAC((_va)))))
|
||||
#define VM_KERNEL_STRIP_UPTR(_va) ((vm_address_t)VM_KERNEL_STRIP_PTR((uintptr_t)(_va)))
|
||||
#define VM_KERNEL_ADDRESS(_va) \
|
||||
((VM_KERNEL_STRIP_UPTR(_va) >= VM_MIN_KERNEL_ADDRESS) && \
|
||||
(VM_KERNEL_STRIP_UPTR(_va) <= VM_MAX_KERNEL_ADDRESS))
|
||||
|
||||
#define VM_USER_STRIP_PTR(_v) (VM_USER_STRIP_TBI(_v))
|
||||
|
||||
|
||||
|
||||
#endif /* !__ASSEMBLER__ */
|
||||
|
||||
#define SWI_SYSCALL 0x80
|
||||
|
||||
#endif /* defined (__arm__) || defined (__arm64__) */
|
||||
|
||||
#endif /* _MACH_ARM_VM_PARAM_H_ */
|
||||
@@ -0,0 +1,191 @@
|
||||
// Extracted from Xcode 15 Beta 7
|
||||
// /Library/Developer/CommandLineTools/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/mach/vm_prot.h */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2000-2021 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)
|
||||
|
||||
/*
|
||||
* This is an alias to VM_PROT_EXECUTE to identify callers that
|
||||
* want to allocate an hardware assisted Read-only/read-write
|
||||
* trusted path in userland.
|
||||
*/
|
||||
#define VM_PROT_RORW_TP (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_LEGACY ((vm_prot_t) 0x08)
|
||||
#define VM_PROT_NO_CHANGE ((vm_prot_t) 0x01000000)
|
||||
|
||||
/*
|
||||
* 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)
|
||||
|
||||
|
||||
/*
|
||||
* Another invalid protection value to support pager TPRO protection.
|
||||
* VM_PROT_TPRO is a special marker that tells the a pager to
|
||||
* set TPRO flags on a given entry. We do it this way to prevent
|
||||
* bloating the pager structures and it allows dyld to pass through
|
||||
* this flag in lieue of specifying explicit VM flags, allowing us to handle
|
||||
* the final permissions internally.
|
||||
*/
|
||||
#define VM_PROT_TPRO ((vm_prot_t) 0x200)
|
||||
|
||||
#if defined(__x86_64__)
|
||||
/*
|
||||
* Another invalid protection value to support specifying different
|
||||
* execute permissions for user- and supervisor- modes. When
|
||||
* MBE is enabled in a VM, VM_PROT_EXECUTE is used to indicate
|
||||
* supervisor-mode execute permission, and VM_PROT_UEXEC specifies
|
||||
* user-mode execute permission. Currently only used by the
|
||||
* x86 Hypervisor kext.
|
||||
*/
|
||||
#define VM_PROT_UEXEC ((vm_prot_t) 0x8) /* User-mode Execute Permission */
|
||||
|
||||
#define VM_PROT_ALLEXEC (VM_PROT_EXECUTE | VM_PROT_UEXEC)
|
||||
#else
|
||||
#define VM_PROT_ALLEXEC (VM_PROT_EXECUTE)
|
||||
#endif /* defined(__x86_64__) */
|
||||
|
||||
|
||||
#endif /* _MACH_VM_PROT_H_ */
|
||||
@@ -0,0 +1,57 @@
|
||||
// Source: https://github.com/apple-oss-distributions/xnu/blob/xnu-10002.61.3/bsd/arm/vmparam.h
|
||||
|
||||
/*
|
||||
* Copyright (c) 2000-2007 Apple Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _BSD_ARM_VMPARAM_H_
|
||||
#define _BSD_ARM_VMPARAM_H_ 1
|
||||
|
||||
#if defined (__arm__) || defined (__arm64__)
|
||||
|
||||
#include <sys/resource.h>
|
||||
|
||||
#ifndef KERNEL
|
||||
#include <TargetConditionals.h>
|
||||
#endif
|
||||
|
||||
#define USRSTACK (0x27E00000) /* ASLR slides stack down by up to 1MB */
|
||||
#define USRSTACK64 (0x000000016FE00000ULL)
|
||||
|
||||
/*
|
||||
* Virtual memory related constants, all in bytes
|
||||
*/
|
||||
#ifndef DFLDSIZ
|
||||
#define DFLDSIZ (RLIM_INFINITY) /* initial data size limit */
|
||||
#endif
|
||||
#ifndef MAXDSIZ
|
||||
#define MAXDSIZ (RLIM_INFINITY) /* max data size */
|
||||
#endif
|
||||
#ifndef DFLSSIZ
|
||||
/* XXX stack size default is a platform property: use getrlimit(2) */
|
||||
#if (defined(TARGET_OS_OSX) && (TARGET_OS_OSX != 0)) || \
|
||||
(defined(KERNEL) && XNU_TARGET_OS_OSX)
|
||||
#define DFLSSIZ (8*1024*1024 - 16*1024)
|
||||
#else
|
||||
#define DFLSSIZ (1024*1024 - 16*1024) /* initial stack size limit */
|
||||
#endif /* TARGET_OS_OSX .. || XNU_KERNEL_PRIVATE .. */
|
||||
#endif /* DFLSSIZ */
|
||||
#ifndef MAXSSIZ
|
||||
/* XXX stack size limit is a platform property: use getrlimit(2) */
|
||||
#if (defined(TARGET_OS_OSX) && (TARGET_OS_OSX != 0)) || \
|
||||
(defined(KERNEL) && XNU_TARGET_OS_OSX)
|
||||
#define MAXSSIZ (64*1024*1024) /* max stack size */
|
||||
#else
|
||||
#define MAXSSIZ (1024*1024) /* max stack size */
|
||||
#endif /* TARGET_OS_OSX .. || XNU_KERNEL_PRIVATE .. */
|
||||
#endif /* MAXSSIZ */
|
||||
#ifndef DFLCSIZ
|
||||
#define DFLCSIZ (0) /* initial core size limit */
|
||||
#endif
|
||||
#ifndef MAXCSIZ
|
||||
#define MAXCSIZ (RLIM_INFINITY) /* max core size */
|
||||
#endif /* MAXCSIZ */
|
||||
|
||||
#endif /* defined (__arm__) || defined (__arm64__) */
|
||||
|
||||
#endif /* _BSD_ARM_VMPARAM_H_ */
|
||||
Executable
+285
@@ -0,0 +1,285 @@
|
||||
#!/usr/bin/env python3
|
||||
import lief
|
||||
import uuid
|
||||
import argparse
|
||||
import subprocess
|
||||
from asn1crypto.cms import ContentInfo
|
||||
import os
|
||||
import sys
|
||||
|
||||
### --- I. MACH-O --- ###
|
||||
class SnakeI:
|
||||
def __init__(self, binaries):
|
||||
'''When initiated, the program parses a Universal binary (binaries parameter) and extracts the ARM64 Mach-O. If the file is not in a universal format but is a valid ARM64 Mach-O, it is taken as a binary parameter during initialization.'''
|
||||
self.binary = self.parseFatBinary(binaries)
|
||||
self.fat_offset = self.binary.fat_offset # For various calculations, if ARM64 Mach-O extracted from Universal Binary
|
||||
self.prot_map = {
|
||||
0: '---',
|
||||
1: 'r--',
|
||||
2: '-w-',
|
||||
3: 'rw-',
|
||||
4: '--x',
|
||||
5: 'r-x',
|
||||
6: '-wx',
|
||||
7: 'rwx'
|
||||
}
|
||||
self.segment_flags_map = {
|
||||
0x1: 'SG_HIGHVM',
|
||||
0x2: 'SG_FVMLIB',
|
||||
0x4: 'SG_NORELOC',
|
||||
0x8: 'SG_PROTECTED_VERSION_1',
|
||||
0x10: 'SG_READ_ONLY',
|
||||
}
|
||||
|
||||
def mapProtection(self, numeric_protection):
|
||||
'''Maps numeric protection to its string representation.'''
|
||||
return self.prot_map.get(numeric_protection, 'Unknown')
|
||||
|
||||
def getSegmentFlags(self, flags):
|
||||
'''Maps numeric segment flags to its string representation.'''
|
||||
return self.segment_flags_map.get(flags, '')
|
||||
#return " ".join(activated_flags)
|
||||
|
||||
def parseFatBinary(self, binaries):
|
||||
'''Parse Mach-O file, whether compiled for multiple architectures or just for a single one. It returns the ARM64 binary if it exists. If not, it exits the program.'''
|
||||
for binary in binaries:
|
||||
if binary.header.cpu_type == lief.MachO.CPU_TYPES.ARM64:
|
||||
arm64_bin = binary
|
||||
if arm64_bin == None:
|
||||
print('The specified Mach-O file is not in ARM64 architecture.')
|
||||
exit()
|
||||
return arm64_bin
|
||||
|
||||
def getFileType(self):
|
||||
"""Extract and return the file type from a binary object's header."""
|
||||
return self.binary.header.file_type.name
|
||||
|
||||
def getHeaderFlags(self):
|
||||
'''Return binary header flags.'''
|
||||
return self.binary.header.flags_list
|
||||
|
||||
def getEndianess(self):
|
||||
'''Check the endianness of a binary based on the system and binary's magic number.'''
|
||||
magic = self.binary.header.magic.name
|
||||
endianness = sys.byteorder
|
||||
if endianness == 'little' and (magic == 'MAGIC_64' or magic == 'MAGIC' or magic == 'FAT_MAGIC'):
|
||||
return 'little'
|
||||
else:
|
||||
return 'big'
|
||||
|
||||
def getBinaryHeader(self):
|
||||
'''https://lief-project.github.io/doc/stable/api/python/macho.html#header'''
|
||||
return self.binary.header
|
||||
|
||||
def getLoadCommands(self):
|
||||
'''https://lief-project.github.io/doc/stable/api/python/macho.html#loadcommand'''
|
||||
return self.binary.commands
|
||||
|
||||
def getSegments(self):
|
||||
'''Extract segmenents from binary and return a human readable string: https://lief-project.github.io/doc/stable/api/python/macho.html#lief.MachO.SegmentCommand'''
|
||||
segment_info = []
|
||||
for segment in self.binary.segments:
|
||||
name = segment.name
|
||||
va_start = '0x' + format(segment.virtual_address, '016x')
|
||||
va_end = '0x' + format(int(va_start, 16) + segment.virtual_size, '016x')
|
||||
file_start = hex(segment.file_size + self.fat_offset)
|
||||
file_end = hex(int(file_start, 16) + segment.file_size)
|
||||
init_prot = self.mapProtection(segment.init_protection)
|
||||
max_prot = self.mapProtection(segment.max_protection)
|
||||
flags = self.getSegmentFlags(segment.flags)
|
||||
if flags != '':
|
||||
segment_info.append(f'{name.ljust(16)}{init_prot}/{max_prot.ljust(8)} VM: {va_start}-{va_end.ljust(24)} FILE: {file_start}-{file_end} ({flags})')
|
||||
else:
|
||||
segment_info.append(f'{name.ljust(16)}{init_prot}/{max_prot.ljust(8)} VM: {va_start}-{va_end.ljust(24)} FILE: {file_start}-{file_end}')
|
||||
return segment_info
|
||||
|
||||
def getSections(self):
|
||||
'''Extract sections from binary and return in human readable format: https://lief-project.github.io/doc/stable/api/python/macho.html#lief.MachO.Section'''
|
||||
sections_info = []
|
||||
sections_info.append("SEGMENT".ljust(14) + "SECTION".ljust(20) + "TYPE".ljust(28) + "VIRTUAL MEMORY".ljust(32) + "FILE".ljust(26) + "FLAGS".ljust(40))
|
||||
sections_info.append(len(sections_info[0])*"=")
|
||||
for section in self.binary.sections:
|
||||
segment_name = section.segment_name
|
||||
section_name = section.fullname
|
||||
section_type = section.type.name
|
||||
section_va_start = hex(section.virtual_address)
|
||||
section_va_end = hex(section.virtual_address + section.offset)
|
||||
section_size_start = hex(section.offset + self.fat_offset)
|
||||
section_size_end = hex(section.size + section.offset + self.fat_offset)
|
||||
section_flags_list = section.flags_list
|
||||
flags_strings = [flag.name for flag in section_flags_list]
|
||||
flags = " ".join(flags_strings)
|
||||
sections_info.append((f'{segment_name.ljust(14)}{section_name.ljust(20)}{section_type.ljust(28)}{section_va_start}-{section_va_end.ljust(20)}{section_size_start}-{section_size_end}\t\t({flags})'))
|
||||
return sections_info
|
||||
|
||||
def getSymbols(self):
|
||||
'''Get all symbols from the binary (LC_SYMTAB, Chained Fixups, Exports Trie): https://lief-project.github.io/doc/stable/api/python/macho.html#symbol'''
|
||||
return self.binary.symbols
|
||||
|
||||
def getChainedFixups(self):
|
||||
'''Return Chained Fixups information: https://lief-project.github.io/doc/latest/api/python/macho.html#chained-binding-info'''
|
||||
return self.binary.dyld_chained_fixups
|
||||
|
||||
def getExportTrie(self):
|
||||
'''Return Export Trie information: https://lief-project.github.io/doc/latest/api/python/macho.html#dyldexportstrie-command'''
|
||||
try:
|
||||
return self.binary.dyld_exports_trie.show_export_trie()
|
||||
except:
|
||||
return "NO EXPORT TRIE"
|
||||
|
||||
def getUUID(self):
|
||||
'''Return UUID as string and in UUID format: https://lief-project.github.io/doc/stable/api/python/macho.html#uuidcommand'''
|
||||
for cmd in self.binary.commands:
|
||||
if isinstance(cmd, lief.MachO.UUIDCommand):
|
||||
uuid_bytes = cmd.uuid
|
||||
break
|
||||
uuid_string = str(uuid.UUID(bytes=bytes(uuid_bytes)))
|
||||
return uuid_string
|
||||
|
||||
def getMain(self):
|
||||
'''Determine the entry point of an executable.'''
|
||||
return self.binary.main_command
|
||||
|
||||
def getStringSection(self):
|
||||
'''Return strings from the __cstring (string table).'''
|
||||
extracted_strings = set()
|
||||
for section in self.binary.sections:
|
||||
if section.type == lief.MachO.SECTION_TYPES.CSTRING_LITERALS:
|
||||
extracted_strings.update(section.content.tobytes().split(b'\x00'))
|
||||
return extracted_strings
|
||||
|
||||
def findAllStringsInBinary(self):
|
||||
'''Check every binary section to find strings.'''
|
||||
extracted_strings = ""
|
||||
byte_set = set()
|
||||
for section in self.binary.sections:
|
||||
byte_set.update(section.content.tobytes().split(b'\x00'))
|
||||
for byte_item in byte_set:
|
||||
try:
|
||||
decoded_string = byte_item.decode('utf-8')
|
||||
extracted_strings += decoded_string + "\n"
|
||||
except UnicodeDecodeError:
|
||||
pass
|
||||
return extracted_strings
|
||||
### --- --- --- ###
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description="Mach-O files parser for binary analysis.")
|
||||
### --- I. MACH-O --- ###
|
||||
parser.add_argument('-p', '--path', required=True, help="Path to the Mach-O file.")
|
||||
parser.add_argument('--file_type', action='store_true', help="Print binary file type.")
|
||||
parser.add_argument('--header_flags', action='store_true', help="Print binary header flags.")
|
||||
parser.add_argument('--endian', action='store_true', help="Print binary endianess.")
|
||||
parser.add_argument('--header', action='store_true', help="Print binary header.")
|
||||
parser.add_argument('--load_commands', action='store_true', help="Print binary load commands names.")
|
||||
parser.add_argument('--segments', action='store_true', help="Print binary segments in human friendly form.")
|
||||
parser.add_argument('--sections', action='store_true', help="Print binary sections in human friendly form.")
|
||||
parser.add_argument('--symbols', action='store_true', help="Print all binary symbols.")
|
||||
parser.add_argument('--chained_fixups', action='store_true', help="Print Chained Fixups information.")
|
||||
parser.add_argument('--exports_trie', action='store_true', help="Print Export Trie information.")
|
||||
parser.add_argument('--uuid', action='store_true', help="Print UUID.")
|
||||
parser.add_argument('--main', action='store_true', help="Print entry point and stack size.")
|
||||
parser.add_argument('--strings_section', action='store_true', help="Print strings from __cstring section.")
|
||||
parser.add_argument('--all_strings', action='store_true', help="Print strings from all sections.")
|
||||
parser.add_argument('--save_strings', help="Parse all sections, detect strings and save them to a file.")
|
||||
parser.add_argument('--info', action='store_true', default=False , help="Print header, load commands, segments, sections, symbols and strings.")
|
||||
|
||||
args = parser.parse_args()
|
||||
file_path = os.path.abspath(args.path)
|
||||
|
||||
### --- I. MACH-O --- ###
|
||||
try: # Check if the file is in a valid Mach-O format
|
||||
if os.path.exists(file_path):
|
||||
binaries = lief.MachO.parse(file_path)
|
||||
snake_instance = SnakeI(binaries)
|
||||
else:
|
||||
print(f'The file {file_path} does not exist.')
|
||||
exit()
|
||||
except Exception as e: # Exit if not
|
||||
print(f"An error occurred: {e}")
|
||||
exit()
|
||||
|
||||
if args.file_type: # Print binary file type
|
||||
print(f'File type: {snake_instance.getFileType()}')
|
||||
|
||||
if args.header_flags: # Print binary header flags
|
||||
header_flag_list = snake_instance.getHeaderFlags()
|
||||
print("Header flags:", " ".join(header_flag.name for header_flag in header_flag_list))
|
||||
|
||||
if args.endian: # Print binary endianess
|
||||
print(f'Endianess: {snake_instance.getEndianess()}')
|
||||
|
||||
if args.header: # Print binary header
|
||||
print(snake_instance.getBinaryHeader())
|
||||
|
||||
if args.load_commands: # Print binary load commands
|
||||
load_commands_list = snake_instance.getLoadCommands()
|
||||
print("Load Commands:", " ".join(load_command.command.name for load_command in load_commands_list))
|
||||
|
||||
if args.segments: # Print binary segments in human friendly form
|
||||
for segment in snake_instance.getSegments():
|
||||
print(segment)
|
||||
|
||||
if args.sections: # Print binary sections in human friendly form
|
||||
for section in snake_instance.getSections():
|
||||
print(section)
|
||||
|
||||
if args.symbols: # Print symbols
|
||||
for symbol in snake_instance.getSymbols():
|
||||
print(symbol.name)
|
||||
|
||||
if args.chained_fixups: # Print Chained Fixups information
|
||||
print(snake_instance.getChainedFixups())
|
||||
|
||||
if args.exports_trie: # Print Exports Trie information
|
||||
print(snake_instance.getExportTrie())
|
||||
|
||||
if args.uuid: # Print UUID
|
||||
print(f'UUID: {snake_instance.getUUID()}')
|
||||
|
||||
if args.main: # Print entry point and stack size
|
||||
print(f'Entry point: {hex(snake_instance.getMain().entrypoint)}')
|
||||
print(f'Stack size: {hex(snake_instance.getMain().stack_size)}')
|
||||
|
||||
if args.strings_section: # Print strings from __cstring section
|
||||
print('Strings from __cstring section:')
|
||||
print('-------------------------------')
|
||||
for string in (snake_instance.getStringSection()):
|
||||
print(string)
|
||||
|
||||
if args.all_strings: # Print strings from all sections.
|
||||
print(snake_instance.findAllStringsInBinary())
|
||||
|
||||
if args.save_strings: # Parse all sections, detect strings and save them to a file
|
||||
extracted_strings = snake_instance.findAllStringsInBinary()
|
||||
with open(args.save_strings, 'a') as f:
|
||||
for s in extracted_strings:
|
||||
f.write(s)
|
||||
|
||||
if args.info: # Print all info about the binary
|
||||
print('\n<=== HEADER ===>')
|
||||
print(snake_instance.getBinaryHeader())
|
||||
print('\n<=== LOAD COMMANDS ===>')
|
||||
for lcd in snake_instance.getLoadCommands():
|
||||
print(lcd)
|
||||
print("="*50)
|
||||
print('\n<=== SEGMENTS ===>')
|
||||
for segment in snake_instance.getSegments():
|
||||
print(segment)
|
||||
print('\n<=== SECTIONS ===>')
|
||||
for section in snake_instance.getSections():
|
||||
print(section)
|
||||
print('\n<=== SYMBOLS ===>')
|
||||
for symbol in snake_instance.getSymbols():
|
||||
print(symbol.name)
|
||||
print('\n<=== STRINGS ===>')
|
||||
print('Strings from __cstring section:')
|
||||
print('-------------------------------')
|
||||
for string in (snake_instance.getStringSection()):
|
||||
print(string)
|
||||
print('\n<=== UUID ===>')
|
||||
print(f'{snake_instance.getUUID()}')
|
||||
print('\n<=== ENDIANESS ===>')
|
||||
print(snake_instance.getEndianess())
|
||||
print('\n<=== ENTRYPOINT ===>')
|
||||
print(f'{hex(snake_instance.getMain().entrypoint)}')
|
||||
Executable
+57
@@ -0,0 +1,57 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import lief
|
||||
import sys
|
||||
import argparse
|
||||
|
||||
class MachOFileFinder:
|
||||
'''Class for finding ARM64 Mach-O binaries in a given directory.'''
|
||||
|
||||
def __init__(self, directory_path, recursive=False):
|
||||
'''Constructor to initialize the directory path and recursive flag.'''
|
||||
self.directory_path = directory_path
|
||||
self.recursive = recursive
|
||||
|
||||
def parse_fat_binary(self, binaries):
|
||||
'''Function to parse Mach-O file, whether compiled for multiple architectures or just for a single one.
|
||||
It returns the ARM64 binary if it exists. If not, it exits the program.'''
|
||||
arm64_bin = None
|
||||
for binary in binaries:
|
||||
if binary.header.cpu_type == lief.MachO.CPU_TYPES.ARM64:
|
||||
arm64_bin = binary
|
||||
return arm64_bin
|
||||
|
||||
def process_directory(self, root, files):
|
||||
'''Method to process all files in the specified directory.'''
|
||||
for file_name in files:
|
||||
file_path = os.path.abspath(os.path.join(root, file_name))
|
||||
try:
|
||||
binaries = lief.MachO.parse(file_path)
|
||||
binary = self.parse_fat_binary(binaries)
|
||||
if binary is not None:
|
||||
print(f"{binary.header.file_type.name}:{file_path}")
|
||||
except:
|
||||
pass # Ignore parsing errors or non-Mach-O files
|
||||
|
||||
def process_files(self):
|
||||
'''Method to process files based on the specified search type.'''
|
||||
for root, dirs, files in os.walk(self.directory_path):
|
||||
self.process_directory(root, files)
|
||||
|
||||
if not self.recursive:
|
||||
break # Break the loop if not searching recursively
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description='Find ARM64 Mach-O binaries in a directory.')
|
||||
parser.add_argument('path', metavar='PATH', type=str, help='the directory path to search for Mach-O binaries')
|
||||
parser.add_argument('-r', '--recursive', action='store_true', help='search recursively (default: false)')
|
||||
|
||||
args = parser.parse_args()
|
||||
directory_path = args.path
|
||||
|
||||
if not os.path.isdir(directory_path):
|
||||
print(f"Error: {directory_path} is not a valid directory.")
|
||||
sys.exit(1)
|
||||
|
||||
macho_finder = MachOFileFinder(directory_path, recursive=args.recursive)
|
||||
macho_finder.process_files()
|
||||
@@ -1,201 +1,674 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
1. Definitions.
|
||||
Preamble
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
0. Definitions.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
1. Source Code.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
2. Basic Permissions.
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
@@ -1,2 +1,60 @@
|
||||
# Snake_Apple
|
||||
The code repository for the Snake&Apple article series.
|
||||
|
||||
## ARTICLES
|
||||

|
||||
* ☑ [I. Mach-O](https://medium.com/p/a8eda4b87263)
|
||||
* ☐ [II. Code Signing]()
|
||||
* ☐ [III. Checksec]()
|
||||
* ☐ [IV. Dylibs]()
|
||||
|
||||
## TOOLS
|
||||

|
||||
[CrimsonUroboros](I.%20Mach-O/python/CrimsonUroboros.py) - core program resulting from the Snake&Apple article series for binary analysis. You may find older versions of this script in each article directory in this repository.
|
||||
* Usage
|
||||
```console
|
||||
usage: CrimsonUroboros.py [-h] -p PATH [--file_type] [--header_flags] [--endian] [--header] [--load_commands] [--segments] [--sections] [--symbols] [--chained_fixups] [--exports_trie]
|
||||
[--uuid] [--main] [--strings_section] [--all_strings] [--save_strings SAVE_STRINGS] [--info]
|
||||
|
||||
Mach-O files parser for binary analysis.
|
||||
|
||||
options:
|
||||
-h, --help show this help message and exit
|
||||
-p PATH, --path PATH Path to the Mach-O file.
|
||||
--file_type Print binary file type.
|
||||
--header_flags Print binary header flags.
|
||||
--endian Print binary endianess.
|
||||
--header Print binary header.
|
||||
--load_commands Print binary load commands names.
|
||||
--segments Print binary segments in human friendly form.
|
||||
--sections Print binary sections in human friendly form.
|
||||
--symbols Print all binary symbols.
|
||||
--chained_fixups Print Chained Fixups information.
|
||||
--exports_trie Print Export Trie information.
|
||||
--uuid Print UUID.
|
||||
--main Print entry point and stack size.
|
||||
--strings_section Print strings from __cstring section.
|
||||
--all_strings Print strings from all sections.
|
||||
--save_strings SAVE_STRINGS
|
||||
Parse all sections, detect strings and save them to a file.
|
||||
--info Print header, load commands, segments, sections, symbols and strings.
|
||||
```
|
||||
* Example:
|
||||
```bash
|
||||
CrimsonUroboros.py -p PATH --info
|
||||
```
|
||||
[MachOFileFinder](I.%20Mach-O/python/MachOFileFinder.py) - designed to find ARM64 Mach-O binaries within a specified directory and print their file type.
|
||||
* Usage:
|
||||
```bash
|
||||
python MachOFileFinder.py PATH
|
||||
```
|
||||
* Example:
|
||||
```bash
|
||||
python MachOFileFinder.py . -r 2>/dev/null
|
||||
EXECUTE:/Users/karmaz95/t/pingsender
|
||||
DYLIB:/Users/karmaz95/t/dylibs/use_dylib_app/customs/custom.dylib
|
||||
BUNDLE:/Users/karmaz95/t/bundles/MyBundle
|
||||
```
|
||||
|
||||
## WHY UROBOROS?
|
||||
I will write the code for each article as a class SnakeX, where X will be the article number. To make it easier for the audience to follow. Each Snake class will be a child of the previous one and infinitely "eat itself" (inherit methods of the previous class), like Uroboros.
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 137 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 184 KiB |
Reference in New Issue
Block a user