/* Main simulator entry points specific to the CRIS.
- Copyright (C) 2004-2016 Free Software Foundation, Inc.
+ Copyright (C) 2004-2019 Free Software Foundation, Inc.
Contributed by Axis Communications.
This file is part of the GNU simulators.
enum cris_unknown_syscall_action_type cris_unknown_syscall_action
= CRIS_USYSC_MSG_STOP;
-/* Records simulator descriptor so utilities like cris_dump_regs can be
- called from gdb. */
-SIM_DESC current_state;
-
/* CRIS-specific options. */
typedef enum {
OPTION_CRIS_STATS = OPTION_START,
return sim_profile_set_option (sd, "-model", PROFILE_MODEL_IDX, "on");
}
-/* FIXME: Remove these, globalize those in sim-load.c, move elsewhere. */
-
-static void
-xprintf (host_callback *callback, const char *fmt, ...)
-{
- va_list ap;
-
- va_start (ap, fmt);
-
- (*callback->vprintf_filtered) (callback, fmt, ap);
-
- va_end (ap);
-}
-
-static void
-eprintf (host_callback *callback, const char *fmt, ...)
-{
- va_list ap;
-
- va_start (ap, fmt);
-
- (*callback->evprintf_filtered) (callback, fmt, ap);
-
- va_end (ap);
-}
-
/* An ELF-specific simplified ../common/sim-load.c:sim_load_file,
using the program headers, not sections, in order to make sure that
the program headers themeselves are also loaded. The caller is
int n_hdrs;
int i;
bfd_boolean verbose = STATE_OPEN_KIND (sd) == SIM_OPEN_DEBUG;
- host_callback *callback = STATE_CALLBACK (sd);
phdr = elf_tdata (abfd)->phdr;
n_hdrs = elf_elfheader (abfd)->e_phnum;
buf = xmalloc (phdr[i].p_filesz);
if (verbose)
- xprintf (callback, "Loading segment at 0x%lx, size 0x%lx\n",
- lma, phdr[i].p_filesz);
+ sim_io_printf (sd, "Loading segment at 0x%lx, size 0x%lx\n",
+ lma, phdr[i].p_filesz);
if (bfd_seek (abfd, phdr[i].p_offset, SEEK_SET) != 0
|| (bfd_bread (buf, phdr[i].p_filesz, abfd) != phdr[i].p_filesz))
{
- eprintf (callback,
- "%s: could not read segment at 0x%lx, size 0x%lx\n",
- STATE_MY_NAME (sd), lma, phdr[i].p_filesz);
+ sim_io_eprintf (sd,
+ "%s: could not read segment at 0x%lx, size 0x%lx\n",
+ STATE_MY_NAME (sd), lma, phdr[i].p_filesz);
free (buf);
return FALSE;
}
if (do_write (sd, lma, buf, phdr[i].p_filesz) != phdr[i].p_filesz)
{
- eprintf (callback,
- "%s: could not load segment at 0x%lx, size 0x%lx\n",
- STATE_MY_NAME (sd), lma, phdr[i].p_filesz);
+ sim_io_eprintf (sd,
+ "%s: could not load segment at 0x%lx, size 0x%lx\n",
+ STATE_MY_NAME (sd), lma, phdr[i].p_filesz);
free (buf);
return FALSE;
}
SIM_DESC
sim_open (SIM_OPEN_KIND kind, host_callback *callback, struct bfd *abfd,
- char **argv)
+ char * const *argv)
{
char c;
int i;
return 0;
}
- /* getopt will print the error message so we just have to exit if this fails.
- FIXME: Hmmm... in the case of gdb we need getopt to call
- print_filtered. */
+ /* The parser will print an error message for us, so we silently return. */
if (sim_parse_args (sd, argv) != SIM_RC_OK)
{
free_state (sd);
/* Note that the linux kernel does not correctly compute the storage
needs for the static-exe AUX vector. */
- csp -= sizeof (auxv_entries) / sizeof (auxv_entries[0]) * 4 * 2;
+ csp -= ARRAY_SIZE (auxv_entries) * 4 * 2;
csp -= (envc + 1) * 4;
csp -= (my_argc + 1) * 4;
goto abandon_chip;
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
- for (i = 0; i < sizeof (auxv_entries) / sizeof (auxv_entries[0]); i++)
+ for (i = 0; i < ARRAY_SIZE (auxv_entries); i++)
{
write_dword (csp, auxv_entries[i].id);
write_dword (csp + 4,
Must be done after cris_cgen_cpu_open. */
cgen_init (sd);
- /* Store in a global so things like cris_dump_regs can be invoked
- from the gdb command line. */
- current_state = sd;
-
cris_set_callbacks (callback);
return sd;
\f
SIM_RC
sim_create_inferior (SIM_DESC sd, struct bfd *abfd,
- char **argv ATTRIBUTE_UNUSED,
- char **envp ATTRIBUTE_UNUSED)
+ char * const *argv ATTRIBUTE_UNUSED,
+ char * const *envp ATTRIBUTE_UNUSED)
{
SIM_CPU *current_cpu = STATE_CPU (sd, 0);
SIM_ADDR addr;