Implement 32 bit MIPS16 instructions listed in m16.igen.
[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 28
d9b75947
AC
29#ifdef HAVE_STRING_H
30#include <string.h>
31#else
32#ifdef HAVE_STRINGS_H
33#include <strings.h>
34#endif
35#endif
36
15c16493 37
f03b093c 38#if 0
15c16493
AC
39
40void
41engine_error (SIM_DESC sd,
abe293a0 42 sim_cpu *cpu,
15c16493
AC
43 instruction_address cia,
44 const char *fmt,
45 ...)
46{
47 va_list ap;
48 va_start (ap, fmt);
49 sim_io_evprintf (sd, fmt, ap);
50 va_end (ap);
51
f03b093c 52 sim_halt (sd, cpu, NULL, cia, sim_stopped, SIGABRT);
15c16493
AC
53}
54
55void
56engine_halt (SIM_DESC sd,
abe293a0 57 sim_cpu *cpu,
15c16493
AC
58 instruction_address cia,
59 enum sim_stop reason,
60 int siggnal)
61{
62 if (!sd->halt_ok)
63 sim_io_error (sd, "engine_halt - bad longjmp");
64 sd->reason = reason;
65 sd->siggnal = siggnal;
66 sd->halt_ok = 0;
67 sd->restart_ok = 0;
abe293a0
AC
68 if (cpu != NULL)
69 cpu->cia = cia;
15c16493
AC
70 longjmp (sd->path_to_halt, 1);
71}
72
73void
74engine_restart (SIM_DESC sd,
abe293a0 75 sim_cpu *cpu,
15c16493
AC
76 instruction_address cia)
77{
78 if (!sd->restart_ok)
79 sim_io_error (sd, "engine_restart - bad longjmp");
80 sd->restart_ok = 0;
abe293a0 81 cpu->cia = cia;
15c16493
AC
82 longjmp(sd->path_to_restart, 1);
83}
84
85
86void
87engine_run_until_stop (SIM_DESC sd,
88 volatile int *keep_running)
89{
90 if (!setjmp (sd->path_to_halt))
91 {
92 instruction_address cia;
abe293a0 93 sim_cpu *cpu = STATE_CPU (sd, 0);
15c16493
AC
94 sd->halt_ok = 1;
95 setjmp (sd->path_to_restart);
96 sd->restart_ok = 1;
abe293a0 97 cia = cpu->cia;
15c16493
AC
98 do
99 {
84902350
AC
100 instruction_word insn = IMEM (cia);
101 cia = idecode_issue (sd, insn, cia);
15c16493
AC
102 }
103 while (*keep_running);
aaa11abe 104 engine_halt (sd, cpu, cia, sim_stopped, SIM_SIGINT);
15c16493
AC
105 }
106}
c445af5a
AC
107
108
109void
110engine_step (SIM_DESC sd)
111{
112 if (!setjmp (sd->path_to_halt))
113 {
114 instruction_address cia;
84902350 115 instruction_word insn;
c445af5a
AC
116 sim_cpu *cpu = STATE_CPU (sd, 0);
117 sd->halt_ok = 1;
118 setjmp (sd->path_to_restart);
119 sd->restart_ok = 1;
120 cia = cpu->cia;
84902350
AC
121 insn = IMEM (cia);
122 cia = idecode_issue (sd, insn, cia);
aaa11abe 123 engine_halt (sd, cpu, cia, sim_stopped, SIM_SIGTRAP);
c445af5a
AC
124 }
125}
f03b093c
AC
126
127#endif
This page took 0.138197 seconds and 4 git commands to generate.