1 1.6 uch /* $NetBSD: coff_machdep.h,v 1.6 2002/04/28 17:10:33 uch Exp $ */ 2 1.1 itojun 3 1.2 msaitoh /* 4 1.2 msaitoh * Copyright (c) 1994, 1995 Scott Bartram 5 1.1 itojun * All rights reserved. 6 1.1 itojun * 7 1.2 msaitoh * adapted from sys/sys/exec_ecoff.h 8 1.2 msaitoh * based on Intel iBCS2 9 1.1 itojun * 10 1.1 itojun * Redistribution and use in source and binary forms, with or without 11 1.1 itojun * modification, are permitted provided that the following conditions 12 1.1 itojun * are met: 13 1.1 itojun * 1. Redistributions of source code must retain the above copyright 14 1.1 itojun * notice, this list of conditions and the following disclaimer. 15 1.1 itojun * 2. Redistributions in binary form must reproduce the above copyright 16 1.1 itojun * notice, this list of conditions and the following disclaimer in the 17 1.1 itojun * documentation and/or other materials provided with the distribution. 18 1.2 msaitoh * 3. The name of the author may not be used to endorse or promote products 19 1.2 msaitoh * derived from this software without specific prior written permission 20 1.1 itojun * 21 1.2 msaitoh * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 22 1.2 msaitoh * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 1.2 msaitoh * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 24 1.2 msaitoh * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 25 1.2 msaitoh * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 26 1.2 msaitoh * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 1.2 msaitoh * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 1.2 msaitoh * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 1.2 msaitoh * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 30 1.2 msaitoh * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 1.1 itojun */ 32 1.1 itojun 33 1.2 msaitoh #ifndef _SH3_COFF_MACHDEP_H_ 34 1.6 uch #define _SH3_COFF_MACHDEP_H_ 35 1.1 itojun 36 1.2 msaitoh /* f_magic flags */ 37 1.6 uch #define COFF_MAGIC_SH3_BIG 0x500 38 1.6 uch #define COFF_MAGIC_SH3_LITTLE 0x550 39 1.2 msaitoh 40 1.2 msaitoh /* magic */ 41 1.6 uch #define COFF_OMAGIC 0444 /* text not write-protected; data seg 42 1.2 msaitoh is contiguous with text */ 43 1.6 uch #define COFF_NMAGIC 0410 /* text is write-protected; data starts 44 1.2 msaitoh at next seg following text */ 45 1.6 uch #define COFF_ZMAGIC 0000 /* text and data segs are aligned for 46 1.2 msaitoh direct paging */ 47 1.6 uch #define COFF_SMAGIC 0443 /* shared lib */ 48 1.2 msaitoh 49 1.6 uch #define COFF_LDPGSZ 4096 50 1.2 msaitoh 51 1.6 uch #define COFF_SEGMENT_ALIGNMENT(fp, ap) \ 52 1.2 msaitoh (((fp)->f_flags & COFF_F_EXEC) == 0 ? 4 : 16) 53 1.2 msaitoh 54 1.4 msaitoh #ifndef _BYTE_ORDER 55 1.4 msaitoh #error Define _BYTE_ORDER! 56 1.1 itojun #endif 57 1.1 itojun 58 1.4 msaitoh #if _BYTE_ORDER == BIG_ENDIAN 59 1.6 uch #define COFF_BADMAG(ex) ((ex)->f_magic != COFF_MAGIC_SH3_BIG) 60 1.2 msaitoh #endif 61 1.4 msaitoh #if _BYTE_ORDER == LITTLE_ENDIAN 62 1.6 uch #define COFF_BADMAG(ex) ((ex)->f_magic != COFF_MAGIC_SH3_LITTLE) 63 1.2 msaitoh #endif 64 1.2 msaitoh 65 1.6 uch #define IBCS2_HIGH_SYSCALL(n) (((n) & 0x7f) == 0x28) 66 1.6 uch #define IBCS2_CVT_HIGH_SYSCALL(n) (((n) >> 8) + 128) 67 1.2 msaitoh 68 1.2 msaitoh #ifdef DEBUG_COFF 69 1.6 uch #define DPRINTF(a) printf a; 70 1.2 msaitoh #else 71 1.6 uch #define DPRINTF(a) 72 1.2 msaitoh #endif 73 1.2 msaitoh 74 1.6 uch #define COFF_ES_SYMNMLEN 8 75 1.6 uch #define COFF_ES_SYMENTSZ 18 76 1.2 msaitoh 77 1.2 msaitoh struct external_syment { 78 1.2 msaitoh union { 79 1.2 msaitoh char e_name[COFF_ES_SYMNMLEN]; 80 1.2 msaitoh struct { 81 1.2 msaitoh char e_zeroes[4]; 82 1.2 msaitoh char e_offset[4]; 83 1.2 msaitoh } e; 84 1.2 msaitoh } e; 85 1.2 msaitoh char e_value[4]; 86 1.2 msaitoh char e_scnum[2]; 87 1.2 msaitoh char e_type[2]; 88 1.2 msaitoh char e_sclass[1]; 89 1.2 msaitoh char e_numaux[1]; 90 1.2 msaitoh }; 91 1.2 msaitoh 92 1.2 msaitoh #endif /* !_SH3_COFF_MACHDEP_H_ */ 93 1.1 itojun 94