]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - sim/frv/sim-main.h
sim: unify SIM_CPU definition
[thirdparty/binutils-gdb.git] / sim / frv / sim-main.h
CommitLineData
b34f6357 1/* frv simulator support code
32d0add0 2 Copyright (C) 1998-2015 Free Software Foundation, Inc.
b34f6357
DB
3 Contributed by Red Hat.
4
5This file is part of the GNU simulators.
6
7This program is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
4744ac1b
JB
9the Free Software Foundation; either version 3 of the License, or
10(at your option) any later version.
b34f6357
DB
11
12This program is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
4744ac1b
JB
17You should have received a copy of the GNU General Public License
18along with this program. If not, see <http://www.gnu.org/licenses/>. */
b34f6357
DB
19
20/* Main header for the frv. */
21
22#define USING_SIM_BASE_H /* FIXME: quick hack */
23
b34f6357
DB
24/* Set the mask of unsupported traces. */
25#define WITH_TRACE \
26 (~(TRACE_alu | TRACE_decode | TRACE_memory | TRACE_model | TRACE_fpu \
27 | TRACE_branch | TRACE_debug))
28
29/* sim-basics.h includes config.h but cgen-types.h must be included before
30 sim-basics.h and cgen-types.h needs config.h. */
31#include "config.h"
32
33#include "symcat.h"
34#include "sim-basics.h"
35#include "cgen-types.h"
36#include "frv-desc.h"
37#include "frv-opc.h"
38#include "arch.h"
39
b34f6357
DB
40#define SIM_ENGINE_HALT_HOOK(SD, LAST_CPU, CIA) \
41 frv_sim_engine_halt_hook ((SD), (LAST_CPU), (CIA))
42
43#define SIM_ENGINE_RESTART_HOOK(SD, LAST_CPU, CIA) 0
44
45#include "sim-base.h"
46#include "cgen-sim.h"
47#include "frv-sim.h"
48#include "cache.h"
49#include "registers.h"
50#include "profile.h"
7e83aa92
MF
51
52void frv_sim_engine_halt_hook (SIM_DESC, SIM_CPU *, sim_cia);
b34f6357
DB
53\f
54/* The _sim_cpu struct. */
55
56struct _sim_cpu {
57 /* sim/common cpu base. */
58 sim_cpu_base base;
59
60 /* Static parts of cgen. */
61 CGEN_CPU cgen_cpu;
62
63 /* CPU specific parts go here.
64 Note that in files that don't need to access these pieces WANT_CPU_FOO
65 won't be defined and thus these parts won't appear. This is ok in the
66 sense that things work. It is a source of bugs though.
67 One has to of course be careful to not take the size of this
68 struct and no structure members accessed in non-cpu specific files can
69 go after here. Oh for a better language. */
70#if defined (WANT_CPU_FRVBF)
71 FRVBF_CPU_DATA cpu_data;
72
73 /* Control information for registers */
74 FRV_REGISTER_CONTROL register_control;
75#define CPU_REGISTER_CONTROL(cpu) (& (cpu)->register_control)
76
77 FRV_VLIW vliw;
78#define CPU_VLIW(cpu) (& (cpu)->vliw)
79
80 FRV_CACHE insn_cache;
81#define CPU_INSN_CACHE(cpu) (& (cpu)->insn_cache)
82
83 FRV_CACHE data_cache;
84#define CPU_DATA_CACHE(cpu) (& (cpu)->data_cache)
85
86 FRV_PROFILE_STATE profile_state;
87#define CPU_PROFILE_STATE(cpu) (& (cpu)->profile_state)
88
89 int debug_state;
90#define CPU_DEBUG_STATE(cpu) ((cpu)->debug_state)
91
92 SI load_address;
93#define CPU_LOAD_ADDRESS(cpu) ((cpu)->load_address)
94
95 SI load_length;
96#define CPU_LOAD_LENGTH(cpu) ((cpu)->load_length)
97
98 SI load_flag;
99#define CPU_LOAD_SIGNED(cpu) ((cpu)->load_flag)
100#define CPU_LOAD_LOCK(cpu) ((cpu)->load_flag)
101
102 SI store_flag;
103#define CPU_RSTR_INVALIDATE(cpu) ((cpu)->store_flag)
104
105 unsigned long elf_flags;
106#define CPU_ELF_FLAGS(cpu) ((cpu)->elf_flags)
107#endif /* defined (WANT_CPU_FRVBF) */
108};
109\f
110/* The sim_state struct. */
111
112struct sim_state {
f95f4ed2 113 sim_cpu *cpu[MAX_NR_PROCESSORS];
b34f6357
DB
114
115 CGEN_STATE cgen_state;
116
117 sim_state_base base;
118};
119\f
120/* Misc. */
121
122/* Catch address exceptions. */
123extern SIM_CORE_SIGNAL_FN frv_core_signal;
124#define SIM_CORE_SIGNAL(SD,CPU,CIA,MAP,NR_BYTES,ADDR,TRANSFER,ERROR) \
125frv_core_signal ((SD), (CPU), (CIA), (MAP), (NR_BYTES), (ADDR), \
126 (TRANSFER), (ERROR))
127
128/* Default memory size. */
129#define FRV_DEFAULT_MEM_SIZE 0x800000 /* 8M */