1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
|
/* CPU family header for sparc32.
THIS FILE IS MACHINE GENERATED WITH CGEN.
Copyright (C) 1999 Cygnus Solutions, Inc.
This file is part of the Cygnus Simulators.
*/
#ifndef CPU_SPARC32_H
#define CPU_SPARC32_H
/* Maximum number of instructions that are fetched at a time.
This is for LIW type instructions sets (e.g. m32r). */
#define MAX_LIW_INSNS 1
/* Maximum number of instructions that can be executed in parallel. */
#define MAX_PARALLEL_INSNS 1
/* CPU state information. */
typedef struct {
/* Hardware elements. */
struct {
/* program counter */
USI h_pc;
#define GET_H_PC() CPU (h_pc)
#define SET_H_PC(x) (CPU (h_pc) = (x))
/* next pc */
SI h_npc;
#define GET_H_NPC() CPU (h_npc)
#define SET_H_NPC(x) (CPU (h_npc) = (x))
/* GET_H_GR macro user-written */
/* SET_H_GR macro user-written */
/* icc carry bit */
BI h_icc_c;
#define GET_H_ICC_C() CPU (h_icc_c)
#define SET_H_ICC_C(x) (CPU (h_icc_c) = (x))
/* icc negative bit */
BI h_icc_n;
#define GET_H_ICC_N() CPU (h_icc_n)
#define SET_H_ICC_N(x) (CPU (h_icc_n) = (x))
/* icc overflow bit */
BI h_icc_v;
#define GET_H_ICC_V() CPU (h_icc_v)
#define SET_H_ICC_V(x) (CPU (h_icc_v) = (x))
/* icc zero bit */
BI h_icc_z;
#define GET_H_ICC_Z() CPU (h_icc_z)
#define SET_H_ICC_Z(x) (CPU (h_icc_z) = (x))
/* xcc carry bit */
BI h_xcc_c;
#define GET_H_XCC_C() CPU (h_xcc_c)
#define SET_H_XCC_C(x) (CPU (h_xcc_c) = (x))
/* xcc negative bit */
BI h_xcc_n;
#define GET_H_XCC_N() CPU (h_xcc_n)
#define SET_H_XCC_N(x) (CPU (h_xcc_n) = (x))
/* xcc overflow bit */
BI h_xcc_v;
#define GET_H_XCC_V() CPU (h_xcc_v)
#define SET_H_XCC_V(x) (CPU (h_xcc_v) = (x))
/* xcc zero bit */
BI h_xcc_z;
#define GET_H_XCC_Z() CPU (h_xcc_z)
#define SET_H_XCC_Z(x) (CPU (h_xcc_z) = (x))
/* GET_H_Y macro user-written */
/* SET_H_Y macro user-written */
/* ancilliary state registers */
SI h_asr[32];
#define GET_H_ASR(a1) CPU (h_asr)[a1]
#define SET_H_ASR(a1, x) (CPU (h_asr)[a1] = (x))
/* annul next insn? - assists execution */
BI h_annul_p;
#define GET_H_ANNUL_P() CPU (h_annul_p)
#define SET_H_ANNUL_P(x) (CPU (h_annul_p) = (x))
/* floating point regs */
SF h_fr[32];
#define GET_H_FR(a1) CPU (h_fr)[a1]
#define SET_H_FR(a1, x) (CPU (h_fr)[a1] = (x))
/* psr register */
USI h_psr;
/* GET_H_PSR macro user-written */
/* SET_H_PSR macro user-written */
/* supervisor bit */
BI h_s;
#define GET_H_S() CPU (h_s)
#define SET_H_S(x) (CPU (h_s) = (x))
/* previous supervisor bit */
BI h_ps;
#define GET_H_PS() CPU (h_ps)
#define SET_H_PS(x) (CPU (h_ps) = (x))
/* processor interrupt level */
UQI h_pil;
#define GET_H_PIL() CPU (h_pil)
#define SET_H_PIL(x) (CPU (h_pil) = (x))
/* enable traps bit */
BI h_et;
#define GET_H_ET() CPU (h_et)
#define SET_H_ET(x) (CPU (h_et) = (x))
/* tbr register */
SI h_tbr;
/* GET_H_TBR macro user-written */
/* SET_H_TBR macro user-written */
/* current window pointer */
UQI h_cwp;
/* GET_H_CWP macro user-written */
/* SET_H_CWP macro user-written */
/* window invalid mask */
USI h_wim;
/* GET_H_WIM macro user-written */
/* SET_H_WIM macro user-written */
/* alternate global indicator */
QI h_ag;
#define GET_H_AG() CPU (h_ag)
#define SET_H_AG(x) (CPU (h_ag) = (x))
/* enable coprocessor bit */
BI h_ec;
#define GET_H_EC() CPU (h_ec)
#define SET_H_EC(x) (CPU (h_ec) = (x))
/* enable fpu bit */
BI h_ef;
#define GET_H_EF() CPU (h_ef)
#define SET_H_EF(x) (CPU (h_ef) = (x))
/* floating point status register */
USI h_fsr;
#define GET_H_FSR() CPU (h_fsr)
#define SET_H_FSR(x) (CPU (h_fsr) = (x))
} hardware;
#define CPU_CGEN_HW(cpu) (& (cpu)->cpu_data.hardware)
} SPARC32_CPU_DATA;
/* Cover fns for register access. */
USI sparc32_h_pc_get (SIM_CPU *);
void sparc32_h_pc_set (SIM_CPU *, USI);
SI sparc32_h_npc_get (SIM_CPU *);
void sparc32_h_npc_set (SIM_CPU *, SI);
SI sparc32_h_gr_get (SIM_CPU *, UINT);
void sparc32_h_gr_set (SIM_CPU *, UINT, SI);
BI sparc32_h_icc_c_get (SIM_CPU *);
void sparc32_h_icc_c_set (SIM_CPU *, BI);
BI sparc32_h_icc_n_get (SIM_CPU *);
void sparc32_h_icc_n_set (SIM_CPU *, BI);
BI sparc32_h_icc_v_get (SIM_CPU *);
void sparc32_h_icc_v_set (SIM_CPU *, BI);
BI sparc32_h_icc_z_get (SIM_CPU *);
void sparc32_h_icc_z_set (SIM_CPU *, BI);
BI sparc32_h_xcc_c_get (SIM_CPU *);
void sparc32_h_xcc_c_set (SIM_CPU *, BI);
BI sparc32_h_xcc_n_get (SIM_CPU *);
void sparc32_h_xcc_n_set (SIM_CPU *, BI);
BI sparc32_h_xcc_v_get (SIM_CPU *);
void sparc32_h_xcc_v_set (SIM_CPU *, BI);
BI sparc32_h_xcc_z_get (SIM_CPU *);
void sparc32_h_xcc_z_set (SIM_CPU *, BI);
SI sparc32_h_y_get (SIM_CPU *);
void sparc32_h_y_set (SIM_CPU *, SI);
SI sparc32_h_asr_get (SIM_CPU *, UINT);
void sparc32_h_asr_set (SIM_CPU *, UINT, SI);
BI sparc32_h_annul_p_get (SIM_CPU *);
void sparc32_h_annul_p_set (SIM_CPU *, BI);
SF sparc32_h_fr_get (SIM_CPU *, UINT);
void sparc32_h_fr_set (SIM_CPU *, UINT, SF);
USI sparc32_h_psr_get (SIM_CPU *);
void sparc32_h_psr_set (SIM_CPU *, USI);
BI sparc32_h_s_get (SIM_CPU *);
void sparc32_h_s_set (SIM_CPU *, BI);
BI sparc32_h_ps_get (SIM_CPU *);
void sparc32_h_ps_set (SIM_CPU *, BI);
UQI sparc32_h_pil_get (SIM_CPU *);
void sparc32_h_pil_set (SIM_CPU *, UQI);
BI sparc32_h_et_get (SIM_CPU *);
void sparc32_h_et_set (SIM_CPU *, BI);
SI sparc32_h_tbr_get (SIM_CPU *);
void sparc32_h_tbr_set (SIM_CPU *, SI);
UQI sparc32_h_cwp_get (SIM_CPU *);
void sparc32_h_cwp_set (SIM_CPU *, UQI);
USI sparc32_h_wim_get (SIM_CPU *);
void sparc32_h_wim_set (SIM_CPU *, USI);
QI sparc32_h_ag_get (SIM_CPU *);
void sparc32_h_ag_set (SIM_CPU *, QI);
BI sparc32_h_ec_get (SIM_CPU *);
void sparc32_h_ec_set (SIM_CPU *, BI);
BI sparc32_h_ef_get (SIM_CPU *);
void sparc32_h_ef_set (SIM_CPU *, BI);
USI sparc32_h_fsr_get (SIM_CPU *);
void sparc32_h_fsr_set (SIM_CPU *, USI);
/* These must be hand-written. */
extern CPUREG_FETCH_FN sparc32_fetch_register;
extern CPUREG_STORE_FN sparc32_store_register;
typedef struct {
int empty;
} MODEL_SPARC32_DEF_DATA;
/* The ARGBUF struct. */
struct argbuf {
/* These are the baseclass definitions. */
IADDR addr;
const IDESC *idesc;
char trace_p;
char profile_p;
/* cpu specific data follows */
CGEN_INSN_INT insn;
int written;
};
/* A cached insn.
??? SCACHE used to contain more than just argbuf. We could delete the
type entirely and always just use ARGBUF, but for future concerns and as
a level of abstraction it is left in. */
struct scache {
struct argbuf argbuf;
};
/* Macros to simplify extraction, reading and semantic code.
These define and assign the local vars that contain the insn's fields. */
#define EXTRACT_IFMT_EMPTY_VARS \
/* Instruction fields. */ \
unsigned int length;
#define EXTRACT_IFMT_EMPTY_CODE \
length = 0; \
#define EXTRACT_IFMT_RD_ASR_VARS \
/* Instruction fields. */ \
INT f_simm13; \
UINT f_i; \
UINT f_rs1; \
UINT f_op3; \
UINT f_rd; \
UINT f_op; \
unsigned int length;
#define EXTRACT_IFMT_RD_ASR_CODE \
length = 4; \
f_simm13 = EXTRACT_INT (insn, 32, 12, 13); \
f_i = EXTRACT_UINT (insn, 32, 13, 1); \
f_rs1 = EXTRACT_UINT (insn, 32, 18, 5); \
f_op3 = EXTRACT_UINT (insn, 32, 24, 6); \
f_rd = EXTRACT_UINT (insn, 32, 29, 5); \
f_op = EXTRACT_UINT (insn, 32, 31, 2); \
#define EXTRACT_IFMT_WR_ASR_VARS \
/* Instruction fields. */ \
UINT f_rs2; \
INT f_res_asi; \
UINT f_i; \
UINT f_rs1; \
UINT f_op3; \
UINT f_rd; \
UINT f_op; \
unsigned int length;
#define EXTRACT_IFMT_WR_ASR_CODE \
length = 4; \
f_rs2 = EXTRACT_UINT (insn, 32, 4, 5); \
f_res_asi = EXTRACT_INT (insn, 32, 12, 8); \
f_i = EXTRACT_UINT (insn, 32, 13, 1); \
f_rs1 = EXTRACT_UINT (insn, 32, 18, 5); \
f_op3 = EXTRACT_UINT (insn, 32, 24, 6); \
f_rd = EXTRACT_UINT (insn, 32, 29, 5); \
f_op = EXTRACT_UINT (insn, 32, 31, 2); \
#define EXTRACT_IFMT_WR_ASR_IMM_VARS \
/* Instruction fields. */ \
INT f_simm13; \
UINT f_i; \
UINT f_rs1; \
UINT f_op3; \
UINT f_rd; \
UINT f_op; \
unsigned int length;
#define EXTRACT_IFMT_WR_ASR_IMM_CODE \
length = 4; \
f_simm13 = EXTRACT_INT (insn, 32, 12, 13); \
f_i = EXTRACT_UINT (insn, 32, 13, 1); \
f_rs1 = EXTRACT_UINT (insn, 32, 18, 5); \
f_op3 = EXTRACT_UINT (insn, 32, 24, 6); \
f_rd = EXTRACT_UINT (insn, 32, 29, 5); \
f_op = EXTRACT_UINT (insn, 32, 31, 2); \
#define EXTRACT_IFMT_RD_PSR_VARS \
/* Instruction fields. */ \
INT f_simm13; \
UINT f_i; \
UINT f_rs1; \
UINT f_op3; \
UINT f_rd; \
UINT f_op; \
unsigned int length;
#define EXTRACT_IFMT_RD_PSR_CODE \
length = 4; \
f_simm13 = EXTRACT_INT (insn, 32, 12, 13); \
f_i = EXTRACT_UINT (insn, 32, 13, 1); \
f_rs1 = EXTRACT_UINT (insn, 32, 18, 5); \
f_op3 = EXTRACT_UINT (insn, 32, 24, 6); \
f_rd = EXTRACT_UINT (insn, 32, 29, 5); \
f_op = EXTRACT_UINT (insn, 32, 31, 2); \
#define EXTRACT_IFMT_WR_PSR_VARS \
/* Instruction fields. */ \
UINT f_rs2; \
INT f_res_asi; \
UINT f_i; \
UINT f_rs1; \
UINT f_op3; \
UINT f_rd; \
UINT f_op; \
unsigned int length;
#define EXTRACT_IFMT_WR_PSR_CODE \
length = 4; \
f_rs2 = EXTRACT_UINT (insn, 32, 4, 5); \
f_res_asi = EXTRACT_INT (insn, 32, 12, 8); \
f_i = EXTRACT_UINT (insn, 32, 13, 1); \
f_rs1 = EXTRACT_UINT (insn, 32, 18, 5); \
f_op3 = EXTRACT_UINT (insn, 32, 24, 6); \
f_rd = EXTRACT_UINT (insn, 32, 29, 5); \
f_op = EXTRACT_UINT (insn, 32, 31, 2); \
#define EXTRACT_IFMT_WR_PSR_IMM_VARS \
/* Instruction fields. */ \
INT f_simm13; \
UINT f_i; \
UINT f_rs1; \
UINT f_op3; \
UINT f_rd; \
UINT f_op; \
unsigned int length;
#define EXTRACT_IFMT_WR_PSR_IMM_CODE \
length = 4; \
f_simm13 = EXTRACT_INT (insn, 32, 12, 13); \
f_i = EXTRACT_UINT (insn, 32, 13, 1); \
f_rs1 = EXTRACT_UINT (insn, 32, 18, 5); \
f_op3 = EXTRACT_UINT (insn, 32, 24, 6); \
f_rd = EXTRACT_UINT (insn, 32, 29, 5); \
f_op = EXTRACT_UINT (insn, 32, 31, 2); \
#define EXTRACT_IFMT_LDSTUB_REG_REG_VARS \
/* Instruction fields. */ \
UINT f_rs2; \
INT f_res_asi; \
UINT f_i; \
UINT f_rs1; \
UINT f_op3; \
UINT f_rd; \
UINT f_op; \
unsigned int length;
#define EXTRACT_IFMT_LDSTUB_REG_REG_CODE \
length = 4; \
f_rs2 = EXTRACT_UINT (insn, 32, 4, 5); \
f_res_asi = EXTRACT_INT (insn, 32, 12, 8); \
f_i = EXTRACT_UINT (insn, 32, 13, 1); \
f_rs1 = EXTRACT_UINT (insn, 32, 18, 5); \
f_op3 = EXTRACT_UINT (insn, 32, 24, 6); \
f_rd = EXTRACT_UINT (insn, 32, 29, 5); \
f_op = EXTRACT_UINT (insn, 32, 31, 2); \
#define EXTRACT_IFMT_LDSTUB_REG_IMM_VARS \
/* Instruction fields. */ \
INT f_simm13; \
UINT f_i; \
UINT f_rs1; \
UINT f_op3; \
UINT f_rd; \
UINT f_op; \
unsigned int length;
#define EXTRACT_IFMT_LDSTUB_REG_IMM_CODE \
length = 4; \
f_simm13 = EXTRACT_INT (insn, 32, 12, 13); \
f_i = EXTRACT_UINT (insn, 32, 13, 1); \
f_rs1 = EXTRACT_UINT (insn, 32, 18, 5); \
f_op3 = EXTRACT_UINT (insn, 32, 24, 6); \
f_rd = EXTRACT_UINT (insn, 32, 29, 5); \
f_op = EXTRACT_UINT (insn, 32, 31, 2); \
#define EXTRACT_IFMT_LDSTUB_REG_REG_ASI_VARS \
/* Instruction fields. */ \
UINT f_rs2; \
UINT f_asi; \
UINT f_i; \
UINT f_rs1; \
UINT f_op3; \
UINT f_rd; \
UINT f_op; \
unsigned int length;
#define EXTRACT_IFMT_LDSTUB_REG_REG_ASI_CODE \
length = 4; \
f_rs2 = EXTRACT_UINT (insn, 32, 4, 5); \
f_asi = EXTRACT_UINT (insn, 32, 12, 8); \
f_i = EXTRACT_UINT (insn, 32, 13, 1); \
f_rs1 = EXTRACT_UINT (insn, 32, 18, 5); \
f_op3 = EXTRACT_UINT (insn, 32, 24, 6); \
f_rd = EXTRACT_UINT (insn, 32, 29, 5); \
f_op = EXTRACT_UINT (insn, 32, 31, 2); \
#define EXTRACT_IFMT_LDD_REG_REG_VARS \
/* Instruction fields. */ \
UINT f_rs2; \
INT f_res_asi; \
UINT f_i; \
UINT f_rs1; \
UINT f_op3; \
UINT f_rd; \
UINT f_op; \
unsigned int length;
#define EXTRACT_IFMT_LDD_REG_REG_CODE \
length = 4; \
f_rs2 = EXTRACT_UINT (insn, 32, 4, 5); \
f_res_asi = EXTRACT_INT (insn, 32, 12, 8); \
f_i = EXTRACT_UINT (insn, 32, 13, 1); \
f_rs1 = EXTRACT_UINT (insn, 32, 18, 5); \
f_op3 = EXTRACT_UINT (insn, 32, 24, 6); \
f_rd = EXTRACT_UINT (insn, 32, 29, 5); \
f_op = EXTRACT_UINT (insn, 32, 31, 2); \
#define EXTRACT_IFMT_LDD_REG_IMM_VARS \
/* Instruction fields. */ \
INT f_simm13; \
UINT f_i; \
UINT f_rs1; \
UINT f_op3; \
UINT f_rd; \
UINT f_op; \
unsigned int length;
#define EXTRACT_IFMT_LDD_REG_IMM_CODE \
length = 4; \
f_simm13 = EXTRACT_INT (insn, 32, 12, 13); \
f_i = EXTRACT_UINT (insn, 32, 13, 1); \
f_rs1 = EXTRACT_UINT (insn, 32, 18, 5); \
f_op3 = EXTRACT_UINT (insn, 32, 24, 6); \
f_rd = EXTRACT_UINT (insn, 32, 29, 5); \
f_op = EXTRACT_UINT (insn, 32, 31, 2); \
#define EXTRACT_IFMT_LDD_REG_REG_ASI_VARS \
/* Instruction fields. */ \
UINT f_rs2; \
UINT f_asi; \
UINT f_i; \
UINT f_rs1; \
UINT f_op3; \
UINT f_rd; \
UINT f_op; \
unsigned int length;
#define EXTRACT_IFMT_LDD_REG_REG_ASI_CODE \
length = 4; \
f_rs2 = EXTRACT_UINT (insn, 32, 4, 5); \
f_asi = EXTRACT_UINT (insn, 32, 12, 8); \
f_i = EXTRACT_UINT (insn, 32, 13, 1); \
f_rs1 = EXTRACT_UINT (insn, 32, 18, 5); \
f_op3 = EXTRACT_UINT (insn, 32, 24, 6); \
f_rd = EXTRACT_UINT (insn, 32, 29, 5); \
f_op = EXTRACT_UINT (insn, 32, 31, 2); \
#define EXTRACT_IFMT_FP_LD_REG_REG_VARS \
/* Instruction fields. */ \
UINT f_rs2; \
INT f_res_asi; \
UINT f_i; \
UINT f_rs1; \
UINT f_op3; \
UINT f_rd; \
UINT f_op; \
unsigned int length;
#define EXTRACT_IFMT_FP_LD_REG_REG_CODE \
length = 4; \
f_rs2 = EXTRACT_UINT (insn, 32, 4, 5); \
f_res_asi = EXTRACT_INT (insn, 32, 12, 8); \
f_i = EXTRACT_UINT (insn, 32, 13, 1); \
f_rs1 = EXTRACT_UINT (insn, 32, 18, 5); \
f_op3 = EXTRACT_UINT (insn, 32, 24, 6); \
f_rd = EXTRACT_UINT (insn, 32, 29, 5); \
f_op = EXTRACT_UINT (insn, 32, 31, 2); \
#define EXTRACT_IFMT_FP_LD_REG_IMM_VARS \
/* Instruction fields. */ \
INT f_simm13; \
UINT f_i; \
UINT f_rs1; \
UINT f_op3; \
UINT f_rd; \
UINT f_op; \
unsigned int length;
#define EXTRACT_IFMT_FP_LD_REG_IMM_CODE \
length = 4; \
f_simm13 = EXTRACT_INT (insn, 32, 12, 13); \
f_i = EXTRACT_UINT (insn, 32, 13, 1); \
f_rs1 = EXTRACT_UINT (insn, 32, 18, 5); \
f_op3 = EXTRACT_UINT (insn, 32, 24, 6); \
f_rd = EXTRACT_UINT (insn, 32, 29, 5); \
f_op = EXTRACT_UINT (insn, 32, 31, 2); \
#define EXTRACT_IFMT_FP_LD_REG_REG_ASI_VARS \
/* Instruction fields. */ \
UINT f_rs2; \
UINT f_asi; \
UINT f_i; \
UINT f_rs1; \
UINT f_op3; \
UINT f_rd; \
UINT f_op; \
unsigned int length;
#define EXTRACT_IFMT_FP_LD_REG_REG_ASI_CODE \
length = 4; \
f_rs2 = EXTRACT_UINT (insn, 32, 4, 5); \
f_asi = EXTRACT_UINT (insn, 32, 12, 8); \
f_i = EXTRACT_UINT (insn, 32, 13, 1); \
f_rs1 = EXTRACT_UINT (insn, 32, 18, 5); \
f_op3 = EXTRACT_UINT (insn, 32, 24, 6); \
f_rd = EXTRACT_UINT (insn, 32, 29, 5); \
f_op = EXTRACT_UINT (insn, 32, 31, 2); \
#define EXTRACT_IFMT_SETHI_VARS \
/* Instruction fields. */ \
INT f_hi22; \
UINT f_op2; \
UINT f_rd; \
UINT f_op; \
unsigned int length;
#define EXTRACT_IFMT_SETHI_CODE \
length = 4; \
f_hi22 = EXTRACT_INT (insn, 32, 21, 22); \
f_op2 = EXTRACT_UINT (insn, 32, 24, 3); \
f_rd = EXTRACT_UINT (insn, 32, 29, 5); \
f_op = EXTRACT_UINT (insn, 32, 31, 2); \
#define EXTRACT_IFMT_UNIMP_VARS \
/* Instruction fields. */ \
INT f_imm22; \
UINT f_op2; \
UINT f_rd_res; \
UINT f_op; \
unsigned int length;
#define EXTRACT_IFMT_UNIMP_CODE \
length = 4; \
f_imm22 = EXTRACT_INT (insn, 32, 21, 22); \
f_op2 = EXTRACT_UINT (insn, 32, 24, 3); \
f_rd_res = EXTRACT_UINT (insn, 32, 29, 5); \
f_op = EXTRACT_UINT (insn, 32, 31, 2); \
#define EXTRACT_IFMT_CALL_VARS \
/* Instruction fields. */ \
SI f_disp30; \
UINT f_op; \
unsigned int length;
#define EXTRACT_IFMT_CALL_CODE \
length = 4; \
f_disp30 = ((((EXTRACT_INT (insn, 32, 29, 30)) << (2))) + (pc)); \
f_op = EXTRACT_UINT (insn, 32, 31, 2); \
#define EXTRACT_IFMT_BA_VARS \
/* Instruction fields. */ \
SI f_disp22; \
UINT f_op2; \
UINT f_fmt2_cond; \
UINT f_a; \
UINT f_op; \
unsigned int length;
#define EXTRACT_IFMT_BA_CODE \
length = 4; \
f_disp22 = ((((EXTRACT_INT (insn, 32, 21, 22)) << (2))) + (pc)); \
f_op2 = EXTRACT_UINT (insn, 32, 24, 3); \
f_fmt2_cond = EXTRACT_UINT (insn, 32, 28, 4); \
f_a = EXTRACT_UINT (insn, 32, 29, 1); \
f_op = EXTRACT_UINT (insn, 32, 31, 2); \
#define EXTRACT_IFMT_TA_VARS \
/* Instruction fields. */ \
UINT f_rs2; \
INT f_res_asi; \
UINT f_i; \
UINT f_rs1; \
UINT f_op3; \
UINT f_fmt2_cond; \
UINT f_a; \
UINT f_op; \
unsigned int length;
#define EXTRACT_IFMT_TA_CODE \
length = 4; \
f_rs2 = EXTRACT_UINT (insn, 32, 4, 5); \
f_res_asi = EXTRACT_INT (insn, 32, 12, 8); \
f_i = EXTRACT_UINT (insn, 32, 13, 1); \
f_rs1 = EXTRACT_UINT (insn, 32, 18, 5); \
f_op3 = EXTRACT_UINT (insn, 32, 24, 6); \
f_fmt2_cond = EXTRACT_UINT (insn, 32, 28, 4); \
f_a = EXTRACT_UINT (insn, 32, 29, 1); \
f_op = EXTRACT_UINT (insn, 32, 31, 2); \
#define EXTRACT_IFMT_TA_IMM_VARS \
/* Instruction fields. */ \
INT f_simm13; \
UINT f_i; \
UINT f_rs1; \
UINT f_op3; \
UINT f_fmt2_cond; \
UINT f_a; \
UINT f_op; \
unsigned int length;
#define EXTRACT_IFMT_TA_IMM_CODE \
length = 4; \
f_simm13 = EXTRACT_INT (insn, 32, 12, 13); \
f_i = EXTRACT_UINT (insn, 32, 13, 1); \
f_rs1 = EXTRACT_UINT (insn, 32, 18, 5); \
f_op3 = EXTRACT_UINT (insn, 32, 24, 6); \
f_fmt2_cond = EXTRACT_UINT (insn, 32, 28, 4); \
f_a = EXTRACT_UINT (insn, 32, 29, 1); \
f_op = EXTRACT_UINT (insn, 32, 31, 2); \
/* Collection of various things for the trace handler to use. */
typedef struct trace_record {
IADDR pc;
/* FIXME:wip */
} TRACE_RECORD;
#endif /* CPU_SPARC32_H */
|