/**********************************************************************
 *  ASTRIS - Remote JTAG probe
 *
 *  Top-level API header			File: astris_machine.h
 *
 *  Cpu type definitions that are missing from older SDK versions
 *  of mach/machine.h.
 *
 *********************************************************************
 *
 *  Copyright (C) 2015  Apple, Inc. All rights reserved.
 *
 *  This document is the property of Apple Inc.
 *  It is considered confidential and proprietary.
 *
 *  This document may not be reproduced or transmitted in any form,
 *  in whole or in part, without the express written permission of
 *  Apple Inc.
 ********************************************************************* */

#ifndef Astris_astris_machine_h
#define Astris_astris_machine_h

#include <mach/machine.h>

/*
 *      ARM subtypes
 *
 * We expect to pick up all but the newest CPU_SUBTYPE_ARM_*
 * definitions from the OS X 10.8 SDK version of the
 * <.../usr/include/mach/machine.h> header; only define them if the
 * definition of CPU_SUBTYPE_ARM_ALL is not previously defined or if
 * the specific definition is too new to appear in our version of the
 * header (e.g. CPU_SUBTYPE_ARM_V8).
 */
#ifndef CPU_SUBTYPE_ARM_ALL
#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)
#define CPU_SUBTYPE_ARM_V7F    ((cpu_subtype_t)10) /* Cortex A9 */
#define CPU_SUBTYPE_ARM_V7K    ((cpu_subtype_t)12) /* Kirkwood40 */
#endif /* ifndef CPU_SUBTYPE_ARM_ALL */

//
// The following macros are not defined in the 10.8 SDK version of machine.h so conditonally define
// them. They are copied from 10.10 SDK version of machine.h.
//
#ifndef CPU_TYPE_ARM64
#define CPU_TYPE_ARM64 (CPU_TYPE_ARM | CPU_ARCH_ABI64)
#endif

#ifndef CPU_SUBTYPE_ARM_V6M
#define CPU_SUBTYPE_ARM_V6M ((cpu_subtype_t)14) /* Not meant to be run under xnu */
#endif

#ifndef CPU_SUBTYPE_ARM_V7M
#define CPU_SUBTYPE_ARM_V7M ((cpu_subtype_t)15) /* Not meant to be run under xnu */
#endif

#ifndef CPU_SUBTYPE_ARM_V7EM
#define CPU_SUBTYPE_ARM_V7EM ((cpu_subtype_t)16) /* Not meant to be run under xnu */
#endif

#endif // ifndef Astris_astris_machine_h
