sim: cris: use standard output helpers

The sim-io module provides output helpers, so no need to define local
ones anymore.
This commit is contained in:
Mike Frysinger
2016-01-02 11:11:09 -05:00
parent 027e73b217
commit b3fbb288af
2 changed files with 14 additions and 35 deletions

View File

@ -1,3 +1,9 @@
2016-01-02 Mike Frysinger <vapier@gentoo.org>
* sim-if.c (xprintf, eprintf): Delete.
(cris_load_elf_file): Delete callback. Change xprintf to
sim_io_printf and eprintf to sim_io_eprintf.
2016-01-02 Mike Frysinger <vapier@gentoo.org> 2016-01-02 Mike Frysinger <vapier@gentoo.org>
* sim-if.c (current_state): Delete. * sim-if.c (current_state): Delete.

View File

@ -229,32 +229,6 @@ cris_option_handler (SIM_DESC sd, sim_cpu *cpu ATTRIBUTE_UNUSED, int opt,
return sim_profile_set_option (sd, "-model", PROFILE_MODEL_IDX, "on"); 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, /* An ELF-specific simplified ../common/sim-load.c:sim_load_file,
using the program headers, not sections, in order to make sure that using the program headers, not sections, in order to make sure that
the program headers themeselves are also loaded. The caller is the program headers themeselves are also loaded. The caller is
@ -267,7 +241,6 @@ cris_load_elf_file (SIM_DESC sd, struct bfd *abfd, sim_write_fn do_write)
int n_hdrs; int n_hdrs;
int i; int i;
bfd_boolean verbose = STATE_OPEN_KIND (sd) == SIM_OPEN_DEBUG; bfd_boolean verbose = STATE_OPEN_KIND (sd) == SIM_OPEN_DEBUG;
host_callback *callback = STATE_CALLBACK (sd);
phdr = elf_tdata (abfd)->phdr; phdr = elf_tdata (abfd)->phdr;
n_hdrs = elf_elfheader (abfd)->e_phnum; n_hdrs = elf_elfheader (abfd)->e_phnum;
@ -286,24 +259,24 @@ cris_load_elf_file (SIM_DESC sd, struct bfd *abfd, sim_write_fn do_write)
buf = xmalloc (phdr[i].p_filesz); buf = xmalloc (phdr[i].p_filesz);
if (verbose) if (verbose)
xprintf (callback, "Loading segment at 0x%lx, size 0x%lx\n", sim_io_printf (sd, "Loading segment at 0x%lx, size 0x%lx\n",
lma, phdr[i].p_filesz); lma, phdr[i].p_filesz);
if (bfd_seek (abfd, phdr[i].p_offset, SEEK_SET) != 0 if (bfd_seek (abfd, phdr[i].p_offset, SEEK_SET) != 0
|| (bfd_bread (buf, phdr[i].p_filesz, abfd) != phdr[i].p_filesz)) || (bfd_bread (buf, phdr[i].p_filesz, abfd) != phdr[i].p_filesz))
{ {
eprintf (callback, sim_io_eprintf (sd,
"%s: could not read segment at 0x%lx, size 0x%lx\n", "%s: could not read segment at 0x%lx, size 0x%lx\n",
STATE_MY_NAME (sd), lma, phdr[i].p_filesz); STATE_MY_NAME (sd), lma, phdr[i].p_filesz);
free (buf); free (buf);
return FALSE; return FALSE;
} }
if (do_write (sd, lma, buf, phdr[i].p_filesz) != phdr[i].p_filesz) if (do_write (sd, lma, buf, phdr[i].p_filesz) != phdr[i].p_filesz)
{ {
eprintf (callback, sim_io_eprintf (sd,
"%s: could not load segment at 0x%lx, size 0x%lx\n", "%s: could not load segment at 0x%lx, size 0x%lx\n",
STATE_MY_NAME (sd), lma, phdr[i].p_filesz); STATE_MY_NAME (sd), lma, phdr[i].p_filesz);
free (buf); free (buf);
return FALSE; return FALSE;
} }