Annotation of sys/sys/exec_ecoff.h, Revision 1.1
1.1 ! nbrk 1: /* $OpenBSD: exec_ecoff.h,v 1.7 2002/03/14 01:27:14 millert Exp $ */
! 2: /* $NetBSD: exec_ecoff.h,v 1.9 1996/05/09 23:42:08 cgd Exp $ */
! 3:
! 4: /*
! 5: * Copyright (c) 1994 Adam Glass
! 6: * All rights reserved.
! 7: *
! 8: * Redistribution and use in source and binary forms, with or without
! 9: * modification, are permitted provided that the following conditions
! 10: * are met:
! 11: * 1. Redistributions of source code must retain the above copyright
! 12: * notice, this list of conditions and the following disclaimer.
! 13: * 2. Redistributions in binary form must reproduce the above copyright
! 14: * notice, this list of conditions and the following disclaimer in the
! 15: * documentation and/or other materials provided with the distribution.
! 16: * 3. All advertising materials mentioning features or use of this software
! 17: * must display the following acknowledgement:
! 18: * This product includes software developed by Adam Glass.
! 19: * 4. The name of the author may not be used to endorse or promote products
! 20: * derived from this software without specific prior written permission
! 21: *
! 22: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
! 23: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
! 24: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
! 25: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
! 26: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
! 27: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
! 28: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
! 29: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
! 30: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
! 31: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
! 32: */
! 33:
! 34: #ifndef _SYS_EXEC_ECOFF_H_
! 35: #define _SYS_EXEC_ECOFF_H_
! 36:
! 37: #include <machine/ecoff_machdep.h>
! 38:
! 39: struct ecoff_filehdr {
! 40: u_short f_magic; /* magic number */
! 41: u_short f_nscns; /* # of sections */
! 42: u_int f_timdat; /* time and date stamp */
! 43: u_long f_symptr; /* file offset of symbol table */
! 44: u_int f_nsyms; /* # of symbol table entries */
! 45: u_short f_opthdr; /* sizeof the optional header */
! 46: u_short f_flags; /* flags??? */
! 47: };
! 48:
! 49: struct ecoff_aouthdr {
! 50: u_short magic;
! 51: u_short vstamp;
! 52: ECOFF_PAD
! 53: u_long tsize;
! 54: u_long dsize;
! 55: u_long bsize;
! 56: u_long entry;
! 57: u_long text_start;
! 58: u_long data_start;
! 59: u_long bss_start;
! 60: ECOFF_MACHDEP;
! 61: };
! 62:
! 63: struct ecoff_scnhdr { /* needed for size info */
! 64: char s_name[8]; /* name */
! 65: u_long s_paddr; /* physical addr? for ROMing?*/
! 66: u_long s_vaddr; /* virtual addr? */
! 67: u_long s_size; /* size */
! 68: u_long s_scnptr; /* file offset of raw data */
! 69: u_long s_relptr; /* file offset of reloc data */
! 70: u_long s_lnnoptr; /* file offset of line data */
! 71: u_short s_nreloc; /* # of relocation entries */
! 72: u_short s_nlnno; /* # of line entries */
! 73: u_int s_flags; /* flags */
! 74: };
! 75:
! 76: struct ecoff_exechdr {
! 77: struct ecoff_filehdr f;
! 78: struct ecoff_aouthdr a;
! 79: };
! 80:
! 81: #define ECOFF_HDR_SIZE (sizeof(struct ecoff_exechdr))
! 82:
! 83: #define ECOFF_OMAGIC 0407
! 84: #define ECOFF_NMAGIC 0410
! 85: #define ECOFF_ZMAGIC 0413
! 86:
! 87: #define ECOFF_ROUND(value, by) \
! 88: (((value) + (by) - 1) & ~((by) - 1))
! 89:
! 90: #define ECOFF_BLOCK_ALIGN(ep, value) \
! 91: ((ep)->a.magic == ECOFF_ZMAGIC ? ECOFF_ROUND((value), ECOFF_LDPGSZ) : \
! 92: (value))
! 93:
! 94: #define ECOFF_TXTOFF(ep) \
! 95: ((ep)->a.magic == ECOFF_ZMAGIC ? 0 : \
! 96: ECOFF_ROUND(ECOFF_HDR_SIZE + (ep)->f.f_nscns * \
! 97: sizeof(struct ecoff_scnhdr), ECOFF_SEGMENT_ALIGNMENT(ep)))
! 98:
! 99: #define ECOFF_DATOFF(ep) \
! 100: (ECOFF_BLOCK_ALIGN((ep), ECOFF_TXTOFF(ep) + (ep)->a.tsize))
! 101:
! 102: #define ECOFF_SEGMENT_ALIGN(ep, value) \
! 103: (ECOFF_ROUND((value), ((ep)->a.magic == ECOFF_ZMAGIC ? ECOFF_LDPGSZ : \
! 104: ECOFF_SEGMENT_ALIGNMENT(ep))))
! 105:
! 106: #ifdef _KERNEL
! 107: int exec_ecoff_makecmds(struct proc *, struct exec_package *);
! 108: int cpu_exec_ecoff_hook(struct proc *, struct exec_package *);
! 109: int exec_ecoff_prep_omagic(struct proc *, struct exec_package *);
! 110: int exec_ecoff_prep_nmagic(struct proc *, struct exec_package *);
! 111: int exec_ecoff_prep_zmagic(struct proc *, struct exec_package *);
! 112: #endif /* _KERNEL */
! 113: #endif /* !_SYS_EXEC_ECOFF_H_ */
CVSweb