* A few more improvements to gx jit prototype.
[deliverable/binutils-gdb.git] / sim / m32r-gx / sim-main.h
1 /* Main header for the m32r-gx. */
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 /* sim-basics.h includes config.h but cgen-types.h must be included before
12 sim-basics.h and cgen-types.h needs config.h. */
13 #include "config.h"
14
15 #include "ansidecl.h"
16 #include "symcat.h"
17 #include "cgen-types.h"
18 #include "arch.h"
19 #include "sim-basics.h"
20
21 /* These must be defined before sim-base.h. */
22 typedef USI sim_cia;
23 #define CIA_GET(cpu) (cpu)->regs.h_pc
24 #define CIA_SET(cpu,val) (cpu)->regs.h_pc = (val)
25
26 #define TRAP_SYSCALL 0
27
28 #include "sim-base.h"
29 #include "cpu-sim.h"
30
31 #ifdef WANT_CPU_M32R
32 #include "cpu.h"
33 #include "decode.h"
34 #endif
35 #include "cpuall.h"
36
37
38 /* match with definition in gx-translate.c! */
39 typedef struct tgx_cpu_regs
40 {
41 unsigned int h_pc; /* program counter */
42 signed int h_gr[16]; /* general registers */
43 unsigned int h_cr[16]; /* control registers */
44 long long h_accum; /* accumulator */
45 unsigned h_lock; /* lock */
46 } tgx_cpu_regs;
47
48 /* match with definition in gx-translate.c! */
49 typedef struct tgx_syscall_data
50 {
51 unsigned pc;
52 unsigned func;
53 unsigned arg1;
54 unsigned arg2;
55 unsigned arg3;
56 unsigned errcode;
57 unsigned result;
58 unsigned result2;
59 } tgx_syscall_data;
60
61
62 struct tgx_info;
63
64 /* match with definition in gx-translate.c! */
65 typedef struct tgx_callbacks
66 {
67 unsigned (*load)(struct tgx_info* info, unsigned pc, unsigned addr);
68 void (*store)(struct tgx_info* info, unsigned pc, unsigned addr, unsigned data);
69 signed char (*load1)(struct tgx_info* info, unsigned pc, unsigned addr);
70 void (*store1)(struct tgx_info* info, unsigned pc, unsigned addr, signed char data);
71 signed short (*load2)(struct tgx_info* info, unsigned pc, unsigned addr);
72 void (*store2)(struct tgx_info* info, unsigned pc, unsigned addr, signed short data);
73 void (*syscall)(struct tgx_info* info, tgx_syscall_data* data);
74 } tgx_callbacks;
75
76
77 typedef struct tgx_info
78 {
79 struct tgx_cpu_regs* regs;
80 char* pc_flags;
81 struct tgx_callbacks* callbacks;
82 } tgx_info;
83
84
85 struct _sim_cpu
86 {
87 sim_cpu_base base;
88 tgx_cpu_regs regs;
89 };
90
91 struct sim_state {
92 sim_cpu *cpu;
93 #define STATE_CPU(sd, n) (/*&*/ (sd)->cpu)
94 sim_state_base base;
95 };
96
97
98 /* Default memory size. */
99 #define M32R_DEFAULT_MEM_SIZE 0x800000 /* 8M */
100
101
102
103 /* Register access fns. These look up the current mach and call the
104 appropriate handler. */
105 SI h_gr_get (SIM_CPU *, UINT);
106 void h_gr_set (SIM_CPU *, UINT, SI);
107
108
109 #endif /* SIM_MAIN_H */
This page took 0.070442 seconds and 4 git commands to generate.