From 5b94c3808140206d3b5204a3780f294d590cc458 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Wed, 26 Oct 2022 21:53:30 +0545 Subject: 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. --- sim/rx/gdb-if.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'sim/rx') diff --git a/sim/rx/gdb-if.c b/sim/rx/gdb-if.c index ccc81c9..c116bdc 100644 --- a/sim/rx/gdb-if.c +++ b/sim/rx/gdb-if.c @@ -226,9 +226,10 @@ sim_create_inferior (SIM_DESC sd, struct bfd *abfd, } int -sim_read (SIM_DESC sd, SIM_ADDR mem, unsigned char *buf, int length) +sim_read (SIM_DESC sd, SIM_ADDR mem, void *buffer, int length) { int i; + unsigned char *data = buffer; check_desc (sd); @@ -241,7 +242,7 @@ sim_read (SIM_DESC sd, SIM_ADDR mem, unsigned char *buf, int length) { bfd_vma addr = mem + i; int do_swap = addr_in_swap_list (addr); - buf[i] = mem_get_qi (addr ^ (do_swap ? 3 : 0)); + data[i] = mem_get_qi (addr ^ (do_swap ? 3 : 0)); if (execution_error_get_last_error () != SIM_ERR_NONE) return i; @@ -251,9 +252,10 @@ sim_read (SIM_DESC sd, SIM_ADDR mem, unsigned char *buf, int length) } int -sim_write (SIM_DESC sd, SIM_ADDR mem, const unsigned char *buf, int length) +sim_write (SIM_DESC sd, SIM_ADDR mem, const void *buffer, int length) { int i; + const unsigned char *data = buffer; check_desc (sd); @@ -263,7 +265,7 @@ sim_write (SIM_DESC sd, SIM_ADDR mem, const unsigned char *buf, int length) { bfd_vma addr = mem + i; int do_swap = addr_in_swap_list (addr); - mem_put_qi (addr ^ (do_swap ? 3 : 0), buf[i]); + mem_put_qi (addr ^ (do_swap ? 3 : 0), data[i]); if (execution_error_get_last_error () != SIM_ERR_NONE) return i; -- cgit v1.1