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