home *** CD-ROM | disk | FTP | other *** search
/ H4CK3R 4 / hacker04 / 04_HACK04.ISO / darwin / darwinx86.iso / usr / include / mach-o / arch.h next >
Encoding:
C/C++ Source or Header  |  2001-09-14  |  4.1 KB  |  102 lines

  1. /*
  2.  * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
  3.  *
  4.  * @APPLE_LICENSE_HEADER_START@
  5.  * 
  6.  * Portions Copyright (c) 1999 Apple Computer, Inc.  All Rights
  7.  * Reserved.  This file contains Original Code and/or Modifications of
  8.  * Original Code as defined in and that are subject to the Apple Public
  9.  * Source License Version 1.1 (the "License").  You may not use this file
  10.  * except in compliance with the License.  Please obtain a copy of the
  11.  * License at http://www.apple.com/publicsource and read it before using
  12.  * this file.
  13.  * 
  14.  * The Original Code and all software distributed under the License are
  15.  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
  16.  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
  17.  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
  18.  * FITNESS FOR A PARTICULAR PURPOSE OR NON- INFRINGEMENT.  Please see the
  19.  * License for the specific language governing rights and limitations
  20.  * under the License.
  21.  * 
  22.  * @APPLE_LICENSE_HEADER_END@
  23.  */
  24. /*
  25.  * Copyright (c) 1997 Apple Computer, Inc.
  26.  *
  27.  * Functions that deal with information about architectures.
  28.  *
  29.  */
  30.  
  31. #import <mach/machine.h>
  32. #import <architecture/byte_order.h>
  33.  
  34. /* The NXArchInfo structs contain the architectures symbolic name
  35.  * (such as "ppc"), its CPU type and CPU subtype as defined in
  36.  * mach/machine.h, the byte order for the architecture, and a
  37.  * describing string (such as "PowerPC").
  38.  * There will both be entries for specific CPUs (such as ppc604e) as
  39.  * well as generic "family" entries (such as ppc).
  40.  */
  41. typedef struct {
  42.     const char *name;
  43.     cpu_type_t cputype;
  44.     cpu_subtype_t cpusubtype;
  45.     enum NXByteOrder byteorder;
  46.     const char *description;
  47. } NXArchInfo;
  48.  
  49. #if __cplusplus
  50. extern "C" {
  51. #endif /* __cplusplus */
  52.  
  53. /* NXGetAllArchInfos() returns a pointer to an array of all known
  54.  * NXArchInfo structures.  The last NXArchInfo is marked by a NULL name.
  55.  */
  56. extern const NXArchInfo *NXGetAllArchInfos(void);
  57.  
  58. /* NXGetLocalArchInfo() returns the NXArchInfo for the local host, or NULL
  59.  * if none is known. 
  60.  */
  61. extern const NXArchInfo *NXGetLocalArchInfo(void);
  62.  
  63. /* NXGetArchInfoFromName() and NXGetArchInfoFromCpuType() return the
  64.  * NXArchInfo from the architecture's name or cputype/cpusubtype
  65.  * combination.  A cpusubtype of CPU_SUBTYPE_MULTIPLE can be used
  66.  * to request the most general NXArchInfo known for the given cputype.
  67.  * NULL is returned if no matching NXArchInfo can be found.
  68.  */
  69. extern const NXArchInfo *NXGetArchInfoFromName(const char *name);
  70. extern const NXArchInfo *NXGetArchInfoFromCpuType(cpu_type_t cputype,
  71.                           cpu_subtype_t cpusubtype);
  72.  
  73. /* NXFindBestFatArch() is passed a cputype and cpusubtype and a set of
  74.  * fat_arch structs and selects the best one that matches (if any) and returns
  75.  * a pointer to that fat_arch struct (or NULL).  The fat_arch structs must be
  76.  * in the host byte order and correct such that the fat_archs really points to
  77.  * enough memory for nfat_arch structs.  It is possible that this routine could
  78.  * fail if new cputypes or cpusubtypes are added and an old version of this
  79.  * routine is used.  But if there is an exact match between the cputype and
  80.  * cpusubtype and one of the fat_arch structs this routine will always succeed.
  81.  */
  82. extern struct fat_arch *NXFindBestFatArch(cpu_type_t cputype,
  83.                       cpu_subtype_t cpusubtype,
  84.                       struct fat_arch *fat_archs,
  85.                       unsigned long nfat_archs);
  86.  
  87. /* NXCombineCpuSubtypes() returns the resulting cpusubtype when combining two
  88.  * different cpusubtypes for the specified cputype.  If the two cpusubtypes
  89.  * can't be combined (the specific subtypes are mutually exclusive) -1 is
  90.  * returned indicating it is an error to combine them.  This can also fail and
  91.  * return -1 if new cputypes or cpusubtypes are added and an old version of
  92.  * this routine is used.  But if the cpusubtypes are the same they can always
  93.  * be combined and this routine will return the cpusubtype pass in.
  94.  */
  95. extern cpu_subtype_t NXCombineCpuSubtypes(cpu_type_t cputype,
  96.                       cpu_subtype_t cpusubtype1,
  97.                       cpu_subtype_t cpusubtype2);
  98.  
  99. #if __cplusplus
  100. };
  101. #endif /* __cplusplus */
  102.