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/op_utils.c | |
parent | 6362a3f8757bfce133b724df2077573433823ad4 (diff) | |
download | gdb-61a0c964e611eaf72489c3049ba206b2f91ea4a9.zip gdb-61a0c964e611eaf72489c3049ba206b2f91ea4a9.tar.gz 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/op_utils.c')
-rw-r--r-- | sim/mn10300/op_utils.c | 28 |
1 files changed, 4 insertions, 24 deletions
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; |