1 1.1 itohy /* 2 1.1 itohy * a.out file structure definitions 3 1.1 itohy * 4 1.1 itohy * written by Yasha (ITOH Yasufumi) 5 1.1 itohy * public domain 6 1.1 itohy * 7 1.1 itohy * $NetBSD: aout68k.h,v 1.1 1998/09/01 19:51:08 itohy Exp $ 8 1.1 itohy */ 9 1.1 itohy /* 10 1.1 itohy * NetBSD/m68k a.out format (OMAGIC, NMAGIC) 11 1.1 itohy * 12 1.1 itohy * ---------------------------- 13 1.1 itohy * | file header (32 bytes) | 14 1.1 itohy * |--------------------------| 15 1.1 itohy * | text | 16 1.1 itohy * |--------------------------| 17 1.1 itohy * | data | 18 1.1 itohy * |--------------------------| 19 1.1 itohy * | text relocation table | 20 1.1 itohy * |--------------------------| 21 1.1 itohy * | data relocation table | 22 1.1 itohy * |--------------------------| 23 1.1 itohy * | symbol table | 24 1.1 itohy * |--------------------------| 25 1.1 itohy * | string table | 26 1.1 itohy * ---------------------------- 27 1.1 itohy * 28 1.1 itohy * OMAGIC: text and data segments are loaded contiguous 29 1.1 itohy * NMAGIC: data segment is loaded at the next page of the text 30 1.1 itohy */ 31 1.1 itohy 32 1.1 itohy struct aout_m68k { 33 1.1 itohy be_uint32_t a_magic; /* encoded magic number */ 34 1.1 itohy be_uint32_t a_text; /* size of text section */ 35 1.1 itohy be_uint32_t a_data; /* size of data section */ 36 1.1 itohy be_uint32_t a_bss; /* size of bss */ 37 1.1 itohy be_uint32_t a_syms; /* size of symbol table */ 38 1.1 itohy be_uint32_t a_entry; /* entry point address */ 39 1.1 itohy be_uint32_t a_trsize; /* size of text relocation */ 40 1.1 itohy be_uint32_t a_drsize; /* size of data relocation */ 41 1.1 itohy }; 42 1.1 itohy 43 1.1 itohy #define AOUT_GET_MAGIC(e) (((e)->a_magic.val[2]<<8) | (e)->a_magic.val[3]) 44 1.1 itohy #define AOUT_OMAGIC 0407 45 1.1 itohy #define AOUT_NMAGIC 0410 46 1.1 itohy #define AOUT_ZMAGIC 0413 /* demand paging --- header is in the text */ 47 1.1 itohy 48 1.1 itohy #define AOUT_GET_FLAGS(e) ((e)->a_magic.val[0] >> 2) 49 1.1 itohy #define AOUT_FLAG_PIC 0x10 50 1.1 itohy #define AOUT_FLAG_DYNAMIC 0x20 51 1.1 itohy 52 1.1 itohy /* machine ID */ 53 1.1 itohy #define AOUT_GET_MID(e) ((((e)->a_magic.val[0] & 0x03) << 8) | \ 54 1.1 itohy (e)->a_magic.val[1]) 55 1.1 itohy #define AOUT_MID_M68K 135 /* m68k BSD binary, 8KB page */ 56 1.1 itohy #define AOUT_MID_M68K4K 136 /* m68k BSD binary, 4KB page */ 57 1.1 itohy 58 1.1 itohy #define AOUT_PAGESIZE(e) (AOUT_GET_MAGIC(e) == AOUT_OMAGIC ? 1 : \ 59 1.1 itohy AOUT_GET_MID(e) == AOUT_MID_M68K ? 8192 : 4096) 60