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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-6.8/] [gdb/] [or1k-tdep.h] - Blame information for rev 353

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

Line No. Rev Author Line
1 24 jeremybenn
/* Definitions to target GDB to OpenRISC 1000 targets.
2
 
3
   Copyright 2001 Free Software Foundation, Inc.
4 178 jeremybenn
   Copyright (C) 2008, 2010 Embecosm Limited
5 24 jeremybenn
 
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 OR1K_TDEP__H
25
#define OR1K_TDEP__H
26
 
27
#ifndef TARGET_OR1K
28
#define TARGET_OR1K
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 OR1K specific globals
36
   should have names beginning ork1_ or OR1K_.
37
 
38
   Commenting is Doxygen compatible.
39
 
40
   Much has been stripped out. See the files or1k-tdep.c, remote-or1k.c and
41
   or1k-jtag.c for details of what has changed.
42
   --------------------------------------------------------------------------*/
43
 
44
 
45
/*! Byte array for the TRAP instruction used for breakpoints */
46
#define OR1K_BRK_INSTR_STRUCT  {0x21, 0x00, 0x00, 0x01}
47
/*! Numeric instruction used for a breakpoint */
48
#define OR1K_BRK_INSTR 0x21000001
49
 
50
/*! Numeric instruction used for a l.nop NOP_EXIT */
51
#define  OR1K_NOP_EXIT 0x15000001
52
 
53
/* Special purpose groups */
54
 
55
#define OR1K_SPG_SIZE_BITS  11
56
#define OR1K_SPG_SIZE       (1 << OR1K_SPG_SIZE_BITS)
57
 
58
#define OR1K_SPG_SYS      0
59
#define OR1K_SPG_DMMU     1
60
#define OR1K_SPG_IMMU     2
61
#define OR1K_SPG_DC       3
62
#define OR1K_SPG_IC       4
63
#define OR1K_SPG_MAC      5
64
#define OR1K_SPG_DEBUG    6
65
#define OR1K_SPG_PC       7
66
#define OR1K_SPG_PM       8
67
#define OR1K_SPG_PIC      9
68
#define OR1K_SPG_TT      10
69
#define OR1K_SPG_FPU     11
70
 
71
#define OR1K_NUM_SPGS   (OR1K_SPG_FPU + 1)
72
 
73
/* Special register group offsets */
74
 
75
#define OR1K_SPG_SYS_VR          0
76
#define OR1K_SPG_SYS_UPR         1
77
#define OR1K_SPG_SYS_CPUCFGR     2
78
#define OR1K_SPG_SYS_DMMUCFGR    3
79
#define OR1K_SPG_SYS_IMMUCFGR    4
80
#define OR1K_SPG_SYS_DCCFGR      5
81
#define OR1K_SPG_SYS_ICCFGR      6
82
#define OR1K_SPG_SYS_DCFGR       7
83
#define OR1K_SPG_SYS_PCCFGR      8
84
#define OR1K_SPG_SYS_NPC        16
85
#define OR1K_SPG_SYS_SR         17
86
#define OR1K_SPG_SYS_PPC        18
87
#define OR1K_SPG_SYS_FPCSR      20
88
#define OR1K_SPG_SYS_EPCR       32
89
#define OR1K_SPG_SYS_EPCR_END  (OR1K_SPG_SYS_EPCR + 15)
90
#define OR1K_SPG_SYS_EEAR       48
91
#define OR1K_SPG_SYS_EEAR_END  (OR1K_SPG_SYS_EEAR + 15)
92
#define OR1K_SPG_SYS_ESR        64
93
#define OR1K_SPG_SYS_ESR_END   (OR1K_SPG_SYS_ESR + 15)
94
#define OR1K_SPG_SYS_GPR      1024
95
#define OR1K_SPG_SYS_GPR_END   (OR1K_SPG_SYS_GPR + OR1K_MAX_GPR_REGS)
96
#define OR1K_SPG_SYS_LAST       OR1K_SPG_SYS_GPR_END
97
 
98
#define OR1K_SPG_DMMU_DMMUCR           0
99
#define OR1K_SPG_DMMU_DMMUPR           1
100
#define OR1K_SPG_DMMU_DTLBEIR          2
101
#define OR1K_SPG_DMMU_DATBMR           4
102
#define OR1K_SPG_DMMU_DATBMR_END   (OR1K_SPG_DMMU_DATBMR + 3)
103
#define OR1K_SPG_DMMU_DATBTR           8
104
#define OR1K_SPG_DMMU_DATBTR_END   (OR1K_SPG_DMMU_DATBTR + 3)
105
#define OR1K_SPG_DMMU_DTLBW0MR       512
106
#define OR1K_SPG_DMMU_DTLBW0MR_END (OR1K_SPG_DMMU_DTLBW0MR + 127)
107
#define OR1K_SPG_DMMU_DTLBW0TR       640
108
#define OR1K_SPG_DMMU_DTLBW0TR_END (OR1K_SPG_DMMU_DTLBW0TR + 127)
109
#define OR1K_SPG_DMMU_DTLBW1MR       768
110
#define OR1K_SPG_DMMU_DTLBW1MR_END (OR1K_SPG_DMMU_DTLBW1MR + 127)
111
#define OR1K_SPG_DMMU_DTLBW1TR       896
112
#define OR1K_SPG_DMMU_DTLBW1TR_END (OR1K_SPG_DMMU_DTLBW1TR + 127)
113
#define OR1K_SPG_DMMU_DTLBW2MR      1024
114
#define OR1K_SPG_DMMU_DTLBW2MR_END (OR1K_SPG_DMMU_DTLBW2MR + 127)
115
#define OR1K_SPG_DMMU_DTLBW2TR      1152
116
#define OR1K_SPG_DMMU_DTLBW2TR_END (OR1K_SPG_DMMU_DTLBW2TR + 127)
117
#define OR1K_SPG_DMMU_DTLBW3MR      1280
118
#define OR1K_SPG_DMMU_DTLBW3MR_END (OR1K_SPG_DMMU_DTLBW3MR + 127)
119
#define OR1K_SPG_DMMU_DTLBW3TR      1408
120
#define OR1K_SPG_DMMU_DTLBW3TR_END (OR1K_SPG_DMMU_DTLBW3TR + 127)
121
#define OR1K_SPG_DMMU_LAST          OR1K_SPG_DMMU_DTLBW3TR_END
122
 
123
#define OR1K_SPG_IMMU_IMMUCR           0
124
#define OR1K_SPG_IMMU_IMMUPR           1
125
#define OR1K_SPG_IMMU_ITLBEIR          2
126
#define OR1K_SPG_IMMU_IATBMR           4
127
#define OR1K_SPG_IMMU_IATBMR_END   (OR1K_SPG_IMMU_IATBMR + 3)
128
#define OR1K_SPG_IMMU_IATBTR           8
129
#define OR1K_SPG_IMMU_IATBTR_END   (OR1K_SPG_IMMU_IATBTR + 3)
130
#define OR1K_SPG_IMMU_ITLBW0MR       512
131
#define OR1K_SPG_IMMU_ITLBW0MR_END (OR1K_SPG_IMMU_ITLBW0MR + 127)
132
#define OR1K_SPG_IMMU_ITLBW0TR       640
133
#define OR1K_SPG_IMMU_ITLBW0TR_END (OR1K_SPG_IMMU_ITLBW0TR + 127)
134
#define OR1K_SPG_IMMU_ITLBW1MR       768
135
#define OR1K_SPG_IMMU_ITLBW1MR_END (OR1K_SPG_IMMU_ITLBW1MR + 127)
136
#define OR1K_SPG_IMMU_ITLBW1TR       896
137
#define OR1K_SPG_IMMU_ITLBW1TR_END (OR1K_SPG_IMMU_ITLBW1TR + 127)
138
#define OR1K_SPG_IMMU_ITLBW2MR      1024
139
#define OR1K_SPG_IMMU_ITLBW2MR_END (OR1K_SPG_IMMU_ITLBW2MR + 127)
140
#define OR1K_SPG_IMMU_ITLBW2TR      1152
141
#define OR1K_SPG_IMMU_ITLBW2TR_END (OR1K_SPG_IMMU_ITLBW2TR + 127)
142
#define OR1K_SPG_IMMU_ITLBW3MR      1280
143
#define OR1K_SPG_IMMU_ITLBW3MR_END (OR1K_SPG_IMMU_ITLBW3MR + 127)
144
#define OR1K_SPG_IMMU_ITLBW3TR      1408
145
#define OR1K_SPG_IMMU_ITLBW3TR_END (OR1K_SPG_IMMU_ITLBW3TR + 127)
146
#define OR1K_SPG_IMMU_LAST          OR1K_SPG_IMMU_ITLBW3TR_END
147
 
148
#define OR1K_SPG_DC_DCCR   0
149
#define OR1K_SPG_DC_DCBPR  1
150
#define OR1K_SPG_DC_DCBFR  2
151
#define OR1K_SPG_DC_DCBIR  3
152
#define OR1K_SPG_DC_DCBWR  4
153
#define OR1K_SPG_DC_DCBLR  5
154
#define OR1K_SPG_DC_LAST   OR1K_SPG_DC_DCBLR
155
 
156
#define OR1K_SPG_IC_ICCR   0
157
#define OR1K_SPG_IC_ICBPR  1
158
#define OR1K_SPG_IC_ICBIR  2
159
#define OR1K_SPG_IC_ICBLR  3
160
#define OR1K_SPG_IC_LAST   OR1K_SPG_IC_ICBLR
161
 
162
#define OR1K_SPG_MAC_MACLO  1
163
#define OR1K_SPG_MAC_MACHI  2
164
#define OR1K_SPG_MAC_LAST   OR1K_SPG_MAC_MACHI
165
 
166
#define OR1K_SPG_DEBUG_DVR      0
167
#define OR1K_SPG_DEBUG_DVR_END (OR1K_SPG_DEBUG_DVR + 7)
168
#define OR1K_SPG_DEBUG_DCR      8
169
#define OR1K_SPG_DEBUG_DCR_END (OR1K_SPG_DEBUG_DCR + 7)
170
#define OR1K_SPG_DEBUG_DMR1   16
171
#define OR1K_SPG_DEBUG_DMR2   17
172
#define OR1K_SPG_DEBUG_DCWR0  18
173
#define OR1K_SPG_DEBUG_DCWR1  19
174
#define OR1K_SPG_DEBUG_DSR    20
175
#define OR1K_SPG_DEBUG_DRR    21
176
#define OR1K_SPG_DEBUG_LAST   OR1K_SPG_DEBUG_DRR
177
 
178
#define OR1K_SPG_PC_PCCR       0
179
#define OR1K_SPG_PC_PCCR_END  (OR1K_SPG_PC_PCCR + 7)
180
#define OR1K_SPG_PC_PCMR       8
181
#define OR1K_SPG_PC_PCMR_END  (OR1K_SPG_PC_PCMR + 7)
182
#define OR1K_SPG_PC_LAST       OR1K_SPG_PC_PCMR_END
183
 
184
#define OR1K_SPG_PM_PMR     0
185
#define OR1K_SPG_PM_LAST    OR1K_SPG_PM_PMR
186
 
187
#define OR1K_SPG_PIC_PICMR  0
188
#define OR1K_SPG_PIC_PICSR  2
189
#define OR1K_SPG_PIC_LAST   OR1K_SPG_PIC_PICSR
190
 
191
#define OR1K_SPG_TT_TTMR    0
192
#define OR1K_SPG_TT_TTCR    1
193
#define OR1K_SPG_TT_LAST    OR1K_SPG_TT_TTCR
194
 
195
#define OR1K_SPG_FPU_LAST  -1
196
 
197
 
198
/* Define absolute SPR values from group and index  */
199
#define OR1K_SPR(group, index) (((group) << OR1K_SPG_SIZE_BITS) + (index))
200
 
201
/* System group registers */
202
#define OR1K_VR_SPRNUM       OR1K_SPR (OR1K_SPG_SYS, OR1K_SPG_SYS_VR)
203
#define OR1K_UPR_SPRNUM      OR1K_SPR (OR1K_SPG_SYS, OR1K_SPG_SYS_UPR)
204
#define OR1K_CPUCFGR_SPRNUM  OR1K_SPR (OR1K_SPG_SYS, OR1K_SPG_SYS_CPUCFGR)
205
#define OR1K_DCFGR_SPRNUM    OR1K_SPR (OR1K_SPG_SYS, OR1K_SPG_SYS_DCFGR)
206
#define OR1K_NPC_SPRNUM      OR1K_SPR (OR1K_SPG_SYS, OR1K_SPG_SYS_NPC)
207
#define OR1K_SR_SPRNUM       OR1K_SPR (OR1K_SPG_SYS, OR1K_SPG_SYS_SR)
208
#define OR1K_PPC_SPRNUM      OR1K_SPR (OR1K_SPG_SYS, OR1K_SPG_SYS_PPC)
209
#define OR1K_EPCR_SPRNUM     OR1K_SPR (OR1K_SPG_SYS, OR1K_SPG_SYS_EPCR)
210
 
211
/* Debug group registers */
212
#define OR1K_DVR0_SPRNUM     OR1K_SPR (OR1K_SPG_DEBUG, OR1K_SPG_DEBUG_DVR)
213
#define OR1K_DCR0_SPRNUM     OR1K_SPR (OR1K_SPG_DEBUG, OR1K_SPG_DEBUG_DCR)
214
#define OR1K_DMR1_SPRNUM     OR1K_SPR (OR1K_SPG_DEBUG, OR1K_SPG_DEBUG_DMR1)
215
#define OR1K_DMR2_SPRNUM     OR1K_SPR (OR1K_SPG_DEBUG, OR1K_SPG_DEBUG_DMR2)
216
#define OR1K_DCWR0_SPRNUM    OR1K_SPR (OR1K_SPG_DEBUG, OR1K_SPG_DEBUG_DCWR0)
217
#define OR1K_DCWR1_SPRNUM    OR1K_SPR (OR1K_SPG_DEBUG, OR1K_SPG_DEBUG_DCWR0)
218
#define OR1K_DSR_SPRNUM      OR1K_SPR (OR1K_SPG_DEBUG, OR1K_SPG_DEBUG_DSR)
219
#define OR1K_DRR_SPRNUM      OR1K_SPR (OR1K_SPG_DEBUG, OR1K_SPG_DEBUG_DRR)
220
 
221
/* General Purpose Registers */
222 146 jeremybenn
#define OR1K_ZERO_REGNUM          0
223
#define OR1K_SP_REGNUM            1
224
#define OR1K_FP_REGNUM            2
225
#define OR1K_FIRST_ARG_REGNUM     3
226
#define OR1K_LAST_ARG_REGNUM      8
227
#define OR1K_LR_REGNUM            9
228
#define OR1K_FIRST_SAVED_REGNUM  10
229
#define OR1K_RV_REGNUM           11
230
#define OR1K_PPC_REGNUM          (OR1K_MAX_GPR_REGS + 0)
231
#define OR1K_NPC_REGNUM          (OR1K_MAX_GPR_REGS + 1)
232
#define OR1K_SR_REGNUM           (OR1K_MAX_GPR_REGS + 2)
233 24 jeremybenn
 
234
/* Defines for Debug Control Register bits */
235
 
236
#define OR1K_DCR_DP        0x0000001    /* DVR/DCR Present */
237
#define OR1K_DCR_CC        0x000000e    /* Compare condition */
238
#define OR1K_DCR_CC_OFF            1    /* Compare condition offset */
239
#define OR1K_DCR_SC        0x0000010    /* Signed compare */
240
#define OR1K_DCR_CT        0x00000e0    /* Compare type */
241
#define OR1K_DCR_CT_OFF            5    /* Compare type offset */
242
 
243
/* Defines for Debug Mode Register 1 bits.  */
244
#define OR1K_DMR1_CW       0x00000003   /* Mask for CW bits */
245
#define OR1K_DMR1_CW_AND   0x00000001   /* Chain watchpoint 0 AND */
246
#define OR1K_DMR1_CW_OR    0x00000002   /* Chain watchpoint 0 OR */
247
#define OR1K_DMR1_CW_SZ             2   /* Number of bits for each WP */
248
#define OR1K_DMR1_ST       0x00400000   /* Single-step trace */
249
#define OR1K_DMR1_BT       0x00800000   /* Branch trace */
250
 
251
/* Defines for Debug Mode Register 2 bits.  */
252
#define OR1K_DMR2_WCE0       0x00000001 /* Watchpoint counter enable 0 */
253
#define OR1K_DMR2_WCE1       0x00000002 /* Watchpoint counter enable 1 */
254
#define OR1K_DMR2_AWTC_MASK  0x00000ffc /* Assign watchpoints to ctr mask */
255
#define OR1K_DMR2_WGB_MASK   0x003ff000 /* Watchpoints generaing brk mask */
256
#define OR1K_DMR2_WBS_MASK   0xffc00000 /* Watchpoint brkpt status mask */
257
#define OR1K_DMR2_AWTC_OFF    2         /* Assign watchpoints to ctr offset */
258
#define OR1K_DMR2_WGB_OFF    12         /* Watchpoints generating brk offset */
259
#define OR1K_DMR2_WBS_OFF    22         /* Watchpoint brkpt status offset */
260
 
261
/* Defines for Debug Stop Register.  */
262
#define OR1K_DSR_RSTE    0x00000001     /* Reset exception */
263
#define OR1K_DSR_BUSEE   0x00000002     /* Bus error exception */
264
#define OR1K_DSR_DPFE    0x00000004     /* Data page fault exception */
265
#define OR1K_DSR_IPFE    0x00000008     /* Instrution page fault exception */
266
#define OR1K_DSR_TTE     0x00000010     /* Tick timer exception */
267
#define OR1K_DSR_AE      0x00000020     /* Alignment exception */
268
#define OR1K_DSR_IIE     0x00000040     /* Illegal instruction exception */
269
#define OR1K_DSR_INTE    0x00000080     /* Interrupt exception */
270
#define OR1K_DSR_DME     0x00000100     /* DTLB miss exception */
271
#define OR1K_DSR_IME     0x00000200     /* ITLB miss exception */
272
#define OR1K_DSR_RE      0x00000400     /* Range exception */
273
#define OR1K_DSR_SCE     0x00000800     /* System call exception */
274
#define OR1K_DSR_FPE     0x00001000     /* Floating point exception */
275
#define OR1K_DSR_TE      0x00002000     /* Trap exception */
276
 
277
/* Defines for Debug Reason Register bits */
278
#define OR1K_DRR_RSTE    0x00000001     /* Reset exception */
279
#define OR1K_DRR_BUSEE   0x00000002     /* Bus error exception */
280
#define OR1K_DRR_DPFE    0x00000004     /* Data page fault exception */
281
#define OR1K_DRR_IPFE    0x00000008     /* Instrution page fault exception */
282
#define OR1K_DRR_TTE     0x00000010     /* Tick timer exception */
283
#define OR1K_DRR_AE      0x00000020     /* Alignment exception */
284
#define OR1K_DRR_IIE     0x00000040     /* Illegal instruction exception */
285
#define OR1K_DRR_INTE    0x00000080     /* Interrupt exception */
286
#define OR1K_DRR_DME     0x00000100     /* DTLB miss exception */
287
#define OR1K_DRR_IME     0x00000200     /* ITLB miss exception */
288
#define OR1K_DRR_RE      0x00000400     /* Range exception */
289
#define OR1K_DRR_SCE     0x00000800     /* System call exception */
290
#define OR1K_DRR_FPE     0x00001000     /* Floating point exception */
291
#define OR1K_DRR_TE      0x00002000     /* Trap exception */
292
 
293
/* Bit definitions for the Unit Present Register */
294
#define OR1K_SPR_UPR_UP         0x00000001  /* UPR present */
295
#define OR1K_SPR_UPR_DCP        0x00000002  /* Data cache present */
296
#define OR1K_SPR_UPR_ICP        0x00000004  /* Instruction cache present */
297
#define OR1K_SPR_UPR_DMP        0x00000008  /* Data MMU present */
298
#define OR1K_SPR_UPR_IMP        0x00000010  /* Instruction MMU present */
299
#define OR1K_SPR_UPR_MP         0x00000020  /* MAC present */
300
#define OR1K_SPR_UPR_DUP        0x00000040  /* Debug unit present */
301
#define OR1K_SPR_UPR_PCUP       0x00000080  /* Perf counters unit present */
302
#define OR1K_SPR_UPR_PMP        0x00000100  /* Power management present */
303
#define OR1K_SPR_UPR_PICP       0x00000200  /* PIC present */
304
#define OR1K_SPR_UPR_TTP        0x00000400  /* Tick timer present */
305
 
306
/* Bit definitions for the CPU Configuration Register */
307
#define OR1K_SPR_CPUCFGR_NSGF   0x0000000f  /* Number of shadow GPR files */
308
#define OR1K_SPR_CPUCFGR_CGF    0x00000010  /* Custom GPR file */
309
#define OR1K_SPR_CPUCFGR_OB32S  0x00000020  /* ORBIS32 supported */
310
#define OR1K_SPR_CPUCFGR_OB64S  0x00000040  /* ORBIS64 supported */
311
#define OR1K_SPR_CPUCFGR_OF32S  0x00000080  /* ORFPX32 supported */
312
#define OR1K_SPR_CPUCFGR_OF64S  0x00000100  /* ORFPX64 supported */
313
#define OR1K_SPR_CPUCFGR_OV64S  0x00000400  /* ORVDX64 supported */
314
 
315
/* Bit definitions for the Debug configuration register */
316
#define OR1K_SPR_DCFGR_NDP      0x00000007  /* Number of matchpoints */
317
#define OR1K_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 OR1K_MAX_GPR_REGS           32
323
#define OR1K_NUM_PSEUDO_REGS         0
324
#define OR1K_NUM_REGS               (OR1K_MAX_GPR_REGS + 3)
325
#define OR1K_TOTAL_NUM_REGS         (OR1K_NUM_REGS + OR1K_NUM_PSEUDO_REGS)
326
#define OR1K_MAX_MATCHPOINTS         8
327
#define OR1K_MAX_HW_WATCHES          OR1K_MAX_MATCHPOINTS
328
#define OR1K_STACK_ALIGN             4
329
#define OR1K_INSTLEN                 4
330 146 jeremybenn
#define OR1K_INSTBITLEN              (OR1K_INSTLEN * 8)
331 24 jeremybenn
#define OR1K_NUM_TAP_RECORDS         8
332
#define OR1K_FRAME_RED_ZONE_SIZE  2536
333
 
334
/* OR1K exception vectors */
335
 
336
#define OR1K_RESET_VECTOR   0x100
337
#define OR1K_BUSERR_VECTOR  0x200
338
#define OR1K_DPF_VECTOR     0x300
339
#define OR1K_IPF_VECTOR     0x400
340
#define OR1K_TT_VECTOR      0x500
341
#define OR1K_ALIGN_VECTOR   0x600
342
#define OR1K_ILL_VECTOR     0x700
343
#define OR1K_EXT_VECTOR     0x800
344
#define OR1K_DTLB_VECTOR    0x900
345
#define OR1K_ITLB_VECTOR    0xa00
346
#define OR1K_RANGE_VECTOR   0xb00
347
#define OR1K_SYS_VECTOR     0xc00
348
#define OR1K_FP_VECTOR      0xd00
349
#define OR1K_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 OR1K_SEXT16(v) (((v) & 0x00008000) ? ((v) - 0x00010000) : (v))
355
#define OR1K_SEXT26(v) (((v) & 0x02000000) ? ((v) - 0x04000000) : (v))
356
 
357
#define OR1K_OPCODE1(i)  (((i) & 0xfc000000) >> 26)
358
#define OR1K_OPCODE2(i) ((((i) & 0xfc000000) >> 20) | \
359
                         (((i) & 0x00000300) >>  6) | \
360
                          ((i) & 0x0000000f))
361
#define OR1K_OPCODE3(i) ((((i) & 0xfc000000) >> 24) | \
362
                         (((i) & 0x000000c0) >> 6))
363
#define OR1K_OPCODE4(i) ((((i) & 0xfc000000) >> 18) | \
364
                         (((i) & 0x000003c0) >>  2) | \
365
                          ((i) & 0x0000000f))
366
#define OR1K_OPCODE5(i)  (((i) & 0xffff0000) >> 16)
367
#define OR1K_OPCODE6(i)  (((i) & 0xff000000) >> 24)
368
#define OR1K_OPCODE7(i)  (((i) & 0xfc000000) >> 21)
369
#define OR1K_D_REG(i)    (((i) & 0x03e00000) >> 21)
370
#define OR1K_A_REG(i)    (((i) & 0x001f0000) >> 16)
371
#define OR1K_B_REG(i)    (((i) & 0x0000f800) >> 11)
372
#define OR1K_IMM(i)      (OR1K_SEXT16((i) & 0x0000ffff))
373
#define OR1K_IMM2(i)     (OR1K_SEXT16((((i) & 0x03e00000) >> 10) |      \
374
                                       ((i) & 0x000003ff)))
375
#define OR1K_OFFSET(i)    (OR1K_SEXT26((i) & 0x03ffffff) ))
376
#define OR1K_SHIFT(i)     ((i) & 0x0000003f)
377
 
378
/* The instruction opcodes */
379
 
380
#define OR1K_OP_ADD     0xe00   /* Type 2 */
381
#define OR1K_OP_ADDC    0xe01   /* Type 2 */
382
#define OR1K_OP_ADDI     0x27   /* Type 1 */
383
#define OR1K_OP_AND     0xe03   /* Type 2 */
384
#define OR1K_OP_ANDI     0x29   /* Type 1 */
385
#define OR1K_OP_BF       0x04   /* Type 1 */
386
#define OR1K_OP_BNF      0x03   /* Type 1 */
387
#define OR1K_OP_TRAP   0x2100   /* Type 5 */
388
#define OR1K_OP_J        0x00   /* Type 1 */
389
#define OR1K_OP_JAL      0x01   /* Type 1 */
390
#define OR1K_OP_JALR     0x12   /* Type 1 */
391
#define OR1K_OP_JR       0x11   /* Type 1 */
392
#define OR1K_OP_LBS      0x24   /* Type 1 */
393
#define OR1K_OP_LBZ      0x23   /* Type 1 */
394
#define OR1K_OP_LHS      0x26   /* Type 1 */
395
#define OR1K_OP_LHZ      0x25   /* Type 1 */
396
#define OR1K_OP_LWS      0x22   /* Type 1 */
397
#define OR1K_OP_LWZ      0x21   /* Type 1 */
398
#define OR1K_OP_MFSPR    0x07   /* Type 1 */
399
#define OR1K_OP_MOVHI    0x06   /* Type 1 */
400
#define OR1K_OP_MTSPR    0x10   /* Type 1 */
401
#define OR1K_OP_MUL     0xe36   /* Type 2 */
402
#define OR1K_OP_MULI     0x2c   /* Type 1 */
403
#define OR1K_OP_MULU    0xe3b   /* Type 2 */
404
#define OR1K_OP_NOP      0x15   /* Type 6 */
405
#define OR1K_OP_OR      0xe04   /* Type 2 */
406
#define OR1K_OP_ORI      0x2a   /* Type 1 */
407
#define OR1K_OP_RFE      0x09   /* Type 1 */
408
#define OR1K_OP_RORI     0xe3   /* Type 3 */
409
#define OR1K_OP_SB       0x36   /* Type 1 */
410
#define OR1K_OP_SFEQ    0x720   /* Type 7 */
411
#define OR1K_OP_SFGES   0x72b   /* Type 7 */
412
#define OR1K_OP_SFGEU   0x723   /* Type 7 */
413
#define OR1K_OP_SFGTS   0x72a   /* Type 7 */
414
#define OR1K_OP_SFGTU   0x722   /* Type 7 */
415
#define OR1K_OP_SFLES   0x72d   /* Type 7 */
416
#define OR1K_OP_SFLEU   0x725   /* Type 7 */
417
#define OR1K_OP_SFLTS   0x72c   /* Type 7 */
418
#define OR1K_OP_SFLTU   0x724   /* Type 7 */
419
#define OR1K_OP_SFNE    0x721   /* Type 7 */
420
#define OR1K_OP_SLL    0x3808   /* Type 4 */
421
#define OR1K_OP_SLLI     0xe0   /* Type 3 */
422
#define OR1K_OP_SRA    0x3828   /* Type 4 */
423
#define OR1K_OP_SRAI     0xe2   /* Type 3 */
424
#define OR1K_OP_SRL    0x3818   /* Type 4 */
425
#define OR1K_OP_SRLI     0xe1   /* Type 3 */
426
#define OR1K_OP_SUB     0xe02   /* Type 2 */
427
#define OR1K_OP_SW       0x35   /* Type 1 */
428
#define OR1K_OP_SYS    0x2000   /* Type 5 */
429
#define OR1K_OP_XOR     0xe05   /* Type 2 */
430
#define OR1K_OP_XORI     0x2b   /* Type 1 */
431
 
432
 
433
/*! OR1K specific per-architecture information. Replaces
434
    struct_or1k_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
/* Global disassembly instructions */
446
 
447
extern int  print_insn_big_or32 (bfd_vma                  memaddr,
448
                                 struct disassemble_info *info);
449
extern int  print_insn_little_or32 (bfd_vma                  memaddr,
450
                                    struct disassemble_info *info);
451
 
452
#endif /* OR1K_TDEP__H */

powered by: WebSVN 2.1.0

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