d5a67cb816765314cb1947d936b20228f827d3e3
[binutils-gdb.git] / sim / frv / sim-main.h
1 /* frv simulator support code
2 Copyright (C) 1998-2015 Free Software Foundation, Inc.
3 Contributed by Red Hat.
4
5 This file is part of the GNU simulators.
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, see <http://www.gnu.org/licenses/>. */
19
20 /* Main header for the frv. */
21
22 /* sim-basics.h includes config.h but cgen-types.h must be included before
23 sim-basics.h and cgen-types.h needs config.h. */
24 #include "config.h"
25
26 #include "symcat.h"
27 #include "sim-basics.h"
28 #include "cgen-types.h"
29 #include "frv-desc.h"
30 #include "frv-opc.h"
31 #include "arch.h"
32
33 #define SIM_ENGINE_HALT_HOOK(SD, LAST_CPU, CIA) \
34 frv_sim_engine_halt_hook ((SD), (LAST_CPU), (CIA))
35
36 #define SIM_ENGINE_RESTART_HOOK(SD, LAST_CPU, CIA) 0
37
38 #include "sim-base.h"
39 #include "cgen-sim.h"
40 #include "frv-sim.h"
41 #include "cache.h"
42 #include "registers.h"
43 #include "profile.h"
44
45 void frv_sim_engine_halt_hook (SIM_DESC, SIM_CPU *, sim_cia);
46 \f
47 /* The _sim_cpu struct. */
48
49 struct _sim_cpu {
50 /* sim/common cpu base. */
51 sim_cpu_base base;
52
53 /* Static parts of cgen. */
54 CGEN_CPU cgen_cpu;
55
56 /* CPU specific parts go here.
57 Note that in files that don't need to access these pieces WANT_CPU_FOO
58 won't be defined and thus these parts won't appear. This is ok in the
59 sense that things work. It is a source of bugs though.
60 One has to of course be careful to not take the size of this
61 struct and no structure members accessed in non-cpu specific files can
62 go after here. Oh for a better language. */
63 #if defined (WANT_CPU_FRVBF)
64 FRVBF_CPU_DATA cpu_data;
65
66 /* Control information for registers */
67 FRV_REGISTER_CONTROL register_control;
68 #define CPU_REGISTER_CONTROL(cpu) (& (cpu)->register_control)
69
70 FRV_VLIW vliw;
71 #define CPU_VLIW(cpu) (& (cpu)->vliw)
72
73 FRV_CACHE insn_cache;
74 #define CPU_INSN_CACHE(cpu) (& (cpu)->insn_cache)
75
76 FRV_CACHE data_cache;
77 #define CPU_DATA_CACHE(cpu) (& (cpu)->data_cache)
78
79 FRV_PROFILE_STATE profile_state;
80 #define CPU_PROFILE_STATE(cpu) (& (cpu)->profile_state)
81
82 int debug_state;
83 #define CPU_DEBUG_STATE(cpu) ((cpu)->debug_state)
84
85 SI load_address;
86 #define CPU_LOAD_ADDRESS(cpu) ((cpu)->load_address)
87
88 SI load_length;
89 #define CPU_LOAD_LENGTH(cpu) ((cpu)->load_length)
90
91 SI load_flag;
92 #define CPU_LOAD_SIGNED(cpu) ((cpu)->load_flag)
93 #define CPU_LOAD_LOCK(cpu) ((cpu)->load_flag)
94
95 SI store_flag;
96 #define CPU_RSTR_INVALIDATE(cpu) ((cpu)->store_flag)
97
98 unsigned long elf_flags;
99 #define CPU_ELF_FLAGS(cpu) ((cpu)->elf_flags)
100 #endif /* defined (WANT_CPU_FRVBF) */
101 };
102 \f
103 /* The sim_state struct. */
104
105 struct sim_state {
106 sim_cpu *cpu[MAX_NR_PROCESSORS];
107
108 CGEN_STATE cgen_state;
109
110 sim_state_base base;
111 };
112 \f
113 /* Misc. */
114
115 /* Catch address exceptions. */
116 extern SIM_CORE_SIGNAL_FN frv_core_signal;
117 #define SIM_CORE_SIGNAL(SD,CPU,CIA,MAP,NR_BYTES,ADDR,TRANSFER,ERROR) \
118 frv_core_signal ((SD), (CPU), (CIA), (MAP), (NR_BYTES), (ADDR), \
119 (TRANSFER), (ERROR))
120
121 /* Default memory size. */
122 #define FRV_DEFAULT_MEM_SIZE 0x800000 /* 8M */