1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
|
/* OBSOLETE /* Mitsubishi Electric Corp. D30V Simulator. */
/* OBSOLETE Copyright (C) 1997, Free Software Foundation, Inc. */
/* OBSOLETE Contributed by Cygnus Support. */
/* OBSOLETE */
/* OBSOLETE This file is part of GDB, the GNU debugger. */
/* OBSOLETE */
/* OBSOLETE This program is free software; you can redistribute it and/or modify */
/* OBSOLETE it under the terms of the GNU General Public License as published by */
/* OBSOLETE the Free Software Foundation; either version 2, or (at your option) */
/* OBSOLETE any later version. */
/* OBSOLETE */
/* OBSOLETE This program is distributed in the hope that it will be useful, */
/* OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* OBSOLETE GNU General Public License for more details. */
/* OBSOLETE */
/* OBSOLETE You should have received a copy of the GNU General Public License along */
/* OBSOLETE with this program; if not, write to the Free Software Foundation, Inc., */
/* OBSOLETE 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ */
/* OBSOLETE */
/* OBSOLETE */
/* OBSOLETE #ifndef _CPU_C_ */
/* OBSOLETE #define _CPU_C_ */
/* OBSOLETE */
/* OBSOLETE #include "sim-main.h" */
/* OBSOLETE */
/* OBSOLETE */
/* OBSOLETE int */
/* OBSOLETE is_wrong_slot (SIM_DESC sd, */
/* OBSOLETE address_word cia, */
/* OBSOLETE itable_index index) */
/* OBSOLETE { */
/* OBSOLETE switch (STATE_CPU (sd, 0)->unit) */
/* OBSOLETE { */
/* OBSOLETE case memory_unit: */
/* OBSOLETE return !itable[index].option[itable_option_mu]; */
/* OBSOLETE case integer_unit: */
/* OBSOLETE return !itable[index].option[itable_option_iu]; */
/* OBSOLETE case any_unit: */
/* OBSOLETE return 0; */
/* OBSOLETE default: */
/* OBSOLETE sim_engine_abort (sd, STATE_CPU (sd, 0), cia, */
/* OBSOLETE "internal error - is_wrong_slot - bad switch"); */
/* OBSOLETE return -1; */
/* OBSOLETE } */
/* OBSOLETE } */
/* OBSOLETE */
/* OBSOLETE int */
/* OBSOLETE is_condition_ok (SIM_DESC sd, */
/* OBSOLETE address_word cia, */
/* OBSOLETE int cond) */
/* OBSOLETE { */
/* OBSOLETE switch (cond) */
/* OBSOLETE { */
/* OBSOLETE case 0x0: */
/* OBSOLETE return 1; */
/* OBSOLETE case 0x1: */
/* OBSOLETE return PSW_VAL(PSW_F0); */
/* OBSOLETE case 0x2: */
/* OBSOLETE return !PSW_VAL(PSW_F0); */
/* OBSOLETE case 0x3: */
/* OBSOLETE return PSW_VAL(PSW_F1); */
/* OBSOLETE case 0x4: */
/* OBSOLETE return !PSW_VAL(PSW_F1); */
/* OBSOLETE case 0x5: */
/* OBSOLETE return PSW_VAL(PSW_F0) && PSW_VAL(PSW_F1); */
/* OBSOLETE case 0x6: */
/* OBSOLETE return PSW_VAL(PSW_F0) && !PSW_VAL(PSW_F1); */
/* OBSOLETE case 0x7: */
/* OBSOLETE sim_engine_abort (sd, STATE_CPU (sd, 0), cia, */
/* OBSOLETE "is_condition_ok - bad instruction condition bits"); */
/* OBSOLETE return 0; */
/* OBSOLETE default: */
/* OBSOLETE sim_engine_abort (sd, STATE_CPU (sd, 0), cia, */
/* OBSOLETE "internal error - is_condition_ok - bad switch"); */
/* OBSOLETE return -1; */
/* OBSOLETE } */
/* OBSOLETE } */
/* OBSOLETE */
/* OBSOLETE /* If --trace-call, trace calls, remembering the current state of */
/* OBSOLETE registers. */ */
/* OBSOLETE */
/* OBSOLETE typedef struct _call_stack { */
/* OBSOLETE struct _call_stack *prev; */
/* OBSOLETE registers regs; */
/* OBSOLETE } call_stack; */
/* OBSOLETE */
/* OBSOLETE static call_stack *call_stack_head = (call_stack *)0; */
/* OBSOLETE static int call_depth = 0; */
/* OBSOLETE */
/* OBSOLETE void call_occurred (SIM_DESC sd, */
/* OBSOLETE sim_cpu *cpu, */
/* OBSOLETE address_word cia, */
/* OBSOLETE address_word nia) */
/* OBSOLETE { */
/* OBSOLETE call_stack *ptr = ZALLOC (call_stack); */
/* OBSOLETE ptr->regs = cpu->regs; */
/* OBSOLETE ptr->prev = call_stack_head; */
/* OBSOLETE call_stack_head = ptr; */
/* OBSOLETE */
/* OBSOLETE trace_one_insn (sd, cpu, nia, 1, "", 0, "call", */
/* OBSOLETE "Depth %3d, Return 0x%.8lx, Args 0x%.8lx 0x%.8lx", */
/* OBSOLETE ++call_depth, (unsigned long)cia+8, (unsigned long)GPR[2], */
/* OBSOLETE (unsigned long)GPR[3]); */
/* OBSOLETE } */
/* OBSOLETE */
/* OBSOLETE /* If --trace-call, trace returns, checking if any saved register was changed. */ */
/* OBSOLETE */
/* OBSOLETE void return_occurred (SIM_DESC sd, */
/* OBSOLETE sim_cpu *cpu, */
/* OBSOLETE address_word cia, */
/* OBSOLETE address_word nia) */
/* OBSOLETE { */
/* OBSOLETE char buffer[1024]; */
/* OBSOLETE char *buf_ptr = buffer; */
/* OBSOLETE call_stack *ptr = call_stack_head; */
/* OBSOLETE int regno; */
/* OBSOLETE char *prefix = ", Registers that differ: "; */
/* OBSOLETE */
/* OBSOLETE *buf_ptr = '\0'; */
/* OBSOLETE for (regno = 34; regno <= 63; regno++) { */
/* OBSOLETE if (cpu->regs.general_purpose[regno] != ptr->regs.general_purpose[regno]) { */
/* OBSOLETE sprintf (buf_ptr, "%sr%d", prefix, regno); */
/* OBSOLETE buf_ptr += strlen (buf_ptr); */
/* OBSOLETE prefix = " "; */
/* OBSOLETE } */
/* OBSOLETE } */
/* OBSOLETE */
/* OBSOLETE if (cpu->regs.accumulator[1] != ptr->regs.accumulator[1]) { */
/* OBSOLETE sprintf (buf_ptr, "%sa1", prefix); */
/* OBSOLETE buf_ptr += strlen (buf_ptr); */
/* OBSOLETE prefix = " "; */
/* OBSOLETE } */
/* OBSOLETE */
/* OBSOLETE trace_one_insn (sd, cpu, cia, 1, "", 0, "return", */
/* OBSOLETE "Depth %3d, Return 0x%.8lx, Ret. 0x%.8lx 0x%.8lx%s", */
/* OBSOLETE call_depth--, (unsigned long)nia, (unsigned long)GPR[2], */
/* OBSOLETE (unsigned long)GPR[3], buffer); */
/* OBSOLETE */
/* OBSOLETE call_stack_head = ptr->prev; */
/* OBSOLETE zfree (ptr); */
/* OBSOLETE } */
/* OBSOLETE */
/* OBSOLETE */
/* OBSOLETE /* Read/write functions for system call interface. */ */
/* OBSOLETE int */
/* OBSOLETE d30v_read_mem (host_callback *cb, */
/* OBSOLETE struct cb_syscall *sc, */
/* OBSOLETE unsigned long taddr, */
/* OBSOLETE char *buf, */
/* OBSOLETE int bytes) */
/* OBSOLETE { */
/* OBSOLETE SIM_DESC sd = (SIM_DESC) sc->p1; */
/* OBSOLETE sim_cpu *cpu = STATE_CPU (sd, 0); */
/* OBSOLETE */
/* OBSOLETE return sim_core_read_buffer (sd, cpu, read_map, buf, taddr, bytes); */
/* OBSOLETE } */
/* OBSOLETE */
/* OBSOLETE int */
/* OBSOLETE d30v_write_mem (host_callback *cb, */
/* OBSOLETE struct cb_syscall *sc, */
/* OBSOLETE unsigned long taddr, */
/* OBSOLETE const char *buf, */
/* OBSOLETE int bytes) */
/* OBSOLETE { */
/* OBSOLETE SIM_DESC sd = (SIM_DESC) sc->p1; */
/* OBSOLETE sim_cpu *cpu = STATE_CPU (sd, 0); */
/* OBSOLETE */
/* OBSOLETE return sim_core_write_buffer (sd, cpu, write_map, buf, taddr, bytes); */
/* OBSOLETE } */
/* OBSOLETE */
/* OBSOLETE #endif /* _CPU_C_ */ */
|