aboutsummaryrefslogtreecommitdiff
path: root/sim/bfin
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2015-06-15 21:09:21 +0545
committerMike Frysinger <vapier@gentoo.org>2015-06-17 13:19:51 -0400
commit61a0c964e611eaf72489c3049ba206b2f91ea4a9 (patch)
tree386585a4f8d371d56225e968649dba301ec27801 /sim/bfin
parent6362a3f8757bfce133b724df2077573433823ad4 (diff)
downloadbinutils-61a0c964e611eaf72489c3049ba206b2f91ea4a9.zip
binutils-61a0c964e611eaf72489c3049ba206b2f91ea4a9.tar.gz
binutils-61a0c964e611eaf72489c3049ba206b2f91ea4a9.tar.bz2
sim: syscall: unify memory helpers
Almost every port implements these two callbacks in the same way, so unify them in the common layer.
Diffstat (limited to 'sim/bfin')
-rw-r--r--sim/bfin/ChangeLog7
-rw-r--r--sim/bfin/interp.c31
2 files changed, 10 insertions, 28 deletions
diff --git a/sim/bfin/ChangeLog b/sim/bfin/ChangeLog
index eac7b33..d9d8403 100644
--- a/sim/bfin/ChangeLog
+++ b/sim/bfin/ChangeLog
@@ -1,5 +1,12 @@
2015-06-17 Mike Frysinger <vapier@gentoo.org>
+ * interp.c: Include sim-syscall.h.
+ (syscall_read_mem, syscall_write_mem): Delete.
+ (bfin_syscall): Change syscall_read_mem/syscall_write_mem to
+ sim_syscall_read_mem/sim_syscall_write_mem.
+
+2015-06-17 Mike Frysinger <vapier@gentoo.org>
+
* linux-targ-map.h: Update example comments.
(cb_linux_syscall_map): Fill out name field.
(cb_linux_errno_map, cb_linux_open_map, cb_linux_signal_map):
diff --git a/sim/bfin/interp.c b/sim/bfin/interp.c
index 69b5e96..07030da 100644
--- a/sim/bfin/interp.c
+++ b/sim/bfin/interp.c
@@ -32,6 +32,7 @@
#include "gdb/callback.h"
#include "gdb/signals.h"
#include "sim-main.h"
+#include "sim-syscall.h"
#include "sim-hw.h"
#include "targ-vals.h"
@@ -125,32 +126,6 @@ count_argc (const char * const *argv)
return i;
}
-/* Read/write functions for system call interface. */
-
-static int
-syscall_read_mem (host_callback *cb, struct cb_syscall *sc,
- unsigned long taddr, char *buf, int bytes)
-{
- SIM_DESC sd = (SIM_DESC) sc->p1;
- SIM_CPU *cpu = (SIM_CPU *) sc->p2;
-
- TRACE_CORE (cpu, "DBUS FETCH (syscall) %i bytes @ 0x%08lx", bytes, taddr);
-
- return sim_core_read_buffer (sd, cpu, read_map, buf, taddr, bytes);
-}
-
-static int
-syscall_write_mem (host_callback *cb, struct cb_syscall *sc,
- unsigned long taddr, const char *buf, int bytes)
-{
- SIM_DESC sd = (SIM_DESC) sc->p1;
- SIM_CPU *cpu = (SIM_CPU *) sc->p2;
-
- TRACE_CORE (cpu, "DBUS STORE (syscall) %i bytes @ 0x%08lx", bytes, taddr);
-
- return sim_core_write_buffer (sd, cpu, write_map, buf, taddr, bytes);
-}
-
/* Simulate a monitor trap, put the result into r0 and errno into r1
return offset by which to adjust pc. */
@@ -192,8 +167,8 @@ bfin_syscall (SIM_CPU *cpu)
}
sc.p1 = (PTR) sd;
sc.p2 = (PTR) cpu;
- sc.read_mem = syscall_read_mem;
- sc.write_mem = syscall_write_mem;
+ sc.read_mem = sim_syscall_read_mem;
+ sc.write_mem = sim_syscall_write_mem;
/* Common cb_syscall() handles most functions. */
switch (cb_target_to_host_syscall (cb, sc.func))