Watchpoint interface.
[deliverable/binutils-gdb.git] / sim / tic80 / interp.c
1 /* This file is part of the GDB simulators.
2
3 Copyright (C) 1997, Free Software Foundation
4 Condtributed by Cyngnus Solutions.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
20 */
21
22
23
24 #include "sim-main.h"
25
26 #include "idecode.h"
27 #include "itable.h"
28
29 #include <signal.h>
30
31 #ifdef HAVE_STRING_H
32 #include <string.h>
33 #else
34 #ifdef HAVE_STRINGS_H
35 #include <strings.h>
36 #endif
37 #endif
38
39
40 #if 0
41
42 void
43 engine_error (SIM_DESC sd,
44 sim_cpu *cpu,
45 instruction_address cia,
46 const char *fmt,
47 ...)
48 {
49 va_list ap;
50 va_start (ap, fmt);
51 sim_io_evprintf (sd, fmt, ap);
52 va_end (ap);
53
54 sim_halt (sd, cpu, NULL, cia, sim_stopped, SIGABRT);
55 }
56
57 void
58 engine_halt (SIM_DESC sd,
59 sim_cpu *cpu,
60 instruction_address cia,
61 enum sim_stop reason,
62 int siggnal)
63 {
64 if (!sd->halt_ok)
65 sim_io_error (sd, "engine_halt - bad longjmp");
66 sd->reason = reason;
67 sd->siggnal = siggnal;
68 sd->halt_ok = 0;
69 sd->restart_ok = 0;
70 if (cpu != NULL)
71 cpu->cia = cia;
72 longjmp (sd->path_to_halt, 1);
73 }
74
75 void
76 engine_restart (SIM_DESC sd,
77 sim_cpu *cpu,
78 instruction_address cia)
79 {
80 if (!sd->restart_ok)
81 sim_io_error (sd, "engine_restart - bad longjmp");
82 sd->restart_ok = 0;
83 cpu->cia = cia;
84 longjmp(sd->path_to_restart, 1);
85 }
86
87
88 void
89 engine_run_until_stop (SIM_DESC sd,
90 volatile int *keep_running)
91 {
92 if (!setjmp (sd->path_to_halt))
93 {
94 instruction_address cia;
95 sim_cpu *cpu = STATE_CPU (sd, 0);
96 sd->halt_ok = 1;
97 setjmp (sd->path_to_restart);
98 sd->restart_ok = 1;
99 cia = cpu->cia;
100 do
101 {
102 instruction_word insn = IMEM (cia);
103 cia = idecode_issue (sd, insn, cia);
104 }
105 while (*keep_running);
106 engine_halt (sd, cpu, cia, sim_stopped, SIGINT);
107 }
108 }
109
110
111 void
112 engine_step (SIM_DESC sd)
113 {
114 if (!setjmp (sd->path_to_halt))
115 {
116 instruction_address cia;
117 instruction_word insn;
118 sim_cpu *cpu = STATE_CPU (sd, 0);
119 sd->halt_ok = 1;
120 setjmp (sd->path_to_restart);
121 sd->restart_ok = 1;
122 cia = cpu->cia;
123 insn = IMEM (cia);
124 cia = idecode_issue (sd, insn, cia);
125 engine_halt (sd, cpu, cia, sim_stopped, SIGTRAP);
126 }
127 }
128
129 #endif
130
This page took 0.035363 seconds and 4 git commands to generate.