summaryrefslogtreecommitdiff
path: root/dma-helpers.c
diff options
context:
space:
mode:
Diffstat (limited to 'dma-helpers.c')
-rw-r--r--dma-helpers.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/dma-helpers.c b/dma-helpers.c
index 7971a89c14..5265132edf 100644
--- a/dma-helpers.c
+++ b/dma-helpers.c
@@ -10,6 +10,22 @@
#include "dma.h"
#include "trace.h"
+int dma_memory_set(DMAContext *dma, dma_addr_t addr, uint8_t c, dma_addr_t len)
+{
+#define FILLBUF_SIZE 512
+ uint8_t fillbuf[FILLBUF_SIZE];
+ int l;
+
+ memset(fillbuf, c, FILLBUF_SIZE);
+ while (len > 0) {
+ l = len < FILLBUF_SIZE ? len : FILLBUF_SIZE;
+ cpu_physical_memory_rw(addr, fillbuf, l, true);
+ len -= len;
+ addr += len;
+ }
+ return 0;
+}
+
void qemu_sglist_init(QEMUSGList *qsg, int alloc_hint)
{
qsg->sg = g_malloc(alloc_hint * sizeof(ScatterGatherEntry));