oasys.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. /* Oasys object format header file for BFD.
  2. Copyright (C) 2001-2022 Free Software Foundation, Inc.
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 3, or (at your option)
  6. any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 51 Franklin Street - Fifth Floor,
  14. Boston, MA 02110-1301, USA.
  15. Contributed by Cygnus Support. */
  16. #define OASYS_MAX_SEC_COUNT 16
  17. /* **** */
  18. typedef struct oasys_archive_header
  19. {
  20. unsigned int version;
  21. char create_date[12];
  22. char revision_date[12];
  23. unsigned int mod_count;
  24. file_ptr mod_tbl_offset;
  25. unsigned int sym_tbl_size;
  26. unsigned int sym_count;
  27. file_ptr sym_tbl_offset;
  28. unsigned int xref_count;
  29. file_ptr xref_lst_offset;
  30. }
  31. oasys_archive_header_type;
  32. typedef struct oasys_extarchive_header
  33. {
  34. bfd_byte version[4];
  35. bfd_byte create_date[12];
  36. bfd_byte revision_date[12];
  37. bfd_byte mod_count[4];
  38. bfd_byte mod_tbl_offset[4];
  39. bfd_byte sym_tbl_size[4];
  40. bfd_byte sym_count[4];
  41. bfd_byte sym_tbl_offset[4];
  42. bfd_byte xref_count[4];
  43. bfd_byte xref_lst_offset[4];
  44. }
  45. oasys_extarchive_header_type;
  46. typedef struct oasys_module_table
  47. {
  48. int mod_number;
  49. char mod_date[12];
  50. unsigned int mod_size;
  51. unsigned int dep_count;
  52. unsigned int depee_count;
  53. file_ptr file_offset;
  54. unsigned int sect_count;
  55. char *module_name;
  56. unsigned int module_name_size;
  57. }
  58. oasys_module_table_type;
  59. typedef struct oasys_extmodule_table_a
  60. {
  61. bfd_byte mod_number[4];
  62. bfd_byte mod_date[12];
  63. bfd_byte mod_size[4];
  64. bfd_byte dep_count[4];
  65. bfd_byte depee_count[4];
  66. bfd_byte sect_count[4];
  67. bfd_byte file_offset[4];
  68. bfd_byte mod_name[32];
  69. }
  70. oasys_extmodule_table_type_a_type;
  71. typedef struct oasys_extmodule_table_b
  72. {
  73. bfd_byte mod_number[4];
  74. bfd_byte mod_date[12];
  75. bfd_byte mod_size[4];
  76. bfd_byte dep_count[4];
  77. bfd_byte depee_count[4];
  78. bfd_byte sect_count[4];
  79. bfd_byte file_offset[4];
  80. bfd_byte mod_name_length[4];
  81. }
  82. oasys_extmodule_table_type_b_type;
  83. typedef enum oasys_record
  84. {
  85. oasys_record_is_end_enum = 0,
  86. oasys_record_is_data_enum = 1,
  87. oasys_record_is_symbol_enum = 2,
  88. oasys_record_is_header_enum = 3,
  89. oasys_record_is_named_section_enum = 4,
  90. oasys_record_is_com_enum = 5,
  91. oasys_record_is_debug_enum = 6,
  92. oasys_record_is_section_enum = 7,
  93. oasys_record_is_debug_file_enum = 8,
  94. oasys_record_is_module_enum = 9,
  95. oasys_record_is_local_enum = 10
  96. }
  97. oasys_record_enum_type;
  98. typedef struct oasys_record_header
  99. {
  100. unsigned char length;
  101. unsigned char check_sum;
  102. unsigned char type;
  103. unsigned char fill;
  104. }
  105. oasys_record_header_type;
  106. typedef struct oasys_data_record
  107. {
  108. oasys_record_header_type header;
  109. unsigned char relb;
  110. bfd_byte addr[4];
  111. /* maximum total size of data record is 255 bytes */
  112. bfd_byte data[246];
  113. }
  114. oasys_data_record_type;
  115. typedef struct oasys_header_record
  116. {
  117. oasys_record_header_type header;
  118. unsigned char version_number;
  119. unsigned char rev_number;
  120. char module_name[26-6];
  121. char description[64-26];
  122. }
  123. oasys_header_record_type;
  124. #define OASYS_VERSION_NUMBER 0
  125. #define OASYS_REV_NUMBER 0
  126. typedef struct oasys_symbol_record
  127. {
  128. oasys_record_header_type header;
  129. unsigned char relb;
  130. bfd_byte value[4];
  131. bfd_byte refno[2];
  132. char name[64];
  133. }
  134. oasys_symbol_record_type;
  135. #define RELOCATION_PCREL_BIT 0x80
  136. #define RELOCATION_32BIT_BIT 0x40
  137. #define RELOCATION_TYPE_BITS 0x30
  138. #define RELOCATION_TYPE_ABS 0x00
  139. #define RELOCATION_TYPE_REL 0x10
  140. #define RELOCATION_TYPE_UND 0x20
  141. #define RELOCATION_TYPE_COM 0x30
  142. #define RELOCATION_SECT_BITS 0x0f
  143. typedef struct oasys_section_record
  144. {
  145. oasys_record_header_type header;
  146. unsigned char relb;
  147. bfd_byte value[4];
  148. bfd_byte vma[4];
  149. bfd_byte fill[3];
  150. }
  151. oasys_section_record_type;
  152. typedef struct oasys_end_record
  153. {
  154. oasys_record_header_type header;
  155. unsigned char relb;
  156. bfd_byte entry[4];
  157. bfd_byte fill[2];
  158. bfd_byte zero;
  159. }
  160. oasys_end_record_type;
  161. typedef union oasys_record_union
  162. {
  163. oasys_record_header_type header;
  164. oasys_data_record_type data;
  165. oasys_section_record_type section;
  166. oasys_symbol_record_type symbol;
  167. oasys_header_record_type first;
  168. oasys_end_record_type end;
  169. bfd_byte pad[256];
  170. }
  171. oasys_record_union_type;