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/cris | |
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/cris')
-rw-r--r-- | sim/cris/ChangeLog | 7 | ||||
-rw-r--r-- | sim/cris/traps.c | 33 |
2 files changed, 10 insertions, 30 deletions
diff --git a/sim/cris/ChangeLog b/sim/cris/ChangeLog index e3a1731..c4b94ec 100644 --- a/sim/cris/ChangeLog +++ b/sim/cris/ChangeLog @@ -1,5 +1,12 @@ 2015-06-17 Mike Frysinger <vapier@gentoo.org> + * traps.c: Include sim-syscall.h. + (syscall_read_mem, syscall_write_mem): Delete. + (cris_break_13_handler): Change syscall_read_mem/syscall_write_mem + to sim_syscall_read_mem/sim_syscall_write_mem. + +2015-06-17 Mike Frysinger <vapier@gentoo.org> + * traps.c (syscall_map): Fill out name field. (syscall_stat32_map, errno_map, open_map): Likewise. diff --git a/sim/cris/traps.c b/sim/cris/traps.c index 888f808..3d22b4d 100644 --- a/sim/cris/traps.c +++ b/sim/cris/traps.c @@ -18,6 +18,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "sim-main.h" +#include "sim-syscall.h" #include "sim-options.h" #include "bfd.h" /* FIXME: get rid of targ-vals.h usage everywhere else. */ @@ -763,10 +764,6 @@ static const CB_TARGET_DEFS_MAP open_map[] = { /* Needed for the cris_pipe_nonempty and cris_pipe_empty syscalls. */ static SIM_CPU *current_cpu_for_cb_callback; -static int syscall_read_mem (host_callback *, struct cb_syscall *, - unsigned long, char *, int); -static int syscall_write_mem (host_callback *, struct cb_syscall *, - unsigned long, const char *, int); static USI create_map (SIM_DESC, struct cris_sim_mmapped_page **, USI addr, USI len); static USI unmap_pages (SIM_DESC, struct cris_sim_mmapped_page **, @@ -776,30 +773,6 @@ static USI is_mapped (SIM_DESC, struct cris_sim_mmapped_page **, static void dump_statistics (SIM_CPU *current_cpu); static void make_first_thread (SIM_CPU *current_cpu); -/* Read/write functions for system call interface. */ - -static int -syscall_read_mem (host_callback *cb ATTRIBUTE_UNUSED, - 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); -} - -static int -syscall_write_mem (host_callback *cb ATTRIBUTE_UNUSED, - 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); -} - /* When we risk running self-modified code (as in trampolines), this is called from special-case insns. The silicon CRIS CPU:s have enough cache snooping implemented making this a simulator-only issue. Tests: @@ -1496,8 +1469,8 @@ cris_break_13_handler (SIM_CPU *current_cpu, USI callnum, USI arg1, 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; current_cpu_for_cb_callback = current_cpu; |