* mips-dis.c (print_insn_arg): Do not prefix 'P' arguments with '$'.
[deliverable/binutils-gdb.git] / bfd / evax.h
CommitLineData
8696b2db
ILT
1/* evax.h -- Header file for ALPHA EVAX (openVMS/Alpha) support.
2 Copyright 1996, 1997 Free Software Foundation, Inc.
3
4 Written by Klaus K"ampf (kkaempf@progis.de)
c3d8e071
ILT
5 of proGIS Softwareentwicklung, Aachen, Germany
6
7This file is part of BFD, the Binary File Descriptor library.
8
9This program is free software; you can redistribute it and/or modify
10it under the terms of the GNU General Public License as published by
11the Free Software Foundation; either version 2 of the License, or
12(at your option) any later version.
13
14This program is distributed in the hope that it will be useful,
15but WITHOUT ANY WARRANTY; without even the implied warranty of
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17GNU General Public License for more details.
18
19You should have received a copy of the GNU General Public License
20along with this program; if not, write to the Free Software
21Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
22
23#ifndef EVAX_H
24#define EVAX_H
25
26/* EVAX Text, information and relocation record (ETIR) definitions. */
27
28#define ETIR_S_C_MINSTACOD 0 /* Minimum store code */
29#define ETIR_S_C_STA_GBL 0 /* Stack global symbol value */
30#define ETIR_S_C_STA_LW 1 /* Stack longword */
31#define ETIR_S_C_STA_QW 2 /* Stack quadword */
32#define ETIR_S_C_STA_PQ 3 /* Stack psect base plus quadword offset */
33#define ETIR_S_C_STA_LI 4 /* Stack literal */
34#define ETIR_S_C_STA_MOD 5 /* Stack module */
35#define ETIR_S_C_STA_CKARG 6 /* Check Arguments */
36#define ETIR_S_C_MAXSTACOD 6 /* Maximum stack code */
37#define ETIR_S_C_MINSTOCOD 50 /* Minimum store code */
38#define ETIR_S_C_STO_B 50 /* Store byte */
39#define ETIR_S_C_STO_W 51 /* Store word */
40#define ETIR_S_C_STO_LW 52 /* Store longword */
41#define ETIR_S_C_STO_QW 53 /* Store quadword */
42#define ETIR_S_C_STO_IMMR 54 /* Store immediate Repeated */
43#define ETIR_S_C_STO_GBL 55 /* Store global */
44#define ETIR_S_C_STO_CA 56 /* Store code address */
45#define ETIR_S_C_STO_RB 57 /* Store relative branch */
46#define ETIR_S_C_STO_AB 58 /* Store absolute branch */
47#define ETIR_S_C_STO_OFF 59 /* Store offset within psect */
48#define ETIR_S_C_STO_IMM 61 /* Store immediate */
49#define ETIR_S_C_STO_GBL_LW 62 /* Store global Longword */
50#define ETIR_S_C_STO_LP_PSB 63 /* STO_LP_PSB not valid in level 2 use STC_LP_PSB */
51#define ETIR_S_C_STO_HINT_GBL 64 /* Store 14 bit HINT at global address */
52#define ETIR_S_C_STO_HINT_PS 65 /* Store 14 bit HINT at psect + offset */
53#define ETIR_S_C_MAXSTOCOD 65 /* Maximum store code */
54#define ETIR_S_C_MINOPRCOD 100 /* Minimum operate code */
55#define ETIR_S_C_OPR_NOP 100 /* No-op */
56#define ETIR_S_C_OPR_ADD 101 /* Add */
57#define ETIR_S_C_OPR_SUB 102 /* Subtract */
58#define ETIR_S_C_OPR_MUL 103 /* Multiply */
59#define ETIR_S_C_OPR_DIV 104 /* Divide */
60#define ETIR_S_C_OPR_AND 105 /* Logical AND */
61#define ETIR_S_C_OPR_IOR 106 /* Logical inclusive OR */
62#define ETIR_S_C_OPR_EOR 107 /* Logical exclusive OR */
63#define ETIR_S_C_OPR_NEG 108 /* Negate */
64#define ETIR_S_C_OPR_COM 109 /* Complement */
65#define ETIR_S_C_OPR_INSV 110 /* Insert bit field */
66#define ETIR_S_C_OPR_ASH 111 /* Arithmetic shift */
67#define ETIR_S_C_OPR_USH 112 /* Unsigned shift */
68#define ETIR_S_C_OPR_ROT 113 /* Rotate */
69#define ETIR_S_C_OPR_SEL 114 /* Select one of three longwords on top of stack */
70#define ETIR_S_C_OPR_REDEF 115 /* Redefine this symbol after pass 2 */
71#define ETIR_S_C_OPR_DFLIT 116 /* Define a literal */
72#define ETIR_S_C_MAXOPRCOD 116 /* Maximum operate code */
73#define ETIR_S_C_MINCTLCOD 150 /* Minimum control code */
74#define ETIR_S_C_CTL_SETRB 150 /* Set relocation base */
75#define ETIR_S_C_CTL_AUGRB 151 /* Augment relocation base */
76#define ETIR_S_C_CTL_DFLOC 152 /* Define debug location */
77#define ETIR_S_C_CTL_STLOC 153 /* Set debug location */
78#define ETIR_S_C_CTL_STKDL 154 /* Stack debug location */
79#define ETIR_S_C_MAXCTLCOD 154 /* Maximum control code */
80#define ETIR_S_C_MINSTCCOD 200 /* Minimum store-conditional code */
81#define ETIR_S_C_STC_LP 200 /* Store-conditional Linkage Pair */
82#define ETIR_S_C_STC_LP_PSB 201 /* Store-conditional Linkage Pair with Procedure Signature */
83#define ETIR_S_C_STC_GBL 202 /* Store-conditional Address at global address */
84#define ETIR_S_C_STC_GCA 203 /* Store-conditional Code Address at global address */
85#define ETIR_S_C_STC_PS 204 /* Store-conditional Address at psect + offset */
86#define ETIR_S_C_STC_NOP_GBL 205 /* Store-conditional NOP at address of global */
87#define ETIR_S_C_STC_NOP_PS 206 /* Store-conditional NOP at pect + offset */
88#define ETIR_S_C_STC_BSR_GBL 207 /* Store-conditional BSR at global address */
89#define ETIR_S_C_STC_BSR_PS 208 /* Store-conditional BSR at pect + offset */
90#define ETIR_S_C_STC_LDA_GBL 209 /* Store-conditional LDA at global address */
91#define ETIR_S_C_STC_LDA_PS 210 /* Store-conditional LDA at psect + offset */
92#define ETIR_S_C_STC_BOH_GBL 211 /* Store-conditional BSR or Hint at global address */
93#define ETIR_S_C_STC_BOH_PS 212 /* Store-conditional BSR or Hint at pect + offset */
94#define ETIR_S_C_STC_NBH_GBL 213 /* Store-conditional NOP,BSR or HINT at global address */
95#define ETIR_S_C_STC_NBH_PS 214 /* Store-conditional NOP,BSR or HINT at psect + offset */
96#define ETIR_S_C_MAXSTCCOD 214 /* Maximum store-conditional code */
97
98/* EVAX Global symbol definition record (EGSD). */
99
100#define EGSD_S_K_ENTRIES 2 /* Offset to first entry in record */
101#define EGSD_S_C_ENTRIES 2 /* Offset to first entry in record */
102#define EGSD_S_C_PSC 0 /* Psect definition */
103#define EGSD_S_C_SYM 1 /* Symbol specification */
104#define EGSD_S_C_IDC 2 /* Random entity check */
105#define EGSD_S_C_SPSC 5 /* Shareable image psect definition */
106#define EGSD_S_C_SYMV 6 /* Vectored (dual-valued) versions of SYM, */
107#define EGSD_S_C_SYMM 7 /* Masked versions of SYM, */
108#define EGSD_S_C_SYMG 8 /* EGST - gst version of SYM */
109#define EGSD_S_C_MAXRECTYP 8 /* Maximum entry type defined */
110
111#define EGPS_S_V_PIC 0x0001
112#define EGPS_S_V_LIB 0x0002
113#define EGPS_S_V_OVR 0x0004
114#define EGPS_S_V_REL 0x0008
115#define EGPS_S_V_GBL 0x0010
116#define EGPS_S_V_SHR 0x0020
117#define EGPS_S_V_EXE 0x0040
118#define EGPS_S_V_RD 0x0080
119#define EGPS_S_V_WRT 0x0100
120#define EGPS_S_V_VEC 0x0200
121#define EGPS_S_V_NOMOD 0x0400
122#define EGPS_S_V_COM 0x0800
123
124#define EGSY_S_V_WEAK 0x0001
125#define EGSY_S_V_DEF 0x0002
126#define EGSY_S_V_UNI 0x0004
127#define EGSY_S_V_REL 0x0008
128#define EGSY_S_V_COMM 0x0010
129#define EGSY_S_V_VECEP 0x0020
130#define EGSY_S_V_NORM 0x0040
131
132/* EVAX Module header record (EMH) definitions. */
133
134#define EMH_S_C_MHD 0 /* Main header record */
135#define EMH_S_C_LNM 1 /* Language name and version */
136#define EMH_S_C_SRC 2 /* Source file specification */
137#define EMH_S_C_TTL 3 /* Title text of module */
138#define EMH_S_C_CPR 4 /* Copyright notice */
139#define EMH_S_C_MTC 5 /* Maintenance status */
140#define EMH_S_C_GTX 6 /* General text */
141#define EMH_S_C_MAXHDRTYP 6 /* Maximum allowable type */
142
143/* evax-alpha.c. */
144
145extern asymbol *_bfd_evax_make_empty_symbol PARAMS ((bfd *abfd));
146
147/* evax-egsd.c. */
148
149extern int _bfd_evax_slurp_egsd PARAMS ((bfd *abfd));
150extern int _bfd_evax_write_egsd PARAMS ((bfd *abfd));
151
152/* evax-emh.c. */
153
154extern int _bfd_evax_slurp_emh PARAMS ((bfd *abfd));
155extern int _bfd_evax_write_emh PARAMS ((bfd *abfd));
156extern int _bfd_evax_slurp_eeom PARAMS ((bfd *abfd));
157extern int _bfd_evax_write_eeom PARAMS ((bfd *abfd));
158
159/* evax-etir.c. */
160
161extern int _bfd_evax_slurp_etir PARAMS ((bfd *abfd));
162extern int _bfd_evax_slurp_edbg PARAMS ((bfd *abfd));
163extern int _bfd_evax_slurp_etbt PARAMS ((bfd *abfd));
164
165extern int _bfd_evax_write_etir PARAMS ((bfd *abfd));
166extern int _bfd_evax_write_etbt PARAMS ((bfd *abfd));
167extern int _bfd_evax_write_edbg PARAMS ((bfd *abfd));
168
169/* The r_type field in a reloc is one of the following values. */
170#define ALPHA_R_IGNORE 0
171#define ALPHA_R_REFQUAD 1
172#define ALPHA_R_BRADDR 2
173#define ALPHA_R_HINT 3
174#define ALPHA_R_SREL16 4
175#define ALPHA_R_SREL32 5
176#define ALPHA_R_SREL64 6
177#define ALPHA_R_OP_PUSH 7
178#define ALPHA_R_OP_STORE 8
179#define ALPHA_R_OP_PSUB 9
180#define ALPHA_R_OP_PRSHIFT 10
181#define ALPHA_R_LINKAGE 11
8612a388 182#define ALPHA_R_REFLONG 12
8696b2db 183#define ALPHA_R_CODEADDR 13
c3d8e071
ILT
184
185/* Object language definitions. */
186
187#define EOBJ_S_C_EMH 8 /*EVAX module header record */
188#define EOBJ_S_C_EEOM 9 /*EVAX end of module record */
189#define EOBJ_S_C_EGSD 10 /*EVAX global symbol definition record */
190#define EOBJ_S_C_ETIR 11 /*EVAX text information record */
191#define EOBJ_S_C_EDBG 12 /*EVAX Debugger information record */
192#define EOBJ_S_C_ETBT 13 /*EVAX Traceback information record */
193#define EOBJ_S_C_MAXRECTYP 13 /*Last assigned record type */
194#define EOBJ_S_K_SUBTYP 4
195#define EOBJ_S_C_SUBTYP 4
196#define EOBJ_S_C_MAXRECSIZ 8192 /*Maximum legal record size */
197#define EOBJ_S_C_STRLVL 2 /*Structure level */
412222d9
ILT
198#define EOBJ_S_C_SYMSIZ 64 /*Maximum symbol length */
199#define EOBJ_S_C_SECSIZ 31 /*Maximum section name length */
c3d8e071
ILT
200#define EOBJ_S_C_STOREPLIM -1 /*Maximum repeat count on store commands */
201#define EOBJ_S_C_PSCALILIM 16 /*Maximum p-sect alignment */
202
203/* Miscellaneous definitions. */
204
205#if __GNUC__
206typedef unsigned long long uquad;
207#else
208typedef unsigned long uquad;
209#endif
210
211#define MAX_OUTREC_SIZE 4096
212#define MIN_OUTREC_LUFT 64
213
214typedef struct _evax_section {
215 unsigned char *contents;
216 bfd_vma offset;
217 bfd_size_type size;
218 struct _evax_section *next;
219} evax_section;
220
221extern boolean _bfd_save_evax_section
222 PARAMS ((bfd *abfd, asection *section, PTR data, file_ptr offset,
223 bfd_size_type count));
224extern evax_section *_bfd_get_evax_section PARAMS ((bfd *abfd, int index));
225
226typedef struct _evax_reloc {
227 struct _evax_reloc *next;
228 arelent *reloc;
229 asection *section;
230} evax_reloc;
231
232/* evax module header */
233
234struct emh_struc {
235 int emh_b_strlvl;
236 long emh_l_arch1;
237 long emh_l_arch2;
238 long emh_l_recsiz;
239 char *emh_t_name;
240 char *emh_t_version;
241 char *emh_t_date;
242 char *emh_c_lnm;
243 char *emh_c_src;
244 char *emh_c_ttl;
245};
246
247
248/* evax end of module */
249
250struct eeom_struc {
251 long eeom_l_total_lps;
252 unsigned char eeom_b_comcod;
253 boolean eeom_has_transfer;
254 unsigned char eeom_b_tfrflg;
255 long eeom_l_psindx;
256 long eeom_l_tfradr;
257};
258
259enum file_format_enum { FF_UNKNOWN, FF_FOREIGN, FF_NATIVE };
260
261typedef struct evax_symbol_struct {
262 struct bfd_hash_entry bfd_hash;
263 asymbol *symbol;
264} evax_symbol_entry;
265
266/* stack value for push/pop commands */
267
268struct stack_struct {
269 uquad value;
270 int psect;
271};
272#define STACKSIZE 50
273
274/* location stack definitions for CTL_DFLOC, CTL_STLOC, and CTL_STKDL */
275
276struct location_struct {
277 unsigned long value;
278 int psect;
279};
280#define LOCATION_SAVE_SIZE 32
281
412222d9 282#define EVAX_SECTION_COUNT 1024
c3d8e071
ILT
283
284struct evax_private_data_struct {
c3d8e071
ILT
285 boolean fixup_done; /* Flag to indicate if all
286 section pointers and PRIV(sections)
287 are set up correctly */
288 unsigned char *evax_buf; /* buffer to record */
289 int buf_size; /* max size of buffer */
290 unsigned char *evax_rec; /* actual record ptr */
291 int rec_length; /* remaining record length */
292 int rec_size; /* actual record size */
293 int rec_type; /* actual record type */
294 enum file_format_enum file_format;
295
296 struct emh_struc emh_data; /* data from EMH record */
297 struct eeom_struc eeom_data; /* data from EEOM record */
298 int egsd_sec_count; /* # of EGSD sections */
299 asection **sections; /* vector of EGSD sections */
300 int egsd_sym_count; /* # of EGSD symbols */
301 asymbol **symbols; /* vector of EGSD symbols */
302 struct proc_value *procedure;
303
304 struct stack_struct *stack;
305 int stackptr;
306
307 evax_section *evax_section_table[EVAX_SECTION_COUNT];
c3d8e071
ILT
308
309 struct bfd_hash_table *evax_symbol_table;
310 struct symbol_cache_entry **symcache;
311 int symnum;
312
313 struct location_struct *location_stack;
314
315 unsigned char *image_ptr; /* a pointer to section->contents */
316
317 unsigned char pdsc[8]; /* procedure descriptor */
318
319 /* Output routine storage */
320
321 unsigned char *output_buf; /* output data */
322 int push_level;
323 int pushed_size;
324 int length_pos;
325 int output_size;
326 int output_alignment;
327
328 /* linkage index counter
329 used by conditional store commands (ETIR_S_C_STC_) */
330
331 int evax_linkage_index;
332
bf53bd9f 333 /* see tc-alpha.c of gas for a description. */
8696b2db
ILT
334 int flag_hash_long_names; /* -+, hash instead of truncate */
335 int flag_show_after_trunc; /* -H, show hashing/truncation */
c3d8e071
ILT
336};
337
338#define PRIV(name) ((struct evax_private_data_struct *)abfd->tdata.any)->name
339
340#if EVAX_DEBUG
341extern void _bfd_evax_debug PARAMS((int level, char *format, ...));
342extern void _bfd_hexdump
343 PARAMS ((int level, unsigned char *ptr, int size, int offset));
344
345#define evax_debug _bfd_evax_debug
346
347#endif
348
349extern struct bfd_hash_entry *_bfd_evax_hash_newfunc
350 PARAMS ((struct bfd_hash_entry *entry, struct bfd_hash_table *table,
351 const char *string));
352extern void _bfd_evax_get_header_values
353 PARAMS ((bfd *abfd, unsigned char *buf, int *type, int *length));
354extern int _bfd_evax_get_record PARAMS ((bfd *abfd));
355extern int _bfd_evax_next_record PARAMS ((bfd *abfd));
356
357extern char *_bfd_evax_save_sized_string PARAMS ((char *str, int size));
358extern char *_bfd_evax_save_counted_string PARAMS ((char *ptr));
359extern void _bfd_evax_push PARAMS ((bfd *abfd, uquad val, int psect));
360extern uquad _bfd_evax_pop PARAMS ((bfd *abfd, int *psect));
361
362extern boolean _bfd_save_evax_section
363 PARAMS ((bfd *abfd, asection *section, PTR data, file_ptr offset,
364 bfd_size_type count));
365extern void _bfd_evax_output_begin
366 PARAMS ((bfd *abfd, int rectype, int rechead));
367extern void _bfd_evax_output_alignment PARAMS ((bfd *abfd, int alignto));
368extern void _bfd_evax_output_push PARAMS ((bfd *abfd));
369extern void _bfd_evax_output_pop PARAMS ((bfd *abfd));
370extern void _bfd_evax_output_flush PARAMS ((bfd *abfd));
371extern void _bfd_evax_output_end PARAMS ((bfd *abfd));
372extern int _bfd_evax_output_check PARAMS ((bfd *abfd, int size));
373extern void _bfd_evax_output_byte PARAMS ((bfd *abfd, unsigned int value));
374extern void _bfd_evax_output_short PARAMS ((bfd *abfd, unsigned int value));
375extern void _bfd_evax_output_long PARAMS ((bfd *abfd, unsigned long value));
376extern void _bfd_evax_output_quad PARAMS ((bfd *abfd, uquad value));
377extern void _bfd_evax_output_counted PARAMS ((bfd *abfd, char *value));
378extern void _bfd_evax_output_dump PARAMS ((bfd *abfd, unsigned char *data,
379 int length));
380extern void _bfd_evax_output_fill PARAMS ((bfd *abfd, int value, int length));
412222d9 381extern char *_bfd_evax_length_hash_symbol PARAMS ((bfd *abfd, const char *in, int maxlen));
c3d8e071
ILT
382
383#endif /* EVAX_H */
This page took 0.084497 seconds and 4 git commands to generate.