| 1 | /* Oasys object format header file for BFD. |
| 2 | Contributed by Cygnus Support. */ |
| 3 | |
| 4 | #define OASYS_MAX_SEC_COUNT 16 |
| 5 | /* **** */ |
| 6 | |
| 7 | typedef struct oasys_archive_header { |
| 8 | unsigned int version; |
| 9 | char create_date[12]; |
| 10 | char revision_date[12]; |
| 11 | unsigned int mod_count; |
| 12 | file_ptr mod_tbl_offset; |
| 13 | unsigned int sym_tbl_size; |
| 14 | unsigned int sym_count; |
| 15 | file_ptr sym_tbl_offset; |
| 16 | unsigned int xref_count; |
| 17 | file_ptr xref_lst_offset; |
| 18 | } oasys_archive_header_type; |
| 19 | |
| 20 | typedef struct oasys_extarchive_header { |
| 21 | bfd_byte version[4]; |
| 22 | bfd_byte create_date[12]; |
| 23 | bfd_byte revision_date[12]; |
| 24 | bfd_byte mod_count[4]; |
| 25 | bfd_byte mod_tbl_offset[4]; |
| 26 | bfd_byte sym_tbl_size[4]; |
| 27 | bfd_byte sym_count[4]; |
| 28 | bfd_byte sym_tbl_offset[4]; |
| 29 | bfd_byte xref_count[4]; |
| 30 | bfd_byte xref_lst_offset[4]; |
| 31 | } oasys_extarchive_header_type; |
| 32 | |
| 33 | typedef struct oasys_module_table { |
| 34 | int mod_number; |
| 35 | char mod_date[12]; |
| 36 | unsigned int mod_size; |
| 37 | unsigned int dep_count; |
| 38 | unsigned int depee_count; |
| 39 | file_ptr file_offset; |
| 40 | unsigned int sect_count; |
| 41 | char *module_name; |
| 42 | unsigned int module_name_size; |
| 43 | } oasys_module_table_type; |
| 44 | |
| 45 | |
| 46 | typedef struct oasys_extmodule_table_a { |
| 47 | bfd_byte mod_number[4]; |
| 48 | bfd_byte mod_date[12]; |
| 49 | bfd_byte mod_size[4]; |
| 50 | bfd_byte dep_count[4]; |
| 51 | bfd_byte depee_count[4]; |
| 52 | bfd_byte sect_count[4]; |
| 53 | bfd_byte file_offset[4]; |
| 54 | bfd_byte mod_name[32]; |
| 55 | } oasys_extmodule_table_type_a_type; |
| 56 | |
| 57 | typedef struct oasys_extmodule_table_b { |
| 58 | bfd_byte mod_number[4]; |
| 59 | bfd_byte mod_date[12]; |
| 60 | bfd_byte mod_size[4]; |
| 61 | bfd_byte dep_count[4]; |
| 62 | bfd_byte depee_count[4]; |
| 63 | bfd_byte sect_count[4]; |
| 64 | bfd_byte file_offset[4]; |
| 65 | bfd_byte mod_name_length[4]; |
| 66 | } oasys_extmodule_table_type_b_type; |
| 67 | |
| 68 | |
| 69 | typedef enum oasys_record { |
| 70 | oasys_record_is_end_enum = 0, |
| 71 | oasys_record_is_data_enum = 1, |
| 72 | oasys_record_is_symbol_enum = 2, |
| 73 | oasys_record_is_header_enum = 3, |
| 74 | oasys_record_is_named_section_enum = 4, |
| 75 | oasys_record_is_com_enum = 5, |
| 76 | oasys_record_is_debug_enum = 6, |
| 77 | oasys_record_is_section_enum = 7, |
| 78 | oasys_record_is_debug_file_enum = 8, |
| 79 | oasys_record_is_module_enum = 9, |
| 80 | oasys_record_is_local_enum = 10 |
| 81 | } oasys_record_enum_type; |
| 82 | |
| 83 | |
| 84 | |
| 85 | typedef struct oasys_record_header { |
| 86 | unsigned char length; |
| 87 | unsigned char check_sum; |
| 88 | unsigned char type; |
| 89 | unsigned char fill; |
| 90 | } oasys_record_header_type; |
| 91 | |
| 92 | typedef struct oasys_data_record { |
| 93 | oasys_record_header_type header; |
| 94 | unsigned char relb; |
| 95 | bfd_byte addr[4]; |
| 96 | /* maximum total size of data record is 255 bytes */ |
| 97 | bfd_byte data[246]; |
| 98 | } oasys_data_record_type; |
| 99 | |
| 100 | typedef struct oasys_header_record { |
| 101 | oasys_record_header_type header; |
| 102 | unsigned char version_number; |
| 103 | unsigned char rev_number; |
| 104 | char module_name[26-6]; |
| 105 | char description[64-26]; |
| 106 | } oasys_header_record_type; |
| 107 | |
| 108 | #define OASYS_VERSION_NUMBER 0 |
| 109 | #define OASYS_REV_NUMBER 0 |
| 110 | |
| 111 | typedef struct oasys_symbol_record { |
| 112 | oasys_record_header_type header; |
| 113 | unsigned char relb; |
| 114 | bfd_byte value[4]; |
| 115 | bfd_byte refno[2]; |
| 116 | char name[64]; |
| 117 | } oasys_symbol_record_type; |
| 118 | |
| 119 | #define RELOCATION_PCREL_BIT 0x80 |
| 120 | #define RELOCATION_32BIT_BIT 0x40 |
| 121 | #define RELOCATION_TYPE_BITS 0x30 |
| 122 | #define RELOCATION_TYPE_ABS 0x00 |
| 123 | #define RELOCATION_TYPE_REL 0x10 |
| 124 | #define RELOCATION_TYPE_UND 0x20 |
| 125 | #define RELOCATION_TYPE_COM 0x30 |
| 126 | #define RELOCATION_SECT_BITS 0x0f |
| 127 | |
| 128 | typedef struct oasys_section_record { |
| 129 | oasys_record_header_type header; |
| 130 | unsigned char relb; |
| 131 | bfd_byte value[4]; |
| 132 | bfd_byte vma[4]; |
| 133 | bfd_byte fill[3]; |
| 134 | } oasys_section_record_type; |
| 135 | |
| 136 | typedef struct oasys_end_record { |
| 137 | oasys_record_header_type header; |
| 138 | unsigned char relb; |
| 139 | bfd_byte entry[4]; |
| 140 | bfd_byte fill[2]; |
| 141 | bfd_byte zero; |
| 142 | } oasys_end_record_type; |
| 143 | |
| 144 | typedef union oasys_record_union { |
| 145 | oasys_record_header_type header; |
| 146 | oasys_data_record_type data; |
| 147 | oasys_section_record_type section; |
| 148 | oasys_symbol_record_type symbol; |
| 149 | oasys_header_record_type first; |
| 150 | oasys_end_record_type end; |
| 151 | bfd_byte pad[256]; |
| 152 | } oasys_record_union_type; |