diff options
author | Mike Frysinger <vapier@gentoo.org> | 2022-10-26 21:53:30 +0545 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2022-10-31 21:24:39 +0545 |
commit | 5b94c3808140206d3b5204a3780f294d590cc458 (patch) | |
tree | 4b5bea9bdc30a6ab503bd3d1c289b5e6f20af836 /sim/sh/interp.c | |
parent | f2462532e24ebfc137598d73ee6541948121f040 (diff) | |
download | fsf-binutils-gdb-5b94c3808140206d3b5204a3780f294d590cc458.zip fsf-binutils-gdb-5b94c3808140206d3b5204a3780f294d590cc458.tar.gz fsf-binutils-gdb-5b94c3808140206d3b5204a3780f294d590cc458.tar.bz2 |
sim: common: change sim_read & sim_write to use void* buffers
When reading/writing arbitrary data to the system's memory, the unsigned
char pointer type doesn't make that much sense. Switch it to void so we
align a bit with standard C library read/write functions, and to avoid
having to sprinkle casts everywhere.
Diffstat (limited to 'sim/sh/interp.c')
-rw-r--r-- | sim/sh/interp.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/sim/sh/interp.c b/sim/sh/interp.c index b6f2988..6a33cce 100644 --- a/sim/sh/interp.c +++ b/sim/sh/interp.c @@ -1049,7 +1049,7 @@ trap (SIM_DESC sd, int i, int *regs, unsigned char *insn_ptr, { /* Include the termination byte. */ int i = strlen (prog_argv[regs[5]]) + 1; - regs[0] = sim_write (0, regs[6], (void *) prog_argv[regs[5]], i); + regs[0] = sim_write (0, regs[6], prog_argv[regs[5]], i); } else regs[0] = -1; @@ -1874,29 +1874,31 @@ sim_resume (SIM_DESC sd, int step, int siggnal) } int -sim_write (SIM_DESC sd, SIM_ADDR addr, const unsigned char *buffer, int size) +sim_write (SIM_DESC sd, SIM_ADDR addr, const void *buffer, int size) { int i; + const unsigned char *data = buffer; init_pointers (); for (i = 0; i < size; i++) { - saved_state.asregs.memory[(MMASKB & (addr + i)) ^ endianb] = buffer[i]; + saved_state.asregs.memory[(MMASKB & (addr + i)) ^ endianb] = data[i]; } return size; } int -sim_read (SIM_DESC sd, SIM_ADDR addr, unsigned char *buffer, int size) +sim_read (SIM_DESC sd, SIM_ADDR addr, void *buffer, int size) { int i; + unsigned char *data = buffer; init_pointers (); for (i = 0; i < size; i++) { - buffer[i] = saved_state.asregs.memory[(MMASKB & (addr + i)) ^ endianb]; + data[i] = saved_state.asregs.memory[(MMASKB & (addr + i)) ^ endianb]; } return size; } |