+2015-12-26 Mike Frysinger <vapier@gentoo.org>
+
+ * sim-core.c (sim_core_read_buffer): Move cia decl to top of func.
+ Call sim_cpu_hw_io_read_buffer if cpu is valid.
+ (sim_core_write_buffer): Move cia decl to top of func. Call
+ sim_cpu_hw_io_write_buffer if cpu is valid.
+
2015-12-25 Mike Frysinger <vapier@gentoo.org>
* hw-properties.c (hw_find_ihandle_runtime_property): Delete
int nr_bytes = len - count;
if (raddr + nr_bytes - 1> mapping->bound)
nr_bytes = mapping->bound - raddr + 1;
- if (sim_hw_io_read_buffer (sd, mapping->device,
- (unsigned_1*)buffer + count,
- mapping->space,
- raddr,
- nr_bytes) != nr_bytes)
+ /* If the access was initiated by a cpu, pass it down so errors can
+ be propagated properly. For other sources (e.g. GDB or DMA), we
+ can only signal errors via the return value. */
+ if (cpu)
+ {
+ sim_cia cia = cpu ? CPU_PC_GET (cpu) : NULL_CIA;
+ sim_cpu_hw_io_read_buffer (cpu, cia, mapping->device,
+ (unsigned_1*)buffer + count,
+ mapping->space,
+ raddr,
+ nr_bytes);
+ }
+ else if (sim_hw_io_read_buffer (sd, mapping->device,
+ (unsigned_1*)buffer + count,
+ mapping->space,
+ raddr,
+ nr_bytes) != nr_bytes)
break;
count += nr_bytes;
continue;
int nr_bytes = len - count;
if (raddr + nr_bytes - 1 > mapping->bound)
nr_bytes = mapping->bound - raddr + 1;
- if (sim_hw_io_write_buffer (sd, mapping->device,
- (unsigned_1*)buffer + count,
- mapping->space,
- raddr,
- nr_bytes) != nr_bytes)
+ /* If the access was initiated by a cpu, pass it down so errors can
+ be propagated properly. For other sources (e.g. GDB or DMA), we
+ can only signal errors via the return value. */
+ if (cpu)
+ {
+ sim_cia cia = cpu ? CPU_PC_GET (cpu) : NULL_CIA;
+ sim_cpu_hw_io_write_buffer (cpu, cia, mapping->device,
+ (unsigned_1*)buffer + count,
+ mapping->space,
+ raddr,
+ nr_bytes);
+ }
+ else if (sim_hw_io_write_buffer (sd, mapping->device,
+ (unsigned_1*)buffer + count,
+ mapping->space,
+ raddr,
+ nr_bytes) != nr_bytes)
break;
count += nr_bytes;
continue;