Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages


home | help
ARCH(3)			   Library Functions Manual		       ARCH(3)

       NXGetAllArchInfos,      NXGetLocalArchInfo,	NXGetArchInfoFromName,
       NXGetArchInfoFromCpuType, NXFindBestFatArch, NXCombineCpuSubtypes - get
       architecture information

       #include	<mach-o/arch.h>
       extern const NXArchInfo *NXGetAllArchInfos(void);
       extern const NXArchInfo *NXGetLocalArchInfo(void);
       extern const NXArchInfo *NXGetArchInfoFromName(const char *name);
       extern const NXArchInfo *NXGetArchInfoFromCpuType(cpu_type_t cputype,
	    cpu_subtype_t cpusubtype);
       extern struct fat_arch *NXFindBestFatArch(cpu_type_t cputype,
	    cpu_subtype_t cpusubtype,
	    struct fat_arch *fat_archs,
	    unsigned long nfat_archs);
       extern cpu_subtype_t NXCombineCpuSubtypes(cpu_type_t cputype,
	    cpu_subtype_t cpusubtype1,
	    cpu_subtype_t cpusubtype2);

       These functions are intended for	use in programs	that have to deal with
       fat files or programs that can target  multiple	architectures.	 Typi-
       cally,  a  program  will	 use  a	command-line argument that starts with
       -arch name, where this specifies	an architecture.  These	functions  and
       data structures provide some help for processing	architecture flags and
       then processing the contents of a fat file.

       The structure NXArchInfo	is defined in _mach-o/arch.h_ as follows:
	    typedef struct {
		 const char *name;
		 cpu_type_t cputype;
		 cpu_subtype_t cpusubtype;
		 enum NXByteOrder byteorder;
		 const char *description;
	    } NXArchInfo;
       It is used to hold the name of the architecture and  the	 corresponding
       CPU  type  and CPU subtype, together with the architecture's byte order
       and a brief description string.

       The currently known architectures are:

       Name    CPU Type		 CPU Subtype		   Description
       i386    CPU_TYPE_I386	 CPU_SUBTYPE_I386_ALL	   Intel 80x86
       i860    CPU_TYPE_I860	 CPU_SUBTYPE_I860_ALL	   Intel 860
       m68k    CPU_TYPE_MC680x0	 CPU_SUBTYPE_MC680x0_ALL   Motorola 68K
       m88k    CPU_TYPE_MC88000	 CPU_SUBTYPE_MC88000_ALL   Motorola 88K
       m98k    CPU_TYPE_MC98000	 CPU_SUBTYPE_MC98000_ALL   Power PC

       i486    CPU_TYPE_I386	 CPU_SUBTYPE_486	   Intel 486
       i486SX  CPU_TYPE_I386	 CPU_SUBTYPE_486SX	   Intel 486SX
       i586    CPU_TYPE_I386	 CPU_SUBTYPE_586	   Intel 586
       i586SX  CPU_TYPE_I386	 CPU_SUBTYPE_586SX	   Intel 586SX
       m68030  CPU_TYPE_MC680x0	 CPU_SUBTYPE_MC68030_ONLY  Motorola 68030
       m68040  CPU_TYPE_MC680x0	 CPU_SUBTYPE_MC68040	   Motorola 68040

       The first set of	entries	are used for  the  architecture	 family.   The
       second  set  of entries are used	for a specific architecture, when more
       than one	specific architecture is supported in a	 family	 of  architec-

       NXGetAllArchInfos()  returns a pointer to an array of all known NXArch-
       Info structures.	 The last NXArchInfo is	marked by a NULL name.

       NXGetLocalArchInfo() returns the	NXArchInfo for the local host, or NULL
       if none is known.

       NXGetArchInfoFromName()	 and   NXGetArchInfoFromCpuType()  return  the
       NXArchInfo from the architecture's name or CPU type/CPU subtype	combi-
       nation.	 A  CPU	subtype	of CPU_SUBTYPE_MULTIPLE	can be used to request
       the most	general	NXArchInfo known for the given CPU type.  NULL is  re-
       turned if no matching NXArchInfo	can be found.

       NXFindBestFatArch()  is	passed a CPU type and CPU subtype and a	set of
       fat_arch	structs.  It selects the best one that matches (if  any),  and
       returns	a  pointer  to	that  fat_arch struct (or NULL).  The fat_arch
       structs must be in the host byte	order and correct such that  fat_archs
       really  points  to enough memory	for nfat_arch structs.	It is possible
       that this routine could fail if new CPU types or	CPU subtypes are added
       and  an	old version of this routine is used.  But if there is an exact
       match between the CPU type and CPU subtype  and	one  of	 the  fat_arch
       structs,	this routine will always succeed.

       NXCombineCpuSubtypes() returns the resulting CPU	subtype	when combining
       two different CPU subtypes for the specified CPU	type.  If the two  CPU
       subtypes	 can't	be combined (the specific subtypes are mutually	exclu-
       sive), -1 is returned, indicating it is an error	to combine them.  This
       can  also fail and return -1 if new CPU types or	CPU subtypes are added
       and an old version of this routine is used.  But	if  the	 CPU  subtypes
       are  the	same, they can always be combined and this routine will	return
       the CPU subtype passed in.

NeXT Computer, Inc.		 July 19, 1993			       ARCH(3)


Want to link to this manual page? Use this URL:

home | help