sim: unify SIM_CPU definition
[binutils-gdb.git] / sim / m32r / sim-main.h
1 /* Main header for the m32r. */
2
3 #ifndef SIM_MAIN_H
4 #define SIM_MAIN_H
5
6 #define USING_SIM_BASE_H /* FIXME: quick hack */
7
8 #include "symcat.h"
9 #include "sim-basics.h"
10 #include "cgen-types.h"
11 #include "m32r-desc.h"
12 #include "m32r-opc.h"
13 #include "arch.h"
14
15 #define SIM_ENGINE_HALT_HOOK(sd, cpu, cia) \
16 do { \
17 if (cpu) /* null if ctrl-c */ \
18 sim_pc_set ((cpu), (cia)); \
19 } while (0)
20 #define SIM_ENGINE_RESTART_HOOK(sd, cpu, cia) \
21 do { \
22 sim_pc_set ((cpu), (cia)); \
23 } while (0)
24
25 #include "sim-base.h"
26 #include "cgen-sim.h"
27 #include "m32r-sim.h"
28 #include "opcode/cgen.h"
29 \f
30 /* The _sim_cpu struct. */
31
32 struct _sim_cpu {
33 /* sim/common cpu base. */
34 sim_cpu_base base;
35
36 /* Static parts of cgen. */
37 CGEN_CPU cgen_cpu;
38
39 M32R_MISC_PROFILE m32r_misc_profile;
40 #define CPU_M32R_MISC_PROFILE(cpu) (& (cpu)->m32r_misc_profile)
41
42 /* CPU specific parts go here.
43 Note that in files that don't need to access these pieces WANT_CPU_FOO
44 won't be defined and thus these parts won't appear. This is ok in the
45 sense that things work. It is a source of bugs though.
46 One has to of course be careful to not take the size of this
47 struct and no structure members accessed in non-cpu specific files can
48 go after here. Oh for a better language. */
49 #if defined (WANT_CPU_M32RBF)
50 M32RBF_CPU_DATA cpu_data;
51 #endif
52 #if defined (WANT_CPU_M32RXF)
53 M32RXF_CPU_DATA cpu_data;
54 #elif defined (WANT_CPU_M32R2F)
55 M32R2F_CPU_DATA cpu_data;
56 #endif
57 };
58 \f
59 /* The sim_state struct. */
60
61 struct sim_state {
62 sim_cpu *cpu[MAX_NR_PROCESSORS];
63
64 CGEN_STATE cgen_state;
65
66 sim_state_base base;
67 };
68 \f
69 /* Misc. */
70
71 /* Catch address exceptions. */
72 extern SIM_CORE_SIGNAL_FN m32r_core_signal;
73 #define SIM_CORE_SIGNAL(SD,CPU,CIA,MAP,NR_BYTES,ADDR,TRANSFER,ERROR) \
74 m32r_core_signal ((SD), (CPU), (CIA), (MAP), (NR_BYTES), (ADDR), \
75 (TRANSFER), (ERROR))
76
77 /* Default memory size. */
78 #ifdef M32R_LINUX
79 #define M32R_DEFAULT_MEM_SIZE 0x2000000 /* 32M */
80 #else
81 #define M32R_DEFAULT_MEM_SIZE 0x800000 /* 8M */
82 #endif
83
84 #endif /* SIM_MAIN_H */