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/compat/pecoff/imgact_pecoff.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$      */
    2 /* $FreeBSD: releng/6.3/sys/compat/pecoff/imgact_pecoff.h 139743 2005-01-05 22:34:37Z imp $     */
    3 /*-
    4  * Copyright (c) 2000 Masaru OKI
    5  */
    6 
    7 #ifndef _PECOFF_EXEC_H_
    8 #define _PECOFF_EXEC_H_
    9 
   10 struct pecoff_dos_filehdr {
   11         u_int16_t       d_magic;/* +0x00 'MZ' */
   12         u_int8_t        d_stub[0x3a];
   13         u_int32_t       d_peofs;/* +0x3c */
   14 };
   15 
   16 #define PECOFF_DOS_MAGIC 0x5a4d
   17 #define PECOFF_DOS_HDR_SIZE (sizeof(struct pecoff_dos_filehdr))
   18 
   19 #define DOS_BADMAG(dp) ((dp)->d_magic != PECOFF_DOS_MAGIC)
   20 
   21 /*
   22  * COFF file header
   23  */
   24 
   25 struct coff_filehdr {
   26         u_short         f_magic;/* magic number */
   27         u_short         f_nscns;/* # of sections */
   28         long            f_timdat;       /* timestamp */
   29         long            f_symptr;       /* file offset of symbol table */
   30         long            f_nsyms;/* # of symbol table entries */
   31         u_short         f_opthdr;       /* size of optional header */
   32         u_short         f_flags;/* flags */
   33 };
   34 
   35 /*
   36  * COFF system header
   37  */
   38 
   39 struct coff_aouthdr {
   40         short           a_magic;
   41         short           a_vstamp;
   42         long            a_tsize;
   43         long            a_dsize;
   44         long            a_bsize;
   45         long            a_entry;
   46         long            a_tstart;
   47         long            a_dstart;
   48 };
   49 
   50 /* magic */
   51 #define COFF_OMAGIC     0407    /* text not write-protected; data seg is
   52                                  * contiguous with text */
   53 #define COFF_NMAGIC     0410    /* text is write-protected; data starts at
   54                                  * next seg following text */
   55 #define COFF_ZMAGIC     0413    /* text and data segs are aligned for direct
   56                                  * paging */
   57 #define COFF_SMAGIC     0443    /* shared lib */
   58 
   59 struct pecoff_imghdr {
   60         long            i_vaddr;
   61         long            i_size;
   62 };
   63 
   64 struct pecoff_opthdr {
   65         long            w_base;
   66         long            w_salign;
   67         long            w_falign;
   68         long            w_osvers;
   69         long            w_imgvers;
   70         long            w_subvers;
   71         long            w_rsvd;
   72         long            w_imgsize;
   73         long            w_hdrsize;
   74         long            w_chksum;
   75         u_short         w_subsys;
   76         u_short         w_dllflags;
   77         long            w_ssize;
   78         long            w_cssize;
   79         long            w_hsize;
   80         long            w_chsize;
   81         long            w_lflag;
   82         long            w_nimghdr;
   83         struct pecoff_imghdr w_imghdr[16];
   84 };
   85 
   86 /*
   87  * COFF section header
   88  */
   89 
   90 struct coff_scnhdr {
   91         char            s_name[8];
   92         long            s_paddr;
   93         long            s_vaddr;
   94         long            s_size;
   95         long            s_scnptr;
   96         long            s_relptr;
   97         long            s_lnnoptr;
   98         u_short         s_nreloc;
   99         u_short         s_nlnno;
  100         long            s_flags;
  101 };
  102 
  103 /* s_flags */
  104 #define COFF_STYP_REG           0x00
  105 #define COFF_STYP_DSECT         0x01
  106 #define COFF_STYP_NOLOAD        0x02
  107 #define COFF_STYP_GROUP         0x04
  108 #define COFF_STYP_PAD           0x08
  109 #define COFF_STYP_COPY          0x10
  110 #define COFF_STYP_TEXT          0x20
  111 #define COFF_STYP_DATA          0x40
  112 #define COFF_STYP_BSS           0x80
  113 #define COFF_STYP_INFO          0x200
  114 #define COFF_STYP_OVER          0x400
  115 #define COFF_STYP_SHLIB         0x800
  116 /* s_flags for PE */
  117 #define COFF_STYP_DISCARD       0x2000000
  118 #define COFF_STYP_EXEC          0x20000000
  119 #define COFF_STYP_READ          0x40000000
  120 #define COFF_STYP_WRITE         0x80000000
  121 
  122 struct pecoff_args {
  123         u_long          a_base;
  124         u_long          a_entry;
  125         u_long          a_end;
  126         u_long          a_subsystem;
  127         struct pecoff_imghdr a_imghdr[16];
  128         u_long          a_ldbase;
  129         u_long          a_ldexport;
  130 };
  131 
  132 #define COFF_LDPGSZ 4096        
  133 #define COFF_ALIGN(a) ((a) & ~(COFF_LDPGSZ - 1))
  134 #define COFF_ROUND(a) COFF_ALIGN((a) + COFF_LDPGSZ - 1)
  135 
  136 #define COFF_HDR_SIZE \
  137         (sizeof(struct coff_filehdr) + sizeof(struct coff_aouthdr))
  138 
  139 #define PECOFF_HDR_SIZE (COFF_HDR_SIZE + sizeof(struct pecoff_opthdr))
  140 
  141 
  142 #endif

Cache object: 92855821915592fe4efef1a55d776c6c


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