OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gdb-7.2/] [gdb/] [or32-tdep.h] - Blame information for rev 861

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

Line No. Rev Author Line
1 330 jeremybenn
/* Definitions to target GDB to OpenRISC 1000 32-bit targets.
2
 
3
   Copyright 2001 Free Software Foundation, Inc.
4
   Copyright (C) 2008, 2010 Embecosm Limited
5
 
6
   Contributor Jeremy Bennett <jeremy.bennett@embecosm.com>
7
 
8
   This file is part of GDB.
9
 
10
   This program is free software; you can redistribute it and/or modify it
11
   under the terms of the GNU General Public License as published by the Free
12
   Software Foundation; either version 3 of the License, or (at your option)
13
   any later version.
14
 
15
   This program is distributed in the hope that it will be useful, but WITHOUT
16
   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
18
   more details.
19
 
20
   You should have received a copy of the GNU General Public License along
21
   with this program.  If not, see <http://www.gnu.org/licenses/>.  */
22
 
23
 
24
#ifndef OR32_TDEP__H
25
#define OR32_TDEP__H
26
 
27
#ifndef TARGET_OR32
28
#define TARGET_OR32
29
#endif
30
 
31
/*-----------------------------------------------------------------------------
32
   This version for the OpenRISC 1000 architecture is a rewrite by Jeremy
33
   Bennett of the old GDB 5.3 interface to make use of gdbarch for GDB 6.8.
34
 
35
   The code tries to follow the GDB coding style. All OR32 specific globals
36
   should have names beginning ork1_ or OR32_.
37
 
38
   Commenting is Doxygen compatible.
39
 
40
   Much has been stripped out. See the files or32-tdep.c, remote-or32.c and
41
   or32-jtag.c for details of what has changed.
42
   --------------------------------------------------------------------------*/
43
 
44
 
45
/*! Byte array for the TRAP instruction used for breakpoints */
46
#define OR32_BRK_INSTR_STRUCT  {0x21, 0x00, 0x00, 0x01}
47
/*! Numeric instruction used for a breakpoint */
48
#define OR32_BRK_INSTR 0x21000001
49
 
50
/*! Numeric instruction used for a l.nop NOP_EXIT */
51
#define  OR32_NOP_EXIT 0x15000001
52
 
53
/* Special purpose groups */
54
 
55
#define OR32_SPG_SIZE_BITS  11
56
#define OR32_SPG_SIZE       (1 << OR32_SPG_SIZE_BITS)
57
 
58
#define OR32_SPG_SYS      0
59
#define OR32_SPG_DMMU     1
60
#define OR32_SPG_IMMU     2
61
#define OR32_SPG_DC       3
62
#define OR32_SPG_IC       4
63
#define OR32_SPG_MAC      5
64
#define OR32_SPG_DEBUG    6
65
#define OR32_SPG_PC       7
66
#define OR32_SPG_PM       8
67
#define OR32_SPG_PIC      9
68
#define OR32_SPG_TT      10
69
#define OR32_SPG_FPU     11
70
 
71
#define OR32_NUM_SPGS   (OR32_SPG_FPU + 1)
72
 
73
/* Special register group offsets */
74
 
75
#define OR32_SPG_SYS_VR          0
76
#define OR32_SPG_SYS_UPR         1
77
#define OR32_SPG_SYS_CPUCFGR     2
78
#define OR32_SPG_SYS_DMMUCFGR    3
79
#define OR32_SPG_SYS_IMMUCFGR    4
80
#define OR32_SPG_SYS_DCCFGR      5
81
#define OR32_SPG_SYS_ICCFGR      6
82
#define OR32_SPG_SYS_DCFGR       7
83
#define OR32_SPG_SYS_PCCFGR      8
84
#define OR32_SPG_SYS_NPC        16
85
#define OR32_SPG_SYS_SR         17
86
#define OR32_SPG_SYS_PPC        18
87
#define OR32_SPG_SYS_FPCSR      20
88
#define OR32_SPG_SYS_EPCR       32
89
#define OR32_SPG_SYS_EPCR_END  (OR32_SPG_SYS_EPCR + 15)
90
#define OR32_SPG_SYS_EEAR       48
91
#define OR32_SPG_SYS_EEAR_END  (OR32_SPG_SYS_EEAR + 15)
92
#define OR32_SPG_SYS_ESR        64
93
#define OR32_SPG_SYS_ESR_END   (OR32_SPG_SYS_ESR + 15)
94
#define OR32_SPG_SYS_GPR      1024
95
#define OR32_SPG_SYS_GPR_END   (OR32_SPG_SYS_GPR + OR32_MAX_GPR_REGS)
96
#define OR32_SPG_SYS_LAST       OR32_SPG_SYS_GPR_END
97
 
98
#define OR32_SPG_DMMU_DMMUCR           0
99
#define OR32_SPG_DMMU_DMMUPR           1
100
#define OR32_SPG_DMMU_DTLBEIR          2
101
#define OR32_SPG_DMMU_DATBMR           4
102
#define OR32_SPG_DMMU_DATBMR_END   (OR32_SPG_DMMU_DATBMR + 3)
103
#define OR32_SPG_DMMU_DATBTR           8
104
#define OR32_SPG_DMMU_DATBTR_END   (OR32_SPG_DMMU_DATBTR + 3)
105
#define OR32_SPG_DMMU_DTLBW0MR       512
106
#define OR32_SPG_DMMU_DTLBW0MR_END (OR32_SPG_DMMU_DTLBW0MR + 127)
107
#define OR32_SPG_DMMU_DTLBW0TR       640
108
#define OR32_SPG_DMMU_DTLBW0TR_END (OR32_SPG_DMMU_DTLBW0TR + 127)
109
#define OR32_SPG_DMMU_DTLBW1MR       768
110
#define OR32_SPG_DMMU_DTLBW1MR_END (OR32_SPG_DMMU_DTLBW1MR + 127)
111
#define OR32_SPG_DMMU_DTLBW1TR       896
112
#define OR32_SPG_DMMU_DTLBW1TR_END (OR32_SPG_DMMU_DTLBW1TR + 127)
113
#define OR32_SPG_DMMU_DTLBW2MR      1024
114
#define OR32_SPG_DMMU_DTLBW2MR_END (OR32_SPG_DMMU_DTLBW2MR + 127)
115
#define OR32_SPG_DMMU_DTLBW2TR      1152
116
#define OR32_SPG_DMMU_DTLBW2TR_END (OR32_SPG_DMMU_DTLBW2TR + 127)
117
#define OR32_SPG_DMMU_DTLBW3MR      1280
118
#define OR32_SPG_DMMU_DTLBW3MR_END (OR32_SPG_DMMU_DTLBW3MR + 127)
119
#define OR32_SPG_DMMU_DTLBW3TR      1408
120
#define OR32_SPG_DMMU_DTLBW3TR_END (OR32_SPG_DMMU_DTLBW3TR + 127)
121
#define OR32_SPG_DMMU_LAST          OR32_SPG_DMMU_DTLBW3TR_END
122
 
123
#define OR32_SPG_IMMU_IMMUCR           0
124
#define OR32_SPG_IMMU_IMMUPR           1
125
#define OR32_SPG_IMMU_ITLBEIR          2
126
#define OR32_SPG_IMMU_IATBMR           4
127
#define OR32_SPG_IMMU_IATBMR_END   (OR32_SPG_IMMU_IATBMR + 3)
128
#define OR32_SPG_IMMU_IATBTR           8
129
#define OR32_SPG_IMMU_IATBTR_END   (OR32_SPG_IMMU_IATBTR + 3)
130
#define OR32_SPG_IMMU_ITLBW0MR       512
131
#define OR32_SPG_IMMU_ITLBW0MR_END (OR32_SPG_IMMU_ITLBW0MR + 127)
132
#define OR32_SPG_IMMU_ITLBW0TR       640
133
#define OR32_SPG_IMMU_ITLBW0TR_END (OR32_SPG_IMMU_ITLBW0TR + 127)
134
#define OR32_SPG_IMMU_ITLBW1MR       768
135
#define OR32_SPG_IMMU_ITLBW1MR_END (OR32_SPG_IMMU_ITLBW1MR + 127)
136
#define OR32_SPG_IMMU_ITLBW1TR       896
137
#define OR32_SPG_IMMU_ITLBW1TR_END (OR32_SPG_IMMU_ITLBW1TR + 127)
138
#define OR32_SPG_IMMU_ITLBW2MR      1024
139
#define OR32_SPG_IMMU_ITLBW2MR_END (OR32_SPG_IMMU_ITLBW2MR + 127)
140
#define OR32_SPG_IMMU_ITLBW2TR      1152
141
#define OR32_SPG_IMMU_ITLBW2TR_END (OR32_SPG_IMMU_ITLBW2TR + 127)
142
#define OR32_SPG_IMMU_ITLBW3MR      1280
143
#define OR32_SPG_IMMU_ITLBW3MR_END (OR32_SPG_IMMU_ITLBW3MR + 127)
144
#define OR32_SPG_IMMU_ITLBW3TR      1408
145
#define OR32_SPG_IMMU_ITLBW3TR_END (OR32_SPG_IMMU_ITLBW3TR + 127)
146
#define OR32_SPG_IMMU_LAST          OR32_SPG_IMMU_ITLBW3TR_END
147
 
148
#define OR32_SPG_DC_DCCR   0
149
#define OR32_SPG_DC_DCBPR  1
150
#define OR32_SPG_DC_DCBFR  2
151
#define OR32_SPG_DC_DCBIR  3
152
#define OR32_SPG_DC_DCBWR  4
153
#define OR32_SPG_DC_DCBLR  5
154
#define OR32_SPG_DC_LAST   OR32_SPG_DC_DCBLR
155
 
156
#define OR32_SPG_IC_ICCR   0
157
#define OR32_SPG_IC_ICBPR  1
158
#define OR32_SPG_IC_ICBIR  2
159
#define OR32_SPG_IC_ICBLR  3
160
#define OR32_SPG_IC_LAST   OR32_SPG_IC_ICBLR
161
 
162
#define OR32_SPG_MAC_MACLO  1
163
#define OR32_SPG_MAC_MACHI  2
164
#define OR32_SPG_MAC_LAST   OR32_SPG_MAC_MACHI
165
 
166
#define OR32_SPG_DEBUG_DVR      0
167
#define OR32_SPG_DEBUG_DVR_END (OR32_SPG_DEBUG_DVR + 7)
168
#define OR32_SPG_DEBUG_DCR      8
169
#define OR32_SPG_DEBUG_DCR_END (OR32_SPG_DEBUG_DCR + 7)
170
#define OR32_SPG_DEBUG_DMR1   16
171
#define OR32_SPG_DEBUG_DMR2   17
172
#define OR32_SPG_DEBUG_DCWR0  18
173
#define OR32_SPG_DEBUG_DCWR1  19
174
#define OR32_SPG_DEBUG_DSR    20
175
#define OR32_SPG_DEBUG_DRR    21
176
#define OR32_SPG_DEBUG_LAST   OR32_SPG_DEBUG_DRR
177
 
178
#define OR32_SPG_PC_PCCR       0
179
#define OR32_SPG_PC_PCCR_END  (OR32_SPG_PC_PCCR + 7)
180
#define OR32_SPG_PC_PCMR       8
181
#define OR32_SPG_PC_PCMR_END  (OR32_SPG_PC_PCMR + 7)
182
#define OR32_SPG_PC_LAST       OR32_SPG_PC_PCMR_END
183
 
184
#define OR32_SPG_PM_PMR     0
185
#define OR32_SPG_PM_LAST    OR32_SPG_PM_PMR
186
 
187
#define OR32_SPG_PIC_PICMR  0
188
#define OR32_SPG_PIC_PICSR  2
189
#define OR32_SPG_PIC_LAST   OR32_SPG_PIC_PICSR
190
 
191
#define OR32_SPG_TT_TTMR    0
192
#define OR32_SPG_TT_TTCR    1
193
#define OR32_SPG_TT_LAST    OR32_SPG_TT_TTCR
194
 
195
#define OR32_SPG_FPU_LAST  -1
196
 
197
 
198
/* Define absolute SPR values from group and index  */
199
#define OR32_SPR(group, index) (((group) << OR32_SPG_SIZE_BITS) + (index))
200
 
201
/* System group registers */
202
#define OR32_VR_SPRNUM       OR32_SPR (OR32_SPG_SYS, OR32_SPG_SYS_VR)
203
#define OR32_UPR_SPRNUM      OR32_SPR (OR32_SPG_SYS, OR32_SPG_SYS_UPR)
204
#define OR32_CPUCFGR_SPRNUM  OR32_SPR (OR32_SPG_SYS, OR32_SPG_SYS_CPUCFGR)
205
#define OR32_DCFGR_SPRNUM    OR32_SPR (OR32_SPG_SYS, OR32_SPG_SYS_DCFGR)
206
#define OR32_NPC_SPRNUM      OR32_SPR (OR32_SPG_SYS, OR32_SPG_SYS_NPC)
207
#define OR32_SR_SPRNUM       OR32_SPR (OR32_SPG_SYS, OR32_SPG_SYS_SR)
208
#define OR32_PPC_SPRNUM      OR32_SPR (OR32_SPG_SYS, OR32_SPG_SYS_PPC)
209
#define OR32_EPCR_SPRNUM     OR32_SPR (OR32_SPG_SYS, OR32_SPG_SYS_EPCR)
210
 
211
/* Debug group registers */
212
#define OR32_DVR0_SPRNUM     OR32_SPR (OR32_SPG_DEBUG, OR32_SPG_DEBUG_DVR)
213
#define OR32_DCR0_SPRNUM     OR32_SPR (OR32_SPG_DEBUG, OR32_SPG_DEBUG_DCR)
214
#define OR32_DMR1_SPRNUM     OR32_SPR (OR32_SPG_DEBUG, OR32_SPG_DEBUG_DMR1)
215
#define OR32_DMR2_SPRNUM     OR32_SPR (OR32_SPG_DEBUG, OR32_SPG_DEBUG_DMR2)
216
#define OR32_DCWR0_SPRNUM    OR32_SPR (OR32_SPG_DEBUG, OR32_SPG_DEBUG_DCWR0)
217
#define OR32_DCWR1_SPRNUM    OR32_SPR (OR32_SPG_DEBUG, OR32_SPG_DEBUG_DCWR0)
218
#define OR32_DSR_SPRNUM      OR32_SPR (OR32_SPG_DEBUG, OR32_SPG_DEBUG_DSR)
219
#define OR32_DRR_SPRNUM      OR32_SPR (OR32_SPG_DEBUG, OR32_SPG_DEBUG_DRR)
220
 
221
/* General Purpose Registers */
222
#define OR32_ZERO_REGNUM          0
223
#define OR32_SP_REGNUM            1
224
#define OR32_FP_REGNUM            2
225
#define OR32_FIRST_ARG_REGNUM     3
226
#define OR32_LAST_ARG_REGNUM      8
227
#define OR32_LR_REGNUM            9
228
#define OR32_FIRST_SAVED_REGNUM  10
229
#define OR32_RV_REGNUM           11
230
#define OR32_PPC_REGNUM          (OR32_MAX_GPR_REGS + 0)
231
#define OR32_NPC_REGNUM          (OR32_MAX_GPR_REGS + 1)
232
#define OR32_SR_REGNUM           (OR32_MAX_GPR_REGS + 2)
233
 
234
/* Defines for Debug Control Register bits */
235
 
236
#define OR32_DCR_DP        0x0000001    /* DVR/DCR Present */
237
#define OR32_DCR_CC        0x000000e    /* Compare condition */
238
#define OR32_DCR_CC_OFF            1    /* Compare condition offset */
239
#define OR32_DCR_SC        0x0000010    /* Signed compare */
240
#define OR32_DCR_CT        0x00000e0    /* Compare type */
241
#define OR32_DCR_CT_OFF            5    /* Compare type offset */
242
 
243
/* Defines for Debug Mode Register 1 bits.  */
244
#define OR32_DMR1_CW       0x00000003   /* Mask for CW bits */
245
#define OR32_DMR1_CW_AND   0x00000001   /* Chain watchpoint 0 AND */
246
#define OR32_DMR1_CW_OR    0x00000002   /* Chain watchpoint 0 OR */
247
#define OR32_DMR1_CW_SZ             2   /* Number of bits for each WP */
248
#define OR32_DMR1_ST       0x00400000   /* Single-step trace */
249
#define OR32_DMR1_BT       0x00800000   /* Branch trace */
250
 
251
/* Defines for Debug Mode Register 2 bits.  */
252
#define OR32_DMR2_WCE0       0x00000001 /* Watchpoint counter enable 0 */
253
#define OR32_DMR2_WCE1       0x00000002 /* Watchpoint counter enable 1 */
254
#define OR32_DMR2_AWTC_MASK  0x00000ffc /* Assign watchpoints to ctr mask */
255
#define OR32_DMR2_WGB_MASK   0x003ff000 /* Watchpoints generaing brk mask */
256
#define OR32_DMR2_WBS_MASK   0xffc00000 /* Watchpoint brkpt status mask */
257
#define OR32_DMR2_AWTC_OFF    2         /* Assign watchpoints to ctr offset */
258
#define OR32_DMR2_WGB_OFF    12         /* Watchpoints generating brk offset */
259
#define OR32_DMR2_WBS_OFF    22         /* Watchpoint brkpt status offset */
260
 
261
/* Defines for Debug Stop Register.  */
262
#define OR32_DSR_RSTE    0x00000001     /* Reset exception */
263
#define OR32_DSR_BUSEE   0x00000002     /* Bus error exception */
264
#define OR32_DSR_DPFE    0x00000004     /* Data page fault exception */
265
#define OR32_DSR_IPFE    0x00000008     /* Instrution page fault exception */
266
#define OR32_DSR_TTE     0x00000010     /* Tick timer exception */
267
#define OR32_DSR_AE      0x00000020     /* Alignment exception */
268
#define OR32_DSR_IIE     0x00000040     /* Illegal instruction exception */
269
#define OR32_DSR_INTE    0x00000080     /* Interrupt exception */
270
#define OR32_DSR_DME     0x00000100     /* DTLB miss exception */
271
#define OR32_DSR_IME     0x00000200     /* ITLB miss exception */
272
#define OR32_DSR_RE      0x00000400     /* Range exception */
273
#define OR32_DSR_SCE     0x00000800     /* System call exception */
274
#define OR32_DSR_FPE     0x00001000     /* Floating point exception */
275
#define OR32_DSR_TE      0x00002000     /* Trap exception */
276
 
277
/* Defines for Debug Reason Register bits */
278
#define OR32_DRR_RSTE    0x00000001     /* Reset exception */
279
#define OR32_DRR_BUSEE   0x00000002     /* Bus error exception */
280
#define OR32_DRR_DPFE    0x00000004     /* Data page fault exception */
281
#define OR32_DRR_IPFE    0x00000008     /* Instrution page fault exception */
282
#define OR32_DRR_TTE     0x00000010     /* Tick timer exception */
283
#define OR32_DRR_AE      0x00000020     /* Alignment exception */
284
#define OR32_DRR_IIE     0x00000040     /* Illegal instruction exception */
285
#define OR32_DRR_INTE    0x00000080     /* Interrupt exception */
286
#define OR32_DRR_DME     0x00000100     /* DTLB miss exception */
287
#define OR32_DRR_IME     0x00000200     /* ITLB miss exception */
288
#define OR32_DRR_RE      0x00000400     /* Range exception */
289
#define OR32_DRR_SCE     0x00000800     /* System call exception */
290
#define OR32_DRR_FPE     0x00001000     /* Floating point exception */
291
#define OR32_DRR_TE      0x00002000     /* Trap exception */
292
 
293
/* Bit definitions for the Unit Present Register */
294
#define OR32_SPR_UPR_UP         0x00000001  /* UPR present */
295
#define OR32_SPR_UPR_DCP        0x00000002  /* Data cache present */
296
#define OR32_SPR_UPR_ICP        0x00000004  /* Instruction cache present */
297
#define OR32_SPR_UPR_DMP        0x00000008  /* Data MMU present */
298
#define OR32_SPR_UPR_IMP        0x00000010  /* Instruction MMU present */
299
#define OR32_SPR_UPR_MP         0x00000020  /* MAC present */
300
#define OR32_SPR_UPR_DUP        0x00000040  /* Debug unit present */
301
#define OR32_SPR_UPR_PCUP       0x00000080  /* Perf counters unit present */
302
#define OR32_SPR_UPR_PMP        0x00000100  /* Power management present */
303
#define OR32_SPR_UPR_PICP       0x00000200  /* PIC present */
304
#define OR32_SPR_UPR_TTP        0x00000400  /* Tick timer present */
305
 
306
/* Bit definitions for the CPU Configuration Register */
307
#define OR32_SPR_CPUCFGR_NSGF   0x0000000f  /* Number of shadow GPR files */
308
#define OR32_SPR_CPUCFGR_CGF    0x00000010  /* Custom GPR file */
309
#define OR32_SPR_CPUCFGR_OB32S  0x00000020  /* ORBIS32 supported */
310
#define OR32_SPR_CPUCFGR_OB64S  0x00000040  /* ORBIS64 supported */
311
#define OR32_SPR_CPUCFGR_OF32S  0x00000080  /* ORFPX32 supported */
312
#define OR32_SPR_CPUCFGR_OF64S  0x00000100  /* ORFPX64 supported */
313
#define OR32_SPR_CPUCFGR_OV64S  0x00000400  /* ORVDX64 supported */
314
 
315
/* Bit definitions for the Debug configuration register */
316
#define OR32_SPR_DCFGR_NDP      0x00000007  /* Number of matchpoints */
317
#define OR32_SPR_DCFGR_WPCI     0x00000008  /* Watchpoint ctrs implemented */
318
 
319
/* Properties of the architecture. GDB mapping of registers is all the GPRs
320
   followed by the PPC, NPC and SR at the end. Red zone is the area past the
321
   end of the stack reserved for exception handlers etc. */
322
#define OR32_MAX_GPR_REGS           32
323
#define OR32_NUM_PSEUDO_REGS         0
324
#define OR32_NUM_REGS               (OR32_MAX_GPR_REGS + 3)
325
#define OR32_TOTAL_NUM_REGS         (OR32_NUM_REGS + OR32_NUM_PSEUDO_REGS)
326
#define OR32_MAX_MATCHPOINTS         8
327
#define OR32_MAX_HW_WATCHES          OR32_MAX_MATCHPOINTS
328
#define OR32_STACK_ALIGN             4
329
#define OR32_INSTLEN                 4
330
#define OR32_INSTBITLEN              (OR32_INSTLEN * 8)
331
#define OR32_NUM_TAP_RECORDS         8
332
#define OR32_FRAME_RED_ZONE_SIZE  2536
333
 
334
/* OR32 exception vectors */
335
 
336
#define OR32_RESET_VECTOR   0x100
337
#define OR32_BUSERR_VECTOR  0x200
338
#define OR32_DPF_VECTOR     0x300
339
#define OR32_IPF_VECTOR     0x400
340
#define OR32_TT_VECTOR      0x500
341
#define OR32_ALIGN_VECTOR   0x600
342
#define OR32_ILL_VECTOR     0x700
343
#define OR32_EXT_VECTOR     0x800
344
#define OR32_DTLB_VECTOR    0x900
345
#define OR32_ITLB_VECTOR    0xa00
346
#define OR32_RANGE_VECTOR   0xb00
347
#define OR32_SYS_VECTOR     0xc00
348
#define OR32_FP_VECTOR      0xd00
349
#define OR32_TRAP_VECTOR    0xe00
350
 
351
/* Constants and macros to break out instruction fields. I'd expect these in
352
   the assembler header, but they aren't there (for now). */
353
 
354
#define OR32_SEXT16(v) (((v) & 0x00008000) ? ((v) - 0x00010000) : (v))
355
#define OR32_SEXT26(v) (((v) & 0x02000000) ? ((v) - 0x04000000) : (v))
356
 
357
#define OR32_OPCODE1(i)  (((i) & 0xfc000000) >> 26)
358
#define OR32_OPCODE2(i) ((((i) & 0xfc000000) >> 20) | \
359
                         (((i) & 0x00000300) >>  6) | \
360
                          ((i) & 0x0000000f))
361
#define OR32_OPCODE3(i) ((((i) & 0xfc000000) >> 24) | \
362
                         (((i) & 0x000000c0) >> 6))
363
#define OR32_OPCODE4(i) ((((i) & 0xfc000000) >> 18) | \
364
                         (((i) & 0x000003c0) >>  2) | \
365
                          ((i) & 0x0000000f))
366
#define OR32_OPCODE5(i)  (((i) & 0xffff0000) >> 16)
367
#define OR32_OPCODE6(i)  (((i) & 0xff000000) >> 24)
368
#define OR32_OPCODE7(i)  (((i) & 0xfc000000) >> 21)
369
#define OR32_D_REG(i)    (((i) & 0x03e00000) >> 21)
370
#define OR32_A_REG(i)    (((i) & 0x001f0000) >> 16)
371
#define OR32_B_REG(i)    (((i) & 0x0000f800) >> 11)
372
#define OR32_IMM(i)      (OR32_SEXT16((i) & 0x0000ffff))
373
#define OR32_IMM2(i)     (OR32_SEXT16((((i) & 0x03e00000) >> 10) |      \
374
                                       ((i) & 0x000003ff)))
375
#define OR32_OFFSET(i)    (OR32_SEXT26((i) & 0x03ffffff) ))
376
#define OR32_SHIFT(i)     ((i) & 0x0000003f)
377
 
378
/* The instruction opcodes */
379
 
380
#define OR32_OP_ADD     0xe00   /* Type 2 */
381
#define OR32_OP_ADDC    0xe01   /* Type 2 */
382
#define OR32_OP_ADDI     0x27   /* Type 1 */
383
#define OR32_OP_AND     0xe03   /* Type 2 */
384
#define OR32_OP_ANDI     0x29   /* Type 1 */
385
#define OR32_OP_BF       0x04   /* Type 1 */
386
#define OR32_OP_BNF      0x03   /* Type 1 */
387
#define OR32_OP_TRAP   0x2100   /* Type 5 */
388
#define OR32_OP_J        0x00   /* Type 1 */
389
#define OR32_OP_JAL      0x01   /* Type 1 */
390
#define OR32_OP_JALR     0x12   /* Type 1 */
391
#define OR32_OP_JR       0x11   /* Type 1 */
392
#define OR32_OP_LBS      0x24   /* Type 1 */
393
#define OR32_OP_LBZ      0x23   /* Type 1 */
394
#define OR32_OP_LHS      0x26   /* Type 1 */
395
#define OR32_OP_LHZ      0x25   /* Type 1 */
396
#define OR32_OP_LWS      0x22   /* Type 1 */
397
#define OR32_OP_LWZ      0x21   /* Type 1 */
398
#define OR32_OP_MFSPR    0x07   /* Type 1 */
399
#define OR32_OP_MOVHI    0x06   /* Type 1 */
400
#define OR32_OP_MTSPR    0x10   /* Type 1 */
401
#define OR32_OP_MUL     0xe36   /* Type 2 */
402
#define OR32_OP_MULI     0x2c   /* Type 1 */
403
#define OR32_OP_MULU    0xe3b   /* Type 2 */
404
#define OR32_OP_NOP      0x15   /* Type 6 */
405
#define OR32_OP_OR      0xe04   /* Type 2 */
406
#define OR32_OP_ORI      0x2a   /* Type 1 */
407
#define OR32_OP_RFE      0x09   /* Type 1 */
408
#define OR32_OP_RORI     0xe3   /* Type 3 */
409
#define OR32_OP_SB       0x36   /* Type 1 */
410
#define OR32_OP_SFEQ    0x720   /* Type 7 */
411
#define OR32_OP_SFGES   0x72b   /* Type 7 */
412
#define OR32_OP_SFGEU   0x723   /* Type 7 */
413
#define OR32_OP_SFGTS   0x72a   /* Type 7 */
414
#define OR32_OP_SFGTU   0x722   /* Type 7 */
415
#define OR32_OP_SFLES   0x72d   /* Type 7 */
416
#define OR32_OP_SFLEU   0x725   /* Type 7 */
417
#define OR32_OP_SFLTS   0x72c   /* Type 7 */
418
#define OR32_OP_SFLTU   0x724   /* Type 7 */
419
#define OR32_OP_SFNE    0x721   /* Type 7 */
420
#define OR32_OP_SLL    0x3808   /* Type 4 */
421
#define OR32_OP_SLLI     0xe0   /* Type 3 */
422
#define OR32_OP_SRA    0x3828   /* Type 4 */
423
#define OR32_OP_SRAI     0xe2   /* Type 3 */
424
#define OR32_OP_SRL    0x3818   /* Type 4 */
425
#define OR32_OP_SRLI     0xe1   /* Type 3 */
426
#define OR32_OP_SUB     0xe02   /* Type 2 */
427
#define OR32_OP_SW       0x35   /* Type 1 */
428
#define OR32_OP_SYS    0x2000   /* Type 5 */
429
#define OR32_OP_XOR     0xe05   /* Type 2 */
430
#define OR32_OP_XORI     0x2b   /* Type 1 */
431
 
432
 
433
/*! OR32 specific per-architecture information. Replaces
434
    struct_or32_implementation. A lot of this info comes from the config regs,
435
    so cannot be put in place until we have the actual target. Up until then
436
    we have reasonable defaults. */
437
struct gdbarch_tdep
438
{
439
  unsigned int  num_matchpoints;        /* Total matchpoints available. */
440
  unsigned int  num_gpr_regs;           /* Number of general registers.  */
441
  int           bytes_per_word;
442
  int           bytes_per_address;
443
};
444
 
445 522 jeremybenn
/* Global variable controlling frame debug messages */
446
extern int  frame_debug;
447
 
448 330 jeremybenn
/* Global disassembly instructions */
449
extern int  print_insn_big_or32 (bfd_vma                  memaddr,
450
                                 struct disassemble_info *info);
451
extern int  print_insn_little_or32 (bfd_vma                  memaddr,
452
                                    struct disassemble_info *info);
453
 
454
#endif /* OR32_TDEP__H */

powered by: WebSVN 2.1.0

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