aboutsummaryrefslogtreecommitdiff
path: root/sim/erc32/erc32.c
diff options
context:
space:
mode:
authorOrgad Shaneh <orgads@gmail.com>2021-10-29 06:42:15 +0000
committerMike Frysinger <vapier@gentoo.org>2021-10-31 04:11:38 -0400
commit4ab6404b1c5798155640edf4bb207c8d1de37b5d (patch)
treeb8eea26be95ff413f199ba86630d2368adff9669 /sim/erc32/erc32.c
parent65dcce8f793757be996377b5a15453b4bdf5f87b (diff)
downloadgdb-4ab6404b1c5798155640edf4bb207c8d1de37b5d.zip
gdb-4ab6404b1c5798155640edf4bb207c8d1de37b5d.tar.gz
gdb-4ab6404b1c5798155640edf4bb207c8d1de37b5d.tar.bz2
sim: erc32: fix signedness compatibility and redefinition warnings
Diffstat (limited to 'sim/erc32/erc32.c')
-rw-r--r--sim/erc32/erc32.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/sim/erc32/erc32.c b/sim/erc32/erc32.c
index e7a816f..68136e4 100644
--- a/sim/erc32/erc32.c
+++ b/sim/erc32/erc32.c
@@ -292,8 +292,7 @@ static uint32 gpt_counter_read (void);
static void gpt_scaler_set (uint32 val);
static void gpt_reload_set (uint32 val);
static void timer_ctrl (uint32 val);
-static unsigned char *
- get_mem_ptr (uint32 addr, uint32 size);
+static void * get_mem_ptr (uint32 addr, uint32 size);
static void store_bytes (unsigned char *mem, uint32 waddr,
uint32 *data, int sz, int32 *ws);
@@ -1541,7 +1540,7 @@ store_bytes (unsigned char *mem, uint32 waddr, uint32 *data, int32 sz,
/* Memory emulation */
int
-memory_iread (uint32 addr, uint32 *data, int32 *ws)
+memory_iread (uint32 addr, uint32 *data, uint32 *ws)
{
uint32 asi;
if ((addr >= mem_ramstart) && (addr < (mem_ramstart + mem_ramsz))) {
@@ -1566,7 +1565,7 @@ memory_iread (uint32 addr, uint32 *data, int32 *ws)
}
int
-memory_read(int32 asi, uint32 addr, uint32 *data, int32 sz, int32 *ws)
+memory_read(int32 asi, uint32 addr, void *data, int32 sz, int32 *ws)
{
int32 mexc;
@@ -1607,7 +1606,7 @@ memory_read(int32 asi, uint32 addr, uint32 *data, int32 sz, int32 *ws)
} else if ((addr >= 0x10000000) &&
(addr < (0x10000000 + (512 << (mec_iocr & 0x0f)))) &&
(mec_iocr & 0x10)) {
- *data = erareg;
+ memcpy (data, &erareg, 4);
return 0;
}
@@ -1739,7 +1738,7 @@ memory_write(int32 asi, uint32 addr, uint32 *data, int32 sz, int32 *ws)
return 1;
}
-static unsigned char *
+static void *
get_mem_ptr(uint32 addr, uint32 size)
{
if ((addr + size) < ROM_SZ) {
@@ -1755,15 +1754,15 @@ get_mem_ptr(uint32 addr, uint32 size)
}
#endif
- return (char *) -1;
+ return (void *) -1;
}
int
-sis_memory_write(uint32 addr, const unsigned char *data, uint32 length)
+sis_memory_write(uint32 addr, const void *data, uint32 length)
{
- char *mem;
+ void *mem;
- if ((mem = get_mem_ptr(addr, length)) == ((char *) -1))
+ if ((mem = get_mem_ptr(addr, length)) == ((void *) -1))
return 0;
memcpy(mem, data, length);
@@ -1771,11 +1770,11 @@ sis_memory_write(uint32 addr, const unsigned char *data, uint32 length)
}
int
-sis_memory_read(uint32 addr, char *data, uint32 length)
+sis_memory_read(uint32 addr, void *data, uint32 length)
{
char *mem;
- if ((mem = get_mem_ptr(addr, length)) == ((char *) -1))
+ if ((mem = get_mem_ptr(addr, length)) == ((void *) -1))
return 0;
memcpy(data, mem, length);