aboutsummaryrefslogtreecommitdiff
path: root/sim/rl78/load.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2015-03-20 10:29:46 +0000
committerNick Clifton <nickc@redhat.com>2015-03-20 10:30:53 +0000
commit4819f490bd2bc88bccf636755abf3d50b7f3850f (patch)
tree824a00d02e0deefc4732e0f661df8259a4c6f669 /sim/rl78/load.c
parente8ffc436d9d849eed52af64568d9f37aeaddbd9e (diff)
downloadgdb-4819f490bd2bc88bccf636755abf3d50b7f3850f.zip
gdb-4819f490bd2bc88bccf636755abf3d50b7f3850f.tar.gz
gdb-4819f490bd2bc88bccf636755abf3d50b7f3850f.tar.bz2
Fixes implementation of hardware multiply/divide peripheral in RL78 G13 cores.
* load.c (rl78_load): If the G10, G13 or G14 flag bits are set in the ELF header use them to select the proper emulation mode. * mem.c (mem_put_byte): Use mem_put_hi to store a value into the MDB register. (mem_get_byte): Use mem_get_hi to extract a value from the MDB register.
Diffstat (limited to 'sim/rl78/load.c')
-rw-r--r--sim/rl78/load.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/sim/rl78/load.c b/sim/rl78/load.c
index fcbe1ae..8d3a138 100644
--- a/sim/rl78/load.c
+++ b/sim/rl78/load.c
@@ -27,6 +27,8 @@
#include "libiberty.h"
#include "bfd.h"
+#include "elf-bfd.h"
+#include "elf/rl78.h"
#include "libbfd.h"
#include "cpu.h"
#include "mem.h"
@@ -89,7 +91,17 @@ rl78_load (bfd *prog, host_callback *callbacks, const char * const simname)
fprintf (stderr, "%s: Failed to read program headers\n", 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_G14:
+ default:
+ break;
+ }
+
for (i = 0; i < num_headers; i++)
{
Elf_Internal_Phdr * p = phdrs + i;