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/lm32 | |
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/lm32')
-rw-r--r-- | sim/lm32/ChangeLog | 7 | ||||
-rw-r--r-- | sim/lm32/traps.c | 29 |
2 files changed, 10 insertions, 26 deletions
diff --git a/sim/lm32/ChangeLog b/sim/lm32/ChangeLog index dd95d6a..4cee5da 100644 --- a/sim/lm32/ChangeLog +++ b/sim/lm32/ChangeLog @@ -1,3 +1,10 @@ +2015-06-17 Mike Frysinger <vapier@gentoo.org> + + * traps.c: Include sim-syscall.h. + (syscall_read_mem, syscall_write_mem): Delete. + (lm32bf_scall_insn): Change syscall_read_mem/syscall_write_mem + to sim_syscall_read_mem/sim_syscall_write_mem. + 2015-06-12 Mike Frysinger <vapier@gentoo.org> * configure: Regenerate. diff --git a/sim/lm32/traps.c b/sim/lm32/traps.c index 777e7b5..810ddf7 100644 --- a/sim/lm32/traps.c +++ b/sim/lm32/traps.c @@ -22,33 +22,10 @@ #define WANT_CPU_LM32BF #include "sim-main.h" +#include "sim-syscall.h" #include "lm32-sim.h" #include "targ-vals.h" -/* Read memory function 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; - - return sim_core_read_buffer (sd, cpu, read_map, buf, taddr, bytes); -} - -/* Write memory function for system call interface. */ - -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; - - return sim_core_write_buffer (sd, cpu, write_map, buf, taddr, bytes); -} - /* Handle invalid instructions. */ SEM_PC @@ -159,8 +136,8 @@ lm32bf_scall_insn (SIM_CPU * current_cpu, IADDR pc) CB_SYSCALL_INIT (&s); s.p1 = (PTR) sd; s.p2 = (PTR) current_cpu; - s.read_mem = syscall_read_mem; - s.write_mem = syscall_write_mem; + s.read_mem = sim_syscall_read_mem; + s.write_mem = sim_syscall_write_mem; /* Extract parameters. */ s.func = GET_H_GR (8); s.arg1 = GET_H_GR (1); |