diff options
author | Mike Frysinger <vapier@gentoo.org> | 2015-06-15 21:09:21 +0545 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2015-06-17 13:19:51 -0400 |
commit | 61a0c964e611eaf72489c3049ba206b2f91ea4a9 (patch) | |
tree | 386585a4f8d371d56225e968649dba301ec27801 /sim/mn10300 | |
parent | 6362a3f8757bfce133b724df2077573433823ad4 (diff) | |
download | fsf-binutils-gdb-61a0c964e611eaf72489c3049ba206b2f91ea4a9.zip fsf-binutils-gdb-61a0c964e611eaf72489c3049ba206b2f91ea4a9.tar.gz fsf-binutils-gdb-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/mn10300')
-rw-r--r-- | sim/mn10300/ChangeLog | 8 | ||||
-rw-r--r-- | sim/mn10300/mn10300_sim.h | 10 | ||||
-rw-r--r-- | sim/mn10300/op_utils.c | 28 |
3 files changed, 12 insertions, 34 deletions
diff --git a/sim/mn10300/ChangeLog b/sim/mn10300/ChangeLog index a59869b..1965d5fd 100644 --- a/sim/mn10300/ChangeLog +++ b/sim/mn10300/ChangeLog @@ -1,3 +1,11 @@ +2015-06-17 Mike Frysinger <vapier@gentoo.org> + + * mn10300_sim.h (syscall_read_mem, syscall_write_mem): Delete. + * op_utils.c: Include sim-syscall.h. + (syscall_read_mem, syscall_write_mem): Delete. + (do_syscall): Change syscall_read_mem/syscall_write_mem + to sim_syscall_read_mem/sim_syscall_write_mem. Set syscall.p2. + 2015-06-12 Mike Frysinger <vapier@gentoo.org> * configure: Regenerate. diff --git a/sim/mn10300/mn10300_sim.h b/sim/mn10300/mn10300_sim.h index f021aee..6e8f53a 100644 --- a/sim/mn10300/mn10300_sim.h +++ b/sim/mn10300/mn10300_sim.h @@ -200,16 +200,6 @@ INLINE_SIM_MAIN (void) genericCmp (unsigned32 leftOpnd, unsigned32 rightOpnd); INLINE_SIM_MAIN (void) genericOr (unsigned32 source, unsigned32 destReg); INLINE_SIM_MAIN (void) genericXor (unsigned32 source, unsigned32 destReg); INLINE_SIM_MAIN (void) genericBtst (unsigned32 leftOpnd, unsigned32 rightOpnd); -INLINE_SIM_MAIN (int) syscall_read_mem (host_callback *cb, - struct cb_syscall *sc, - unsigned long taddr, - char *buf, - int bytes); -INLINE_SIM_MAIN (int) syscall_write_mem (host_callback *cb, - struct cb_syscall *sc, - unsigned long taddr, - const char *buf, - int bytes); INLINE_SIM_MAIN (void) do_syscall (void); void program_interrupt (SIM_DESC sd, sim_cpu *cpu, sim_cia cia, SIM_SIGNAL sig); diff --git a/sim/mn10300/op_utils.c b/sim/mn10300/op_utils.c index 316cf75..7b156f8 100644 --- a/sim/mn10300/op_utils.c +++ b/sim/mn10300/op_utils.c @@ -1,4 +1,5 @@ #include "sim-main.h" +#include "sim-syscall.h" #include "targ-vals.h" #ifdef HAVE_UTIME_H @@ -140,28 +141,6 @@ genericBtst(unsigned32 leftOpnd, unsigned32 rightOpnd) PSW |= (z ? PSW_Z : 0) | (n ? PSW_N : 0); } -/* Read/write functions for system call interface. */ -INLINE_SIM_MAIN (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 = STATE_CPU(sd, 0); - - return sim_core_read_buffer (sd, cpu, read_map, buf, taddr, bytes); -} - -INLINE_SIM_MAIN (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 = STATE_CPU(sd, 0); - - return sim_core_write_buffer (sd, cpu, write_map, buf, taddr, bytes); -} - - /* syscall */ INLINE_SIM_MAIN (void) do_syscall (void) @@ -204,8 +183,9 @@ do_syscall (void) syscall.arg3 = PARM3; syscall.func = FUNC; syscall.p1 = (PTR) simulator; - syscall.read_mem = syscall_read_mem; - syscall.write_mem = syscall_write_mem; + syscall.p2 = (PTR) STATE_CPU (simulator, 0); + syscall.read_mem = sim_syscall_read_mem; + syscall.write_mem = sim_syscall_write_mem; cb_syscall (STATE_CALLBACK (simulator), &syscall); RETERR = syscall.errcode; RETVAL = syscall.result; |