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