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_ecoff.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_ecoff.h,v 1.21 2017/02/23 18:54:30 christos Exp $ */
    2 
    3 /*
    4  * Copyright (c) 1994 Adam Glass
    5  * All rights reserved.
    6  *
    7  * Redistribution and use in source and binary forms, with or without
    8  * modification, are permitted provided that the following conditions
    9  * are met:
   10  * 1. Redistributions of source code must retain the above copyright
   11  *    notice, this list of conditions and the following disclaimer.
   12  * 2. Redistributions in binary form must reproduce the above copyright
   13  *    notice, this list of conditions and the following disclaimer in the
   14  *    documentation and/or other materials provided with the distribution.
   15  * 3. All advertising materials mentioning features or use of this software
   16  *    must display the following acknowledgement:
   17  *      This product includes software developed by Adam Glass.
   18  * 4. The name of the author may not be used to endorse or promote products
   19  *    derived from this software without specific prior written permission
   20  *
   21  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   22  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   23  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   24  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
   25  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
   26  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   30  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   31  */
   32 
   33 #ifndef _SYS_EXEC_ECOFF_H_
   34 #define _SYS_EXEC_ECOFF_H_
   35 
   36 #include <machine/ecoff_machdep.h>
   37 
   38 #ifdef ECOFF32_PAD
   39 
   40 typedef uint32_t ecoff32_addr;
   41 typedef uint32_t ecoff32_off;
   42 typedef uint32_t ecoff32_ulong;
   43 typedef int32_t ecoff32_long;
   44 typedef uint32_t ecoff32_uint;
   45 typedef int32_t ecoff32_int;
   46 typedef uint16_t ecoff32_ushort;
   47 typedef int16_t ecoff32_short;
   48 typedef uint8_t ecoff32_ubyte;
   49 typedef int8_t ecoff32_byte;
   50 
   51 struct ecoff32_filehdr {
   52         ecoff32_ushort  f_magic;        /* magic number */
   53         ecoff32_ushort  f_nscns;        /* # of sections */
   54         ecoff32_uint    f_timdat;       /* time and date stamp */
   55         ecoff32_ulong   f_symptr;       /* file offset of symbol table */
   56         ecoff32_uint    f_nsyms;        /* # of symbol table entries */
   57         ecoff32_ushort  f_opthdr;       /* sizeof the optional header */
   58         ecoff32_ushort  f_flags;        /* flags??? */
   59 };
   60 
   61 struct ecoff32_aouthdr {
   62         ecoff32_ushort  magic;
   63         ecoff32_ushort  vstamp;
   64         ECOFF32_PAD
   65         ecoff32_ulong   tsize;
   66         ecoff32_ulong   dsize;
   67         ecoff32_ulong   bsize;
   68         ecoff32_ulong   entry;
   69         ecoff32_ulong   text_start;
   70         ecoff32_ulong   data_start;
   71         ecoff32_ulong   bss_start;
   72         ECOFF32_MACHDEP;
   73 };
   74 
   75 struct ecoff32_scnhdr {                 /* needed for size info */
   76         char            s_name[8];      /* name */
   77         ecoff32_ulong   s_paddr;        /* physical addr? for ROMing?*/
   78         ecoff32_ulong   s_vaddr;        /* virtual addr? */
   79         ecoff32_ulong   s_size;         /* size */
   80         ecoff32_ulong   s_scnptr;       /* file offset of raw data */
   81         ecoff32_ulong   s_relptr;       /* file offset of reloc data */
   82         ecoff32_ulong   s_lnnoptr;      /* file offset of line data */
   83         ecoff32_ushort  s_nreloc;       /* # of relocation entries */
   84         ecoff32_ushort  s_nlnno;        /* # of line entries */
   85         ecoff32_uint    s_flags;        /* flags */
   86 };
   87 
   88 struct ecoff32_exechdr {
   89         struct ecoff32_filehdr f;
   90         struct ecoff32_aouthdr a;
   91 };
   92 
   93 #define ECOFF32_HDR_SIZE (sizeof(struct ecoff32_exechdr))
   94 
   95 #define ECOFF32_TXTOFF(ep) \
   96         ((ep)->a.magic == ECOFF_ZMAGIC ? 0 : \
   97          ECOFF_ROUND(ECOFF32_HDR_SIZE + (ep)->f.f_nscns * \
   98                      sizeof(struct ecoff32_scnhdr), ECOFF32_SEGMENT_ALIGNMENT(ep)))
   99 
  100 #define ECOFF32_DATOFF(ep) \
  101         (ECOFF_BLOCK_ALIGN((ep), ECOFF32_TXTOFF(ep) + (ep)->a.tsize))
  102 
  103 #define ECOFF32_SEGMENT_ALIGN(ep, value) \
  104         (ECOFF_ROUND((value), ((ep)->a.magic == ECOFF_ZMAGIC ? ECOFF_LDPGSZ : \
  105          ECOFF32_SEGMENT_ALIGNMENT(ep))))
  106 #endif
  107 
  108 struct ecoff_filehdr {
  109         u_short f_magic;        /* magic number */
  110         u_short f_nscns;        /* # of sections */
  111         u_int   f_timdat;       /* time and date stamp */
  112         u_long  f_symptr;       /* file offset of symbol table */
  113         u_int   f_nsyms;        /* # of symbol table entries */
  114         u_short f_opthdr;       /* sizeof the optional header */
  115         u_short f_flags;        /* flags??? */
  116 };
  117 
  118 struct ecoff_aouthdr {
  119         u_short magic;
  120         u_short vstamp;
  121         ECOFF_PAD
  122         u_long  tsize;
  123         u_long  dsize;
  124         u_long  bsize;
  125         u_long  entry;
  126         u_long  text_start;
  127         u_long  data_start;
  128         u_long  bss_start;
  129         ECOFF_MACHDEP;
  130 };
  131 
  132 struct ecoff_scnhdr {           /* needed for size info */
  133         char    s_name[8];      /* name */
  134         u_long  s_paddr;        /* physical addr? for ROMing?*/
  135         u_long  s_vaddr;        /* virtual addr? */
  136         u_long  s_size;         /* size */
  137         u_long  s_scnptr;       /* file offset of raw data */
  138         u_long  s_relptr;       /* file offset of reloc data */
  139         u_long  s_lnnoptr;      /* file offset of line data */
  140         u_short s_nreloc;       /* # of relocation entries */
  141         u_short s_nlnno;        /* # of line entries */
  142         u_int   s_flags;        /* flags */
  143 };
  144 
  145 struct ecoff_exechdr {
  146         struct ecoff_filehdr f;
  147         struct ecoff_aouthdr a;
  148 };
  149 
  150 #define ECOFF_HDR_SIZE (sizeof(struct ecoff_exechdr))
  151 
  152 #define ECOFF_OMAGIC 0407
  153 #define ECOFF_NMAGIC 0410
  154 #define ECOFF_ZMAGIC 0413
  155 
  156 #define ECOFF_ROUND(value, by) \
  157         (((value) + (by) - 1) & ~((by) - 1))
  158 
  159 #define ECOFF_BLOCK_ALIGN(ep, value) \
  160         ((ep)->a.magic == ECOFF_ZMAGIC ? ECOFF_ROUND((value), ECOFF_LDPGSZ) : \
  161          (value))
  162 
  163 #define ECOFF_TXTOFF(ep) \
  164         ((ep)->a.magic == ECOFF_ZMAGIC ? 0 : \
  165          ECOFF_ROUND(ECOFF_HDR_SIZE + (ep)->f.f_nscns * \
  166                      sizeof(struct ecoff_scnhdr), ECOFF_SEGMENT_ALIGNMENT(ep)))
  167 
  168 #define ECOFF_DATOFF(ep) \
  169         (ECOFF_BLOCK_ALIGN((ep), ECOFF_TXTOFF(ep) + (ep)->a.tsize))
  170 
  171 #define ECOFF_SEGMENT_ALIGN(ep, value) \
  172         (ECOFF_ROUND((value), ((ep)->a.magic == ECOFF_ZMAGIC ? ECOFF_LDPGSZ : \
  173          ECOFF_SEGMENT_ALIGNMENT(ep))))
  174 
  175 #ifdef _KERNEL
  176 int     exec_ecoff_makecmds(struct lwp *, struct exec_package *);
  177 int     cpu_exec_ecoff_probe(struct lwp *, struct exec_package *);
  178 void    cpu_exec_ecoff_setregs(struct lwp *, struct exec_package *, vaddr_t);
  179 
  180 int     exec_ecoff_prep_omagic(struct lwp *, struct exec_package *,
  181             struct ecoff_exechdr *, struct vnode *);
  182 int     exec_ecoff_prep_nmagic(struct lwp *, struct exec_package *,
  183             struct ecoff_exechdr *, struct vnode *);
  184 int     exec_ecoff_prep_zmagic(struct lwp *, struct exec_package *,
  185             struct ecoff_exechdr *, struct vnode *);
  186 
  187 #endif /* _KERNEL */
  188 #endif /* !_SYS_EXEC_ECOFF_H_ */

Cache object: 396a8f19c4be0f27a92da29845a688cd


[ 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.