/* Simulation code for the CR16 processor.
- Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+ Copyright (C) 2008-2014 Free Software Foundation, Inc.
Contributed by M Ranga Swami Reddy <MR.Swami.Reddy@nsc.com>
This file is part of GDB, the GNU debugger.
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, or (at your option)
+ the Free Software Foundation; either version 3, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
+#include "config.h"
#include <signal.h>
-#include "sysdep.h"
+#include <stdlib.h>
+#include <string.h>
#include "bfd.h"
#include "gdb/callback.h"
#include "gdb/remote-sim.h"
bfd_vma text_start;
bfd_vma text_end;
-static struct hash_entry *lookup_hash PARAMS ((uint64 ins, int size));
-static void get_operands PARAMS ((operand_desc *s, uint64 mcode, int isize, int nops));
-static int do_run PARAMS ((uint64 mc));
-static char *add_commas PARAMS ((char *buf, int sizeof_buf, unsigned long value));
-extern void sim_set_profile PARAMS ((int n));
-extern void sim_set_profile_size PARAMS ((int n));
+static struct hash_entry *lookup_hash (uint64 ins, int size);
+static void get_operands (operand_desc *s, uint64 mcode, int isize, int nops);
+static int do_run (uint64 mc);
+static char *add_commas (char *buf, int sizeof_buf, unsigned long value);
+extern void sim_set_profile (int n);
+extern void sim_set_profile_size (int n);
static INLINE uint8 *map_memory (unsigned phys_addr);
#ifdef NEED_UI_LOOP_HOOK
static long ui_loop_hook_counter = UI_LOOP_POLL_INTERVAL;
/* Actual hook to call to run through gdb's gui event loop */
-extern int (*deprecated_ui_loop_hook) PARAMS ((int signo));
+extern int (*deprecated_ui_loop_hook) (int signo);
#endif /* NEED_UI_LOOP_HOOK */
#ifndef INLINE
sim_write (sd, addr, buffer, size)
SIM_DESC sd;
SIM_ADDR addr;
- unsigned char *buffer;
+ const unsigned char *buffer;
int size;
{
/* FIXME: this should be performing a virtual transfer */
iaddr = imem_addr ((uint32)PC);
if (iaddr == State.mem.fault)
{
+#ifdef SIGBUS
State.exception = SIGBUS;
+#else
+ State.exception = SIGSEGV;
+#endif
break;
}
case SIG_CR16_BUS:
*reason = sim_stopped;
- *sigrc = TARGET_SIGNAL_BUS;
+ *sigrc = GDB_SIGNAL_BUS;
break;
//
// case SIG_CR16_IAD:
// *reason = sim_stopped;
-// *sigrc = TARGET_SIGNAL_IAD;
+// *sigrc = GDB_SIGNAL_IAD;
// break;
default: /* some signal */
*reason = sim_stopped;
if (stop_simulator && !State.exception)
- *sigrc = TARGET_SIGNAL_INT;
+ *sigrc = GDB_SIGNAL_INT;
else
*sigrc = State.exception;
break;
return size;
}
+char **
+sim_complete_command (SIM_DESC sd, const char *text, const char *word)
+{
+ return NULL;
+}
void
sim_do_command (sd, cmd)
}
SIM_RC
-sim_load (SIM_DESC sd, char *prog, struct bfd *abfd, int from_tty)
+sim_load (SIM_DESC sd, const char *prog, struct bfd *abfd, int from_tty)
{
extern bfd *sim_load_file (); /* ??? Don't know where this should live. */