Skip to contentSkip to conversation

[6394] Add target memory mapping API (Avi Kivity)

Qemu-devel Anthony Liguori 1 participant 1 message Jan 22, 2009

lore
Share & tools
lore
#0 lore raw

Revision: 6394

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6394
Author:   aliguori
Date:     2009-01-22 16:59:11 +0000 (Thu, 22 Jan 2009)

Log Message:
-----------
Add target memory mapping API (Avi Kivity)

Devices accessing large amounts of memory (as with DMA) will wish to obtain a pointer to guest memory rather than access it indirectly via cpu_physical_memory_rw(). Add a new API to convert target addresses to host pointers.

In case the target address does not correspond to RAM, a bounce buffer is allocated. To prevent the guest from causing the host to allocate unbounded amounts of bounce buffer, this memory is limited (currently to one page).

Modified Paths:
--------------
trunk/cpu-all.h
trunk/exec.c

Modified: trunk/cpu-all.h
===================================================================

cpu-all.h +6 -0
@@ -923,6 +923,12 @@
 {
     cpu_physical_memory_rw(addr, (uint8_t *)buf, len, 1);
 }
+void *cpu_physical_memory_map(target_phys_addr_t addr,
+                              target_phys_addr_t *plen,
+                              int is_write);
+void cpu_physical_memory_unmap(void *buffer, target_phys_addr_t len,
+                               int is_write, target_phys_addr_t access_len);
+
 uint32_t ldub_phys(target_phys_addr_t addr);
 uint32_t lduw_phys(target_phys_addr_t addr);
 uint32_t ldl_phys(target_phys_addr_t addr);

Modified: trunk/exec.c
===================================================================

exec.c +102 -0

109 lines not on this page · raw message