Commit 8b1f24b0903a8e43e035d5680aed2fa62c68b197

Authored by bellard
1 parent b448f2f3

new physical memory access API (used by DMA accesses)


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@645 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 2 changed files with 16 additions and 5 deletions
cpu-all.h
... ... @@ -599,10 +599,21 @@ int cpu_register_io_memory(int io_index,
599 599 CPUReadMemoryFunc **mem_read,
600 600 CPUWriteMemoryFunc **mem_write);
601 601  
602   -void cpu_physical_memory_rw(CPUState *env, uint8_t *buf, target_ulong addr,
  602 +void cpu_physical_memory_rw(target_ulong addr, uint8_t *buf,
603 603 int len, int is_write);
604   -int cpu_memory_rw_debug(CPUState *env,
605   - uint8_t *buf, target_ulong addr, int len, int is_write);
  604 +static inline void cpu_physical_memory_read(target_ulong addr, uint8_t *buf,
  605 + int len)
  606 +{
  607 + cpu_physical_memory_rw(addr, buf, len, 0);
  608 +}
  609 +static inline void cpu_physical_memory_write(target_ulong addr, const uint8_t *buf,
  610 + int len)
  611 +{
  612 + cpu_physical_memory_rw(addr, (uint8_t *)buf, len, 1);
  613 +}
  614 +
  615 +int cpu_memory_rw_debug(CPUState *env, target_ulong addr,
  616 + uint8_t *buf, int len, int is_write);
606 617  
607 618 /* read dirty bit (return 0 or 1) */
608 619 static inline int cpu_physical_memory_is_dirty(target_ulong addr)
... ...
gdbstub.c
... ... @@ -472,7 +472,7 @@ int cpu_gdbstub(void *opaque, int (*main_loop)(void *opaque), int port)
472 472 if (*p == ',')
473 473 p++;
474 474 len = strtoul(p, NULL, 16);
475   - if (cpu_memory_rw_debug(env, mem_buf, addr, len, 0) != 0)
  475 + if (cpu_memory_rw_debug(env, addr, mem_buf, len, 0) != 0)
476 476 memset(mem_buf, 0, len);
477 477 memtohex(buf, mem_buf, len);
478 478 put_packet(buf);
... ... @@ -486,7 +486,7 @@ int cpu_gdbstub(void *opaque, int (*main_loop)(void *opaque), int port)
486 486 if (*p == ',')
487 487 p++;
488 488 hextomem(mem_buf, p, len);
489   - if (cpu_memory_rw_debug(env, mem_buf, addr, len, 1) != 0)
  489 + if (cpu_memory_rw_debug(env, addr, mem_buf, len, 1) != 0)
490 490 put_packet("ENN");
491 491 else
492 492 put_packet("OK");
... ...