X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=sim%2Frl78%2Fload.c;h=f89b5e69c4be359087ec396a488354d5dc5c2be8;hb=3666a04883754298b03884222206bfe756fbc520;hp=8d3a13823e2c09e2169de907f7deab422d1744c5;hpb=4819f490bd2bc88bccf636755abf3d50b7f3850f;p=deliverable%2Fbinutils-gdb.git diff --git a/sim/rl78/load.c b/sim/rl78/load.c index 8d3a13823e..f89b5e69c4 100644 --- a/sim/rl78/load.c +++ b/sim/rl78/load.c @@ -1,6 +1,6 @@ /* load.c --- loading object files into the RL78 simulator. - Copyright (C) 2005-2015 Free Software Foundation, Inc. + Copyright (C) 2005-2021 Free Software Foundation, Inc. Contributed by Red Hat, Inc. This file is part of the GNU simulators. @@ -29,7 +29,6 @@ #include "bfd.h" #include "elf-bfd.h" #include "elf/rl78.h" -#include "libbfd.h" #include "cpu.h" #include "mem.h" #include "load.h" @@ -57,7 +56,7 @@ find_section_name_by_offset (bfd *abfd, file_ptr filepos) for (s = abfd->sections; s; s = s->next) if (s->filepos == filepos) - return bfd_get_section_name (abfd, s); + return bfd_section_name (s); return "(unknown)"; } @@ -92,15 +91,28 @@ rl78_load (bfd *prog, host_callback *callbacks, const char * const simname) return; } - rl78_g10_mode = 0; switch (elf_elfheader (prog)->e_flags & E_FLAG_RL78_CPU_MASK) { - case E_FLAG_RL78_G10: rl78_g10_mode = 1; break; - case E_FLAG_RL78_G13: g13_multiply = 1; break; + case E_FLAG_RL78_G10: + rl78_g10_mode = 1; + g13_multiply = 0; + g14_multiply = 0; + mem_set_mirror (0, 0xf8000, 4096); + break; + case E_FLAG_RL78_G13: + rl78_g10_mode = 0; + g13_multiply = 1; + g14_multiply = 0; + break; case E_FLAG_RL78_G14: + rl78_g10_mode = 0; + g13_multiply = 0; + g14_multiply = 1; + break; default: + /* Keep whatever was manually specified. */ break; - } + } for (i = 0; i < num_headers; i++) { @@ -127,13 +139,13 @@ rl78_load (bfd *prog, host_callback *callbacks, const char * const simname) buf = xmalloc (size); offset = p->p_offset; - if (prog->iovec->bseek (prog, offset, SEEK_SET) != 0) + if (bfd_seek (prog, offset, SEEK_SET) != 0) { fprintf (stderr, "%s, Failed to seek to offset %lx\n", simname, (long) offset); continue; } - if (prog->iovec->bread (prog, buf, size) != size) + if (bfd_bread (buf, size, prog) != size) { fprintf (stderr, "%s: Failed to read %lx bytes\n", simname, size); continue;