projects
/
deliverable
/
binutils-gdb.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
sim/erc32: Use memory_iread() function for instruction fetching.
[deliverable/binutils-gdb.git]
/
sim
/
erc32
/
interf.c
diff --git
a/sim/erc32/interf.c
b/sim/erc32/interf.c
index d0a781eb937b2adbe4bb42e1f45d6a62056d5f97..59fb635b9e981cee1b577cb161fdb571b90177f0 100644
(file)
--- a/
sim/erc32/interf.c
+++ b/
sim/erc32/interf.c
@@
-6,7
+6,7
@@
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version
2
of the License, or (at your option)
+ * Software Foundation; either version
3
of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
@@
-15,34
+15,27
@@
* more details.
*
* You should have received a copy of the GNU General Public License along with
* more details.
*
* You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 675
- * Mass Ave, Cambridge, MA 02139, USA.
+ * this program; if not, see <http://www.gnu.org/licenses/>.
*
*/
*
*/
+#include "config.h"
#include <signal.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
-#include <time.h>
#include <sys/fcntl.h>
#include "sis.h"
#include <sys/fcntl.h>
#include "sis.h"
+#include "libiberty.h"
#include "bfd.h"
#include <dis-asm.h>
#include "sim-config.h"
#include "bfd.h"
#include <dis-asm.h>
#include "sim-config.h"
-#include "remote-sim.h"
-
-#ifndef fprintf
-extern fprintf();
-#endif
+#include "gdb/remote-sim.h"
+#include "gdb/signals.h"
#define PSR_CWP 0x7
#define PSR_CWP 0x7
-#define VAL(x) strtol(x,(char **)NULL,0)
-
-extern char **buildargv(char *input);
-
extern struct disassemble_info dinfo;
extern struct pstate sregs;
extern struct estate ebase;
extern struct disassemble_info dinfo;
extern struct pstate sregs;
extern struct estate ebase;
@@
-73,7
+66,7
@@
host_callback *sim_callback;
int
run_sim(sregs, icount, dis)
struct pstate *sregs;
int
run_sim(sregs, icount, dis)
struct pstate *sregs;
- u
nsigned int
icount;
+ u
int64
icount;
int dis;
{
int mexc, irq;
int dis;
{
int mexc, irq;
@@
-82,8
+75,10
@@
run_sim(sregs, icount, dis)
(*sim_callback->printf_filtered) (sim_callback, "resuming at %x\n",
sregs->pc);
init_stdio();
(*sim_callback->printf_filtered) (sim_callback, "resuming at %x\n",
sregs->pc);
init_stdio();
- sregs->starttime =
time(NULL
);
+ sregs->starttime =
get_time(
);
irq = 0;
irq = 0;
+ if ((sregs->pc != 0) && (ebase.simtime == 0))
+ boot_init();
while (!sregs->err_mode & (icount > 0)) {
sregs->fhold = 0;
while (!sregs->err_mode & (icount > 0)) {
sregs->fhold = 0;
@@
-100,9
+95,8
@@
run_sim(sregs, icount, dis)
if (sregs->pc == 0 || sregs->npc == 0)
printf ("bogus pc or npc\n");
#endif
if (sregs->pc == 0 || sregs->npc == 0)
printf ("bogus pc or npc\n");
#endif
- mexc = memory_read(sregs->asi, sregs->pc, &sregs->inst,
- 2, &sregs->hold);
-#if 1 /* DELETE ME! for debugging purposes only */
+ mexc = memory_iread (sregs->pc, &sregs->inst, &sregs->hold);
+#if 0 /* DELETE ME! for debugging purposes only */
if (sis_verbose > 2)
printf("pc %x, np %x, sp %x, fp %x, wm %x, cw %x, i %08x\n",
sregs->pc, sregs->npc,
if (sis_verbose > 2)
printf("pc %x, np %x, sp %x, fp %x, wm %x, cw %x, i %08x\n",
sregs->pc, sregs->npc,
@@
-130,7
+124,7
@@
run_sim(sregs, icount, dis)
sim_halt();
restore_stdio();
clearerr(stdin);
sim_halt();
restore_stdio();
clearerr(stdin);
- return
(BPT_HIT)
;
+ return
BPT_HIT
;
} else
dispatch_instruction(sregs);
}
} else
dispatch_instruction(sregs);
}
@@
-147,44
+141,31
@@
run_sim(sregs, icount, dis)
}
}
sim_halt();
}
}
sim_halt();
- sregs->tottime +=
time(NULL
) - sregs->starttime;
+ sregs->tottime +=
get_time(
) - sregs->starttime;
restore_stdio();
clearerr(stdin);
if (sregs->err_mode)
error_mode(sregs->pc);
if (sregs->err_mode)
restore_stdio();
clearerr(stdin);
if (sregs->err_mode)
error_mode(sregs->pc);
if (sregs->err_mode)
- return
(ERROR)
;
+ return
ERROR
;
if (sregs->bphit) {
if (sis_verbose)
(*sim_callback->printf_filtered) (sim_callback,
"HW BP hit at %x\n", sregs->pc);
if (sregs->bphit) {
if (sis_verbose)
(*sim_callback->printf_filtered) (sim_callback,
"HW BP hit at %x\n", sregs->pc);
- return
(BPT_HIT)
;
+ return
BPT_HIT
;
}
if (ctrl_c) {
ctrl_c = 0;
}
if (ctrl_c) {
ctrl_c = 0;
- return
(CTRL_C)
;
+ return
CTRL_C
;
}
}
- return (TIME_OUT);
-}
-
-void
-sim_set_callbacks (ptr)
- host_callback *ptr;
-{
- sim_callback = ptr;
-}
-
-void
-sim_size (memsize)
- int memsize;
-{
+ return TIME_OUT;
}
SIM_DESC
sim_open (kind, callback, abfd, argv)
SIM_OPEN_KIND kind;
struct host_callback_struct *callback;
}
SIM_DESC
sim_open (kind, callback, abfd, argv)
SIM_OPEN_KIND kind;
struct host_callback_struct *callback;
- struct
_
bfd *abfd;
+ struct bfd *abfd;
char **argv;
{
char **argv;
{
@@
-238,8
+219,11
@@
sim_open (kind, callback, abfd, argv)
} else
if (strcmp(argv[stat], "-freq") == 0) {
if ((stat + 1) < argc) {
} else
if (strcmp(argv[stat], "-freq") == 0) {
if ((stat + 1) < argc) {
- freq =
VAL(argv[++stat]
);
+ freq =
strtol(argv[++stat], (char **)NULL, 0
);
}
}
+ } else
+ if (strncmp(argv[stat], "--sysroot=", sizeof("--sysroot=") - 1) == 0) {
+ /* Ignore until we start to support this. */
} else {
(*sim_callback->printf_filtered) (sim_callback,
"unknown option %s\n",
} else {
(*sim_callback->printf_filtered) (sim_callback,
"unknown option %s\n",
@@
-293,7
+277,7
@@
sim_close(sd, quitting)
SIM_RC
sim_load(sd, prog, abfd, from_tty)
SIM_DESC sd;
SIM_RC
sim_load(sd, prog, abfd, from_tty)
SIM_DESC sd;
- char *prog;
+ c
onst c
har *prog;
bfd *abfd;
int from_tty;
{
bfd *abfd;
int from_tty;
{
@@
-304,7
+288,7
@@
sim_load(sd, prog, abfd, from_tty)
SIM_RC
sim_create_inferior(sd, abfd, argv, env)
SIM_DESC sd;
SIM_RC
sim_create_inferior(sd, abfd, argv, env)
SIM_DESC sd;
- struct
_
bfd *abfd;
+ struct bfd *abfd;
char **argv;
char **env;
{
char **argv;
char **env;
{
@@
-336,7
+320,7
@@
sim_store_register(sd, regno, value, length)
regval = (value[3] << 24) | (value[2] << 16)
| (value[1] << 8) | value[0];
set_regi(&sregs, regno, regval);
regval = (value[3] << 24) | (value[2] << 16)
| (value[1] << 8) | value[0];
set_regi(&sregs, regno, regval);
- return
-1
;
+ return
length
;
}
}
@@
-355,10
+339,10
@@
int
sim_write(sd, mem, buf, length)
SIM_DESC sd;
SIM_ADDR mem;
sim_write(sd, mem, buf, length)
SIM_DESC sd;
SIM_ADDR mem;
- unsigned char *buf;
+
const
unsigned char *buf;
int length;
{
int length;
{
- return
(sis_memory_write(mem, buf, length)
);
+ return
sis_memory_write (mem, buf, length
);
}
int
}
int
@@
-368,7
+352,7
@@
sim_read(sd, mem, buf, length)
unsigned char *buf;
int length;
{
unsigned char *buf;
int length;
{
- return
(sis_memory_read(mem, buf, length)
);
+ return
sis_memory_read (mem, buf, length
);
}
void
}
void
@@
-391,16
+375,13
@@
sim_stop_reason(sd, reason, sigrc)
switch (simstat) {
case CTRL_C:
*reason = sim_stopped;
switch (simstat) {
case CTRL_C:
*reason = sim_stopped;
- *sigrc =
SIG
INT;
+ *sigrc =
GDB_SIGNAL_
INT;
break;
case OK:
case TIME_OUT:
case BPT_HIT:
*reason = sim_stopped;
break;
case OK:
case TIME_OUT:
case BPT_HIT:
*reason = sim_stopped;
-#ifdef _WIN32
-#define SIGTRAP 5
-#endif
- *sigrc = SIGTRAP;
+ *sigrc = GDB_SIGNAL_TRAP;
break;
case ERROR:
*sigrc = 0;
break;
case ERROR:
*sigrc = 0;
@@
-468,28
+449,25
@@
flush_windows ()
void
sim_resume(SIM_DESC sd, int step, int siggnal)
{
void
sim_resume(SIM_DESC sd, int step, int siggnal)
{
- simstat = run_sim(&sregs,
-1
, 0);
+ simstat = run_sim(&sregs,
UINT64_MAX
, 0);
if (sis_gdb_break) flush_windows ();
}
if (sis_gdb_break) flush_windows ();
}
-int
-sim_trace (sd)
- SIM_DESC sd;
-{
- /* FIXME: unfinished */
- sim_resume (sd, 0, 0);
- return 1;
-}
-
void
sim_do_command(sd, cmd)
SIM_DESC sd;
void
sim_do_command(sd, cmd)
SIM_DESC sd;
-
char
*cmd;
+
const char
*cmd;
{
exec_cmd(&sregs, cmd);
}
{
exec_cmd(&sregs, cmd);
}
+char **
+sim_complete_command (SIM_DESC sd, const char *text, const char *word)
+{
+ return NULL;
+}
+
#if 0 /* FIXME: These shouldn't exist. */
int
#if 0 /* FIXME: These shouldn't exist. */
int
This page took
0.026076 seconds
and
4
git commands to generate.