OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [binutils-2.20.1/] [bfd/] [pef-traceback.h] - Blame information for rev 373

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 205 julius
/* PowerPC traceback table support for BFD.
2
   Copyright 1993, 1998, 1999, 2000, 2001, 2002, 2005, 2007
3
   Free Software Foundation, Inc.
4
 
5
   This file is part of BFD, the Binary File Descriptor library.
6
 
7
   This program is free software; you can redistribute it and/or modify
8
   it under the terms of the GNU General Public License as published by
9
   the Free Software Foundation; either version 3 of the License, or
10
   (at your option) any later version.
11
 
12
   This program is distributed in the hope that it will be useful,
13
   but WITHOUT ANY WARRANTY; without even the implied warranty of
14
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
   GNU General Public License for more details.
16
 
17
   You should have received a copy of the GNU General Public License
18
   along with this program; if not, write to the Free Software
19
   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
20
   MA 02110-1301, USA.  */
21
 
22
 
23
/* Originally written by Ira Ruben, 06/28/93.  */
24
 
25
/*  This is a compiler independent representation of the AIX Version 3 traceback table (in
26
    sys/debug.h), which occurs, usually, one per procedure (routine). The table is marked by
27
    a multiple of 4 32-bit word of zeroes in the instruction space. The traceback table is
28
    also referred to as "procedure-end table".
29
 
30
    The AIX traceback table representation on which this header is based is defined as a
31
    series of bit field struct specifications. Bit fields are compiler dependent! Thus,
32
    the definitions presented here follow the original header and the existing documentation
33
    (such as it is), but define the fields as BIT MASKS and other macros. The mask names,
34
    however, where chosen as the original field names to give some compatibility with the
35
    original header and to agree with the documentation.  */
36
 
37
#ifndef __TRACEBACK__
38
#define __TRACEBACK__
39
 
40
#define TB_C 0U                 /* C */
41
#define TB_FORTRAN 1U           /* FORTRAN */
42
#define TB_PASCAL 2U            /* Pascal */
43
#define TB_ADA 3U               /* ADA */
44
#define TB_PL1 4U               /* PL1 */
45
#define TB_BASIC 5U             /* Basic */
46
#define TB_LISP 6U              /* Lisp */
47
#define TB_COBOL 7U             /* eCobol */
48
#define TB_MODULA2 8U           /* Modula2 */
49
#define TB_CPLUSPLUS 9U         /* C++ */
50
#define TB_RPG 10U              /* RPG */
51
#define TB_PL8 11U              /* PL8 */
52
#define TB_ASM 12U              /* Asm */
53
 
54
/* Flags 1.  */
55
 
56
#define TB_GLOBALLINK 0x80U     /* Routine is Global Linkage.  */
57
#define TB_is_eprol 0x40U       /* Out-of-line prolog or epilog routine.  */
58
#define TB_HAS_TBOFF 0x20U      /* tb_offset set (extension field).  */
59
#define TB_INT_PROC 0x10U       /* Internal leaf routine.  */
60
#define TB_HAS_CTL 0x08U        /* Has controlled automatic storage.  */
61
#define TB_TOCLESS 0X04U        /* Routine has no TOC.  */
62
#define TB_FP_PRESENT 0x02U     /* Routine has floating point ops.  */ 
63
#define TB_LOG_ABORT 0x01U      /* fp_present && log/abort compiler opt.  */
64
 
65
/* Flags 2.  */
66
 
67
#define TB_INT_HNDL 0x80U       /* Routine is an interrupt handler.  */
68
#define TB_NAME_PRESENT 0x40U   /* Name_len/name set (extension field).  */
69
#define TB_USES_ALLOCA 0x20U    /* Uses alloca() to allocate storage.  */
70
#define TB_CL_DIS_inv 0x1CU     /* On-condition directives (see below).  */
71
#define TB_SAVES_CR 0x02U       /* Routine saves the CR.  */
72
#define TB_SAVES_LR 0x01U       /* Routine saves the LR.  */
73
 
74
/* cl_dis_inv "on condition" settings:  */
75
 
76
#define TB_CL_DIS_INV(x) (((x) & cl_dis_inv) >> 2U)
77
 
78
#define TB_WALK_ONCOND 0U       /* Walk stack without restoring state.  */
79
#define TB_DISCARD_ONCOND 1U    /* Walk stack and discard.  */
80
#define TB_INVOKE_ONCOND 2U     /* Invoke a specific system routine.  */
81
 
82
/* Flags 3.  */
83
 
84
#define TB_STORES_BC 0x80U      /* Routine saves frame ptr of caller.  */
85
#define TB_SPARE2 0X40U         /* Spare bit.  */
86
#define TB_FPR_SAVED 0x3fU      /* Number of FPRs saved (max of 32).  */
87
                                /* (Last reg saved is ALWAYS fpr31).  */
88
 
89
#define TB_NUM_FPR_SAVED(x) ((x) & fpr_saved)
90
 
91
/* Flags 4.  */
92
 
93
#define TB_HAS_VEC_INFO 0x80U   /* Routine uses vectors.  */
94
#define TB_SPARE3 0X40U         /* Spare bit.  */
95
#define TB_GPR_SAVED 0x3fU      /* Number of GPRs saved (max of 32).  */
96
                                /* (Last reg saved is ALWAYS gpr31).  */
97
 
98
#define TB_NUM_GPR_SAVED(x) ((x) & gpr_saved)
99
 
100
/* Flags 5.  */
101
 
102
#define TB_FLOATPARAMS 0xfeU    /* Number of floating point parameters.  */
103
#define TB_PARAMSONSTK 0X01U    /* All parameters are on the stack.  */
104
 
105
#define TB_NUM_FLOATPARAMS(X) (((x) & floatparams) >> 1U)
106
 
107
/* Traceback_table (fixed portion).  */
108
 
109
struct traceback_table
110
{
111
  /* Traceback table layout (fixed portion):  */
112
 
113
  unsigned char version;        /* Traceback format version.  */
114
  unsigned char lang;           /* Language indicators:  */
115
  unsigned char flags1;         /* Flag bits #1:  */
116
  unsigned char flags2;         /* Flag bits #2:  */
117
  unsigned char flags3;         /* Flag bits #3:  */
118
  unsigned char flags4;         /* Flag bits #4:  */
119
  unsigned char fixedparams;    /* Number of fixed point parameters.  */
120
  unsigned char flags5;         /* Flag bits #5:  */
121
};
122
 
123
/* traceback_table (optional) extensions.  */
124
 
125
/* Optional portions exist independently in the order presented below,
126
   not as a structure or a union. Whether or not portions exist is
127
   determinable from bit-fields within the fixed portion above.  */
128
 
129
/* The following is present only if fixedparams or floatparams are non
130
   zero and it immediately follows the fixed portion of the traceback
131
   table...  */
132
 
133
/* Order and type encoding of parameters:  */
134
struct traceback_table_fixedparams
135
{
136
  unsigned long paraminfo;
137
};
138
 
139
/* Left-justified bit-encoding as follows:  */
140
#define FIXED_PARAM 0           /* '0'  ==> fixed param (1 gpr or word).  */
141
#define SPFP_PARAM 2            /* '10' ==> single-precision float param.  */
142
#define DPFP_PARAM 3            /* '11' ==> double-precision float param.  */
143
 
144
#define PARAM_ENCODING(x, bit) /* Yields xxx_PARAM as a function of "bit".  */          \
145
 ((((x)&(1UL<<(31UL-(bit++))))==0UL) /* Values 0:31 (left-to-right). "bit" is */        \
146
 ? FIXED_PARAM /* an L-value that's left incremented to */                              \
147
 : ((((x)&(1UL<<(31UL-(bit++))))==0)/* the next bit position for the next */             \
148
 ? SPFP_PARAM /* parameter.  This will be 1 or 2 bit */                                 \
149
 : DPFP_PARAM)) /* positions later.  */
150
 
151
/* The following is present only if has_tboff (in flags1) in fixed part is present...  */
152
 
153
/* Offset from start of code to TracebackTbl.  */
154
struct traceback_table_tboff
155
{
156
  unsigned long tb_offset;
157
};
158
 
159
/* The following is present only if int_hndl (in flags2) in fixed part is present ...  */
160
 
161
/* What interrupts are handled by the routine.  */
162
struct traceback_table_interrupts
163
{
164
  long hand_mask;
165
};
166
 
167
/* The following are present only if has_ctl (in flags1) in fixed part is present...  */
168
 
169
/* Controlled automatic storage info:  */
170
struct traceback_table_anchors
171
{
172
  unsigned long ctl_info;       /* Number of controlled automatic anchors.  */
173
  long ctl_info_disp[1];        /* Array of stack displacements where each.  */
174
};                              /* Anchor is located (array STARTS here).  */
175
 
176
/* The following are present only if name_present (in flags2) in fixed
177
   part is present...  */
178
 
179
/* Routine name:  */
180
struct traceback_table_routine
181
{
182
  unsigned short name_len;      /* Length of name that follows.  */
183
  char name[1];                 /* Name starts here (NOT null terminated).  */
184
};
185
 
186
/* The following are present only if uses_alloca (in flags2) in fixed
187
   part is present...  */
188
 
189
/* Register auto storage when alloca() is used.  */
190
struct traceback_table_alloca
191
{
192
  char alloca_reg;
193
};
194
 
195
/* The following are present only if has_vec_info (in flags4) in fixed
196
   part is present...  */
197
 
198
/* Vector info:  */
199
struct traceback_table_vector
200
{
201
  unsigned char vec_flags1;     /* Vec info bits #1:  */
202
 
203
#define TB_VR_SAVED 0xFCU       /* Number of saved vector registers.  */
204
#define TB_SAVES_VRSAVE 0x02U   /* Saves VRsave.  */
205
#define TB_HAS_VARARGS 0x01U    /* Routine has a variable argument list.  */
206
 
207
#define TB_NUM_VR_SAVED(x) (((x) & TB_VR_SAVED) >> 2U)
208
 
209
  unsigned char vec_flags2;     /* Vec info bits #2:  */
210
 
211
#define TB_VECTORPARAMS 0xfeU   /* Number of vector parameters.  */
212
#define TB_VEC_PRESENT 0x01U    /* Routine uses at least one vec instr.  */
213
 
214
#define VECPARAMS(x) (((x) & TB_VECTORPARAMS) >> 1U)
215
};
216
 
217
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.