Watchpoint interface.
[deliverable/binutils-gdb.git] / sim / tic80 / interp.c
CommitLineData
15c16493
AC
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"
7b167b09 27#include "itable.h"
15c16493
AC
28
29#include <signal.h>
30
d9b75947
AC
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
15c16493 39
f03b093c 40#if 0
15c16493
AC
41
42void
43engine_error (SIM_DESC sd,
abe293a0 44 sim_cpu *cpu,
15c16493
AC
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
f03b093c 54 sim_halt (sd, cpu, NULL, cia, sim_stopped, SIGABRT);
15c16493
AC
55}
56
57void
58engine_halt (SIM_DESC sd,
abe293a0 59 sim_cpu *cpu,
15c16493
AC
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;
abe293a0
AC
70 if (cpu != NULL)
71 cpu->cia = cia;
15c16493
AC
72 longjmp (sd->path_to_halt, 1);
73}
74
75void
76engine_restart (SIM_DESC sd,
abe293a0 77 sim_cpu *cpu,
15c16493
AC
78 instruction_address cia)
79{
80 if (!sd->restart_ok)
81 sim_io_error (sd, "engine_restart - bad longjmp");
82 sd->restart_ok = 0;
abe293a0 83 cpu->cia = cia;
15c16493
AC
84 longjmp(sd->path_to_restart, 1);
85}
86
87
88void
89engine_run_until_stop (SIM_DESC sd,
90 volatile int *keep_running)
91{
92 if (!setjmp (sd->path_to_halt))
93 {
94 instruction_address cia;
abe293a0 95 sim_cpu *cpu = STATE_CPU (sd, 0);
15c16493
AC
96 sd->halt_ok = 1;
97 setjmp (sd->path_to_restart);
98 sd->restart_ok = 1;
abe293a0 99 cia = cpu->cia;
15c16493
AC
100 do
101 {
84902350
AC
102 instruction_word insn = IMEM (cia);
103 cia = idecode_issue (sd, insn, cia);
15c16493
AC
104 }
105 while (*keep_running);
abe293a0 106 engine_halt (sd, cpu, cia, sim_stopped, SIGINT);
15c16493
AC
107 }
108}
c445af5a
AC
109
110
111void
112engine_step (SIM_DESC sd)
113{
114 if (!setjmp (sd->path_to_halt))
115 {
116 instruction_address cia;
84902350 117 instruction_word insn;
c445af5a
AC
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;
84902350
AC
123 insn = IMEM (cia);
124 cia = idecode_issue (sd, insn, cia);
c445af5a
AC
125 engine_halt (sd, cpu, cia, sim_stopped, SIGTRAP);
126 }
127}
f03b093c
AC
128
129#endif
130
This page took 0.029884 seconds and 4 git commands to generate.