The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/sys/exec_macho.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*      $NetBSD: exec_macho.h,v 1.19 2005/12/26 18:41:36 perry Exp $    */
    2 
    3 /*-
    4  * Copyright (c) 2001 The NetBSD Foundation, Inc.
    5  * All rights reserved.
    6  *
    7  * This code is derived from software contributed to The NetBSD Foundation
    8  * by Christos Zoulas.
    9  *
   10  * Redistribution and use in source and binary forms, with or without
   11  * modification, are permitted provided that the following conditions
   12  * are met:
   13  * 1. Redistributions of source code must retain the above copyright
   14  *    notice, this list of conditions and the following disclaimer.
   15  * 2. Redistributions in binary form must reproduce the above copyright
   16  *    notice, this list of conditions and the following disclaimer in the
   17  *    documentation and/or other materials provided with the distribution.
   18  * 3. All advertising materials mentioning features or use of this software
   19  *    must display the following acknowledgement:
   20  *      This product includes software developed by the NetBSD
   21  *      Foundation, Inc. and its contributors.
   22  * 4. Neither the name of The NetBSD Foundation nor the names of its
   23  *    contributors may be used to endorse or promote products derived
   24  *    from this software without specific prior written permission.
   25  *
   26  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
   27  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
   28  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
   29  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
   30  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   31  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   32  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   33  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   34  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   35  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   36  * POSSIBILITY OF SUCH DAMAGE.
   37  */
   38 
   39 #ifndef _SYS_EXEC_MACHO_H_
   40 #define _SYS_EXEC_MACHO_H_
   41 
   42 #include <sys/param.h>
   43 
   44 #include <machine/int_types.h>
   45 #include <machine/macho_machdep.h>
   46 
   47 /*
   48  * CPU supported by a given arch, in sys/arch/<arch>/<arch>/macho_machdep.c
   49  */
   50 extern uint32_t exec_macho_supported_cpu[];
   51 
   52 /*
   53  * the `fat' binary description
   54  */
   55 struct exec_macho_fat_header {
   56         __uint32_t      magic;
   57         __uint32_t      nfat_arch;
   58 };
   59 
   60 #define MACHO_FAT_MAGIC 0xcafebabe
   61 
   62 /*
   63  * The fat architecture header
   64  */
   65 struct exec_macho_fat_arch {
   66         __uint32_t      cputype;
   67         __uint32_t      cpusubtype;
   68         u_long          offset;
   69         u_long          size;
   70         u_long          align;
   71 };
   72 
   73 #define MACHO_CPU_TYPE_ANY      ~0
   74 #define MACHO_CPU_TYPE_VAX       1
   75 #define MACHO_CPU_TYPE_MC680x0   6
   76 #define MACHO_CPU_TYPE_I386      7
   77 #define MACHO_CPU_TYPE_MIPS      8
   78 #define MACHO_CPU_TYPE_MC98000  10
   79 #define MACHO_CPU_TYPE_HPPA     11
   80 #define MACHO_CPU_TYPE_ARM      12
   81 #define MACHO_CPU_TYPE_MC88000  13
   82 #define MACHO_CPU_TYPE_SPARC    14
   83 #define MACHO_CPU_TYPE_I860     15
   84 #define MACHO_CPU_TYPE_ALPHA    16
   85 #define MACHO_CPU_TYPE_POWERPC  18
   86 
   87 #define MACHO_CPU_SUBTYPE_MULTIPLE              ~0
   88 #define MACHO_CPU_SUBTYPE_LITTLE_ENDIAN          0
   89 #define MACHO_CPU_SUBTYPE_BIG_ENDIAN             1
   90 
   91 /*
   92  * m68k
   93  */
   94 #define MACHO_CPU_SUBTYPE_MC680x0_ALL           1
   95 #define MACHO_CPU_SUBTYPE_MC68030               1
   96 #define MACHO_CPU_SUBTYPE_MC68040               2
   97 #define MACHO_CPU_SUBTYPE_MC68030_ONLY          3
   98 
   99 /*
  100  * x86
  101  */
  102 #define MACHO_CPU_SUBTYPE_I386_ALL      3
  103 #define MACHO_CPU_SUBTYPE_386           3
  104 #define MACHO_CPU_SUBTYPE_486           4
  105 #define MACHO_CPU_SUBTYPE_486SX         (4 + 128)
  106 #define MACHO_CPU_SUBTYPE_586           5
  107 #define MACHO_CPU_SUBTYPE_INTEL(f, m)   ((f) + ((m) << 4))
  108 #define MACHO_CPU_SUBTYPE_PENT          MACHO_CPU_SUBTYPE_INTEL(5, 0)
  109 #define MACHO_CPU_SUBTYPE_PENTPRO       MACHO_CPU_SUBTYPE_INTEL(6, 1)
  110 #define MACHO_CPU_SUBTYPE_PENTII_M3     MACHO_CPU_SUBTYPE_INTEL(6, 3)
  111 #define MACHO_CPU_SUBTYPE_PENTII_M5     MACHO_CPU_SUBTYPE_INTEL(6, 5)
  112 #define MACHO_CPU_SUBTYPE_INTEL_FAMILY(x)       ((x) & 15)
  113 #define MACHO_CPU_SUBTYPE_INTEL_FAMILY_MAX      15
  114 #define MACHO_CPU_SUBTYPE_INTEL_MODEL(x)        ((x) >> 4)
  115 #define MACHO_CPU_SUBTYPE_INTEL_MODEL_ALL       0
  116 /*
  117  * PowerPC
  118  */
  119 #define MACHO_CPU_SUBTYPE_POWERPC_ALL            0
  120 #define MACHO_CPU_SUBTYPE_POWERPC_601            1
  121 #define MACHO_CPU_SUBTYPE_POWERPC_602            2
  122 #define MACHO_CPU_SUBTYPE_POWERPC_603            3
  123 #define MACHO_CPU_SUBTYPE_POWERPC_603e           4
  124 #define MACHO_CPU_SUBTYPE_POWERPC_603ev          5
  125 #define MACHO_CPU_SUBTYPE_POWERPC_604            6
  126 #define MACHO_CPU_SUBTYPE_POWERPC_604e           7
  127 #define MACHO_CPU_SUBTYPE_POWERPC_620            8
  128 #define MACHO_CPU_SUBTYPE_POWERPC_750            9
  129 #define MACHO_CPU_SUBTYPE_POWERPC_7400          10
  130 #define MACHO_CPU_SUBTYPE_POWERPC_7450          11
  131 
  132 
  133 struct exec_macho_object_header {
  134         u_long  magic;
  135         __uint32_t      cputype;
  136         __uint32_t      cpusubtype;
  137         u_long  filetype;
  138         u_long  ncmds;
  139         u_long  sizeofcmds;
  140         u_long  flags;
  141 };
  142 
  143 #define MACHO_MOH_MAGIC 0xfeedface
  144 
  145 /*
  146  * Object header filetype
  147  */
  148 #define MACHO_MOH_OBJECT        0x1
  149 #define MACHO_MOH_EXECUTE       0x2
  150 #define MACHO_MOH_FVMLIB        0x3
  151 #define MACHO_MOH_CORE          0x4
  152 #define MACHO_MOH_PRELOAD       0x5
  153 #define MACHO_MOH_DYLIB         0x6
  154 #define MACHO_MOH_DYLINKER      0x7
  155 #define MACHO_MOH_BUNDLE        0x8
  156 
  157 /*
  158  * Object header flags
  159  */
  160 #define MACHO_MOH_NOUNDEFS      0x001
  161 #define MACHO_MOH_INCRLINK      0x002
  162 #define MACHO_MOH_DYLDLINK      0x004
  163 #define MACHO_MOH_BINDATLOAD    0x008
  164 #define MACHO_MOH_PREBOUND      0x010
  165 #define MACHO_MOH_SPLIT_SEGS    0x020
  166 #define MACHO_MOH_LAZY_INIT     0x040
  167 #define MACHO_MOH_TWOLEVEL      0x080
  168 #define MACHO_MOH_FORCE_FLAT    0x100
  169 
  170 struct exec_macho_load_command {
  171         u_long cmd;
  172         u_long cmdsize;
  173 };
  174 
  175 #define MACHO_LC_SEGMENT        0x01
  176 #define MACHO_LC_SYMTAB         0x02
  177 #define MACHO_LC_SYMSEG         0x03
  178 #define MACHO_LC_THREAD         0x04
  179 #define MACHO_LC_UNIXTHREAD     0x05
  180 #define MACHO_LC_LOADFVMLIB     0x06
  181 #define MACHO_LC_IDFVMLIB       0x07
  182 #define MACHO_LC_IDENT          0x08
  183 #define MACHO_LC_FVMFILE        0x09
  184 #define MACHO_LC_PREPAGE        0x0a
  185 #define MACHO_LC_DYSYMTAB       0x0b
  186 #define MACHO_LC_LOAD_DYLIB     0x0c
  187 #define MACHO_LC_ID_DYLIB       0x0d
  188 #define MACHO_LC_LOAD_DYLINKER  0x0e
  189 #define MACHO_LC_ID_DYLINKER    0x0f
  190 #define MACHO_LC_PREBOUND_DYLIB 0x10
  191 #define MACHO_LC_ROUTINES       0x11
  192 #define MACHO_LC_SUB_FRAMEWORK  0x12
  193 #define MACHO_LC_SUB_UMBRELLA   0x13
  194 #define MACHO_LC_SUB_CLIENT     0x14
  195 
  196 struct exec_macho_segment_command {
  197         u_long  cmd;
  198         u_long  cmdsize;
  199         char    segname[16];
  200         u_long  vmaddr;
  201         u_long  vmsize;
  202         u_long  fileoff;
  203         u_long  filesize;
  204         __uint32_t      maxprot;
  205         __uint32_t      initprot;
  206         u_long  nsects;
  207         u_long  flags;
  208 };
  209 
  210 union macho_lc_str {
  211         u_long  offset;
  212         char            *ptr;
  213 };
  214 
  215 #define MACHO_SG_HIGHVM         0x1
  216 #define MACHO_SG_FVMLIB         0x2
  217 #define MACHO_SG_NORELOC        0x4
  218 
  219 struct exec_macho_dylinker_command {
  220         u_long  cmd;
  221         u_long  cmdsize;
  222         union macho_lc_str      name;
  223 };
  224 
  225 struct exec_macho_dylib {
  226     union macho_lc_str name;
  227     u_long timestamp;
  228     u_long current_version;
  229     u_long compatibility_version;
  230 };
  231 
  232 struct exec_macho_dylib_command {
  233         u_long  cmd;
  234         u_long  cmdsize;
  235         struct exec_macho_dylib dylib;
  236 };
  237 
  238 struct exec_macho_thread_command {
  239         u_long  cmd;
  240         u_long  cmdsize;
  241         u_long  flavor;
  242         u_long  count;
  243 };
  244 
  245 struct exec_macho_emul_arg {
  246         const char *path;
  247         char filename[MAXPATHLEN];
  248         struct exec_macho_object_header *macho_hdr;
  249         int dynamic;
  250 };
  251 
  252 #ifndef _LKM
  253 #include "opt_execfmt.h"
  254 #endif
  255 
  256 #ifdef _KERNEL
  257 struct exec_package;
  258 struct ps_strings;
  259 u_long  exec_macho_thread_entry(struct exec_macho_thread_command *);
  260 int     exec_macho_makecmds(struct lwp *, struct exec_package *);
  261 int     exec_macho_copyargs(struct proc *, struct exec_package *,
  262                             struct ps_strings *, char **, void *);
  263 #endif /* _KERNEL */
  264 
  265 #endif /* !_SYS_EXEC_MACHO_H_ */

Cache object: 07ccd07aeb0c1300c205454b837885d9


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.