aboutsummaryrefslogtreecommitdiff
path: root/sim/common
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2022-10-26 21:53:30 +0545
committerMike Frysinger <vapier@gentoo.org>2022-10-31 21:24:39 +0545
commit5b94c3808140206d3b5204a3780f294d590cc458 (patch)
tree4b5bea9bdc30a6ab503bd3d1c289b5e6f20af836 /sim/common
parentf2462532e24ebfc137598d73ee6541948121f040 (diff)
downloadgdb-5b94c3808140206d3b5204a3780f294d590cc458.zip
gdb-5b94c3808140206d3b5204a3780f294d590cc458.tar.gz
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/common')
-rw-r--r--sim/common/sim-hrw.c8
-rw-r--r--sim/common/sim-utils.h2
2 files changed, 5 insertions, 5 deletions
diff --git a/sim/common/sim-hrw.c b/sim/common/sim-hrw.c
index 01a4f21..2596019 100644
--- a/sim/common/sim-hrw.c
+++ b/sim/common/sim-hrw.c
@@ -27,17 +27,17 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
modeling real hardware */
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)
{
SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
return sim_core_read_buffer (sd, NULL, read_map,
- buf, mem, length);
+ buffer, mem, 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)
{
SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
return sim_core_write_buffer (sd, NULL, write_map,
- buf, mem, length);
+ buffer, mem, length);
}
diff --git a/sim/common/sim-utils.h b/sim/common/sim-utils.h
index c111854..cd8aca9 100644
--- a/sim/common/sim-utils.h
+++ b/sim/common/sim-utils.h
@@ -64,7 +64,7 @@ SIM_RC sim_analyze_program (SIM_DESC sd, const char *prog_name,
typedef struct host_callback_struct host_callback;
typedef int sim_write_fn (SIM_DESC sd, SIM_ADDR mem,
- const unsigned char *buf, int length);
+ const void *buf, int length);
struct bfd *sim_load_file (SIM_DESC sd, const char *myname,
host_callback *callback, const char *prog,
struct bfd *prog_bfd, int verbose_p,