From 61a0c964e611eaf72489c3049ba206b2f91ea4a9 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 15 Jun 2015 21:09:21 +0545 Subject: sim: syscall: unify memory helpers Almost every port implements these two callbacks in the same way, so unify them in the common layer. --- sim/mn10300/ChangeLog | 8 ++++++++ sim/mn10300/mn10300_sim.h | 10 ---------- sim/mn10300/op_utils.c | 28 ++++------------------------ 3 files changed, 12 insertions(+), 34 deletions(-) (limited to 'sim/mn10300') 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 + + * 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 * 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; -- cgit v1.1