]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - sim/sh/sim-main.h
sim: replace CIA_{GET,SET} with CPU_PC_{GET,SET}
[thirdparty/binutils-gdb.git] / sim / sh / sim-main.h
CommitLineData
62454d3d
MF
1/* Moxie Simulator definition.
2 Copyright (C) 2009-2015 Free Software Foundation, Inc.
3
4This file is part of GDB, the GNU debugger.
5
6This program is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 3 of the License, or
9(at your option) any later version.
10
11This program is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with this program. If not, see <http://www.gnu.org/licenses/>. */
18
19#ifndef SIM_MAIN_H
20#define SIM_MAIN_H
21
22#include "sim-basics.h"
23
24typedef address_word sim_cia;
25
62454d3d
MF
26typedef struct _sim_cpu SIM_CPU;
27
28#include "sim-base.h"
29
30typedef struct
31{
32 int regs[20];
33} regstacktype;
34
35typedef union
36{
37
38 struct
39 {
40 int regs[16];
41 int pc;
42
43 /* System registers. For sh-dsp this also includes A0 / X0 / X1 / Y0 / Y1
44 which are located in fregs, i.e. strictly speaking, these are
45 out-of-bounds accesses of sregs.i . This wart of the code could be
46 fixed by making fregs part of sregs, and including pc too - to avoid
47 alignment repercussions - but this would cause very onerous union /
48 structure nesting, which would only be managable with anonymous
49 unions and structs. */
50 union
51 {
52 struct
53 {
54 int mach;
55 int macl;
56 int pr;
57 int dummy3, dummy4;
58 int fpul; /* A1 for sh-dsp - but only for movs etc. */
59 int fpscr; /* dsr for sh-dsp */
60 } named;
61 int i[7];
62 } sregs;
63
64 /* sh3e / sh-dsp */
65 union fregs_u
66 {
67 float f[16];
68 double d[8];
69 int i[16];
70 }
71 fregs[2];
72
73 /* Control registers; on the SH4, ldc / stc is privileged, except when
74 accessing gbr. */
75 union
76 {
77 struct
78 {
79 int sr;
80 int gbr;
81 int vbr;
82 int ssr;
83 int spc;
84 int mod;
85 /* sh-dsp */
86 int rs;
87 int re;
88 /* sh3 */
89 int bank[8];
90 int dbr; /* debug base register */
91 int sgr; /* saved gr15 */
92 int ldst; /* load/store flag (boolean) */
93 int tbr;
94 int ibcr; /* sh2a bank control register */
95 int ibnr; /* sh2a bank number register */
96 } named;
97 int i[16];
98 } cregs;
99
100 unsigned char *insn_end;
101
102 int ticks;
103 int stalls;
104 int memstalls;
105 int cycles;
106 int insts;
107
108 int prevlock;
109 int thislock;
110 int exception;
111
112 int end_of_registers;
113
114 int msize;
115#define PROFILE_FREQ 1
116#define PROFILE_SHIFT 2
117 int profile;
118 unsigned short *profile_hist;
119 unsigned char *memory;
120 int xyram_select, xram_start, yram_start;
121 unsigned char *xmem;
122 unsigned char *ymem;
123 unsigned char *xmem_offset;
124 unsigned char *ymem_offset;
125 unsigned long bfd_mach;
126 regstacktype *regstack;
127 } asregs;
128 int asints[40];
129} saved_state_type;
130
131/* TODO: Move into sim_cpu. */
132extern saved_state_type saved_state;
133
134struct _sim_cpu {
135
136 sim_cpu_base base;
137};
138
139struct sim_state {
140
141 sim_cpu *cpu[MAX_NR_PROCESSORS];
62454d3d
MF
142
143 sim_state_base base;
144};
145
146#endif