#ifndef SIM_SIM_H
#define SIM_SIM_H 1
+#include <stdint.h>
+
#ifdef __cplusplus
extern "C" {
#endif
at virtual address MEM and store in BUF. Result is number of bytes
read, or zero if error. */
-int sim_read (SIM_DESC sd, SIM_ADDR mem, void *buf, int length);
+uint64_t sim_read (SIM_DESC sd, uint64_t mem, void *buf, uint64_t length);
/* Store LENGTH bytes from BUF into the simulated program's
memory. Store bytes starting at virtual address MEM. Result is
number of bytes write, or zero if error. */
-int sim_write (SIM_DESC sd, SIM_ADDR mem, const void *buf, int length);
+uint64_t sim_write (SIM_DESC sd, uint64_t mem, const void *buf, uint64_t length);
/* Fetch register REGNO storing its raw (target endian) value in the
}
}
-int
+uint64_t
sim_write (SIM_DESC sd ATTRIBUTE_UNUSED,
- SIM_ADDR addr,
+ uint64_t addr,
const void * buffer,
- int size)
+ uint64_t size)
{
- int i;
+ uint64_t i;
const unsigned char * data = buffer;
init ();
return size;
}
-int
+uint64_t
sim_read (SIM_DESC sd ATTRIBUTE_UNUSED,
- SIM_ADDR addr,
+ uint64_t addr,
void * buffer,
- int size)
+ uint64_t size)
{
- int i;
+ uint64_t i;
unsigned char * data = buffer;
init ();
}
}
-int
-sim_write (SIM_DESC sd, SIM_ADDR addr, const void *buffer, int size)
+uint64_t
+sim_write (SIM_DESC sd, uint64_t addr, const void *buffer, uint64_t size)
{
int osize = size;
return 0;
}
-int
-sim_read (SIM_DESC sd, SIM_ADDR addr, void *buffer, int size)
+uint64_t
+sim_read (SIM_DESC sd, uint64_t addr, void *buffer, uint64_t size)
{
int osize = size;
/* Generic implementation of sim_read that works with simulators
modeling real hardware */
-int
-sim_read (SIM_DESC sd, SIM_ADDR mem, void *buffer, int length)
+uint64_t
+sim_read (SIM_DESC sd, uint64_t mem, void *buffer, uint64_t length)
{
SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
return sim_core_read_buffer (sd, NULL, read_map,
buffer, mem, length);
}
-int
-sim_write (SIM_DESC sd, SIM_ADDR mem, const void *buffer, int length)
+uint64_t
+sim_write (SIM_DESC sd, uint64_t mem, const void *buffer, uint64_t length)
{
SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
return sim_core_write_buffer (sd, NULL, write_map,
This is still accommodated for backward compatibility reasons. */
typedef struct host_callback_struct host_callback;
-typedef int sim_write_fn (SIM_DESC sd, SIM_ADDR mem,
- const void *buf, int length);
+typedef uint64_t sim_write_fn (SIM_DESC sd, uint64_t mem,
+ const void *buf, uint64_t 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,
/* Helper for cris_handle_interpreter: like sim_write, but load at
interp_load_addr offset. */
-static int
-cris_write_interp (SIM_DESC sd, SIM_ADDR mem, const void *buf, int length)
+static uint64_t
+cris_write_interp (SIM_DESC sd, uint64_t mem, const void *buf, uint64_t length)
{
return sim_write (sd, mem + interp_load_addr, buf, length);
}
static int
xfer_mem (SIM_DESC sd,
- SIM_ADDR virt,
+ address_word virt,
unsigned char *buffer,
- int size,
+ uint64_t size,
int write_p)
{
uint8_t *memory;
}
-int
-sim_write (SIM_DESC sd, SIM_ADDR addr, const void *buffer, int size)
+uint64_t
+sim_write (SIM_DESC sd, uint64_t addr, const void *buffer, uint64_t size)
{
/* FIXME: this should be performing a virtual transfer */
/* FIXME: We cast the const away, but it's safe because xfer_mem only reads
return xfer_mem (sd, addr, (void *) buffer, size, 1);
}
-int
-sim_read (SIM_DESC sd, SIM_ADDR addr, void *buffer, int size)
+uint64_t
+sim_read (SIM_DESC sd, uint64_t addr, void *buffer, uint64_t size)
{
/* FIXME: this should be performing a virtual transfer */
return xfer_mem (sd, addr, buffer, size, 0);
return -1;
}
-int
-sim_write (SIM_DESC sd, SIM_ADDR mem, const void *buffer, int length)
+uint64_t
+sim_write (SIM_DESC sd, uint64_t mem, const void *buffer, uint64_t length)
{
int i, len;
const unsigned char *data = buffer;
return length;
}
-int
-sim_read (SIM_DESC sd, SIM_ADDR mem, void *buffer, int length)
+uint64_t
+sim_read (SIM_DESC sd, uint64_t mem, void *buffer, uint64_t length)
{
int i, len;
unsigned char *data = buffer;
}
}
-int
-sim_write (SIM_DESC sd, SIM_ADDR addr, const void *buffer, int size)
+uint64_t
+sim_write (SIM_DESC sd, uint64_t addr, const void *buffer, uint64_t size)
{
sim_cpu *cpu = STATE_CPU (sd, 0);
int i;
return i;
}
-int
-sim_read (SIM_DESC sd, SIM_ADDR addr, void *buffer, int size)
+uint64_t
+sim_read (SIM_DESC sd, uint64_t addr, void *buffer, uint64_t size)
{
sim_cpu *cpu = STATE_CPU (sd, 0);
return SIM_RC_OK;
}
-int
-sim_read (SIM_DESC sd, SIM_ADDR mem, void *buf, int length)
+uint64_t
+sim_read (SIM_DESC sd, uint64_t mem, void *buf, uint64_t length)
{
check_desc (sd);
return length;
}
-int
-sim_write (SIM_DESC sd, SIM_ADDR mem, const void *buf, int length)
+uint64_t
+sim_write (SIM_DESC sd, uint64_t mem, const void *buf, uint64_t length)
{
check_desc (sd);
}
-int
-sim_read (SIM_DESC sd, SIM_ADDR mem, void *buf, int length)
+uint64_t
+sim_read (SIM_DESC sd, uint64_t mem, void *buf, uint64_t length)
{
int result = psim_read_memory(simulator, MAX_NR_PROCESSORS,
buf, mem, length);
- TRACE(trace_gdb, ("sim_read(mem=0x%lx, buf=%p, length=%d) = %d\n",
- (long)mem, buf, length, result));
+ TRACE(trace_gdb,
+ ("sim_read(mem=0x%" PRIx64 ", buf=%p, length=%" PRIx64 ") = %d\n",
+ mem, buf, length, result));
return result;
}
-int
-sim_write (SIM_DESC sd, SIM_ADDR mem, const void *buf, int length)
+uint64_t
+sim_write (SIM_DESC sd, uint64_t mem, const void *buf, uint64_t length)
{
int result = psim_write_memory(simulator, MAX_NR_PROCESSORS,
buf, mem, length,
1/*violate_ro*/);
- TRACE(trace_gdb, ("sim_write(mem=0x%lx, buf=%p, length=%d) = %d\n",
- (long)mem, buf, length, result));
+ TRACE(trace_gdb,
+ ("sim_write(mem=0x%" PRIx64 ", buf=%p, length=%" PRIx64 ") = %d\n",
+ mem, buf, length, result));
return result;
}
/* Read memory. */
-int
-sim_read (SIM_DESC sd, SIM_ADDR mem, void *buf, int length)
+uint64_t
+sim_read (SIM_DESC sd, uint64_t mem, void *buf, uint64_t length)
{
check_desc (sd);
/* Write memory. */
-int
-sim_write (SIM_DESC sd, SIM_ADDR mem, const void *buf, int length)
+uint64_t
+sim_write (SIM_DESC sd, uint64_t mem, const void *buf, uint64_t length)
{
check_desc (sd);
return SIM_RC_OK;
}
-int
-sim_read (SIM_DESC sd, SIM_ADDR mem, void *buffer, int length)
+uint64_t
+sim_read (SIM_DESC sd, uint64_t mem, void *buffer, uint64_t length)
{
int i;
unsigned char *data = buffer;
return length;
}
-int
-sim_write (SIM_DESC sd, SIM_ADDR mem, const void *buffer, int length)
+uint64_t
+sim_write (SIM_DESC sd, uint64_t mem, const void *buffer, uint64_t length)
{
int i;
const unsigned char *data = buffer;
signal (SIGFPE, prev_fpe);
}
-int
-sim_write (SIM_DESC sd, SIM_ADDR addr, const void *buffer, int size)
+uint64_t
+sim_write (SIM_DESC sd, uint64_t addr, const void *buffer, uint64_t size)
{
int i;
const unsigned char *data = buffer;
return size;
}
-int
-sim_read (SIM_DESC sd, SIM_ADDR addr, void *buffer, int size)
+uint64_t
+sim_read (SIM_DESC sd, uint64_t addr, void *buffer, uint64_t size)
{
int i;
unsigned char *data = buffer;