summaryrefslogtreecommitdiff
path: root/arch/alpha
diff options
context:
space:
mode:
authorNathan Binkert <binkertn@umich.edu>2004-07-01 18:00:18 -0400
committerNathan Binkert <binkertn@umich.edu>2004-07-01 18:00:18 -0400
commit671cff59372695309b62f2a4f6aa68269f56584a (patch)
tree57aeec43624eff8fa284d292877506c4ab9533e2 /arch/alpha
parent12e8ab2b64e12307c6550e20274e49f6092bf4f7 (diff)
downloadgem5-671cff59372695309b62f2a4f6aa68269f56584a.tar.xz
rename CopyData to CopyOut and implement CopyIn to copy data
from the simulator into the simulatee kern/tru64/dump_mbuf.cc: rename CopyData -> CopyOut --HG-- extra : convert_revision : e3ef27a5762dfc495dcb84a372470464c27557d2
Diffstat (limited to 'arch/alpha')
-rw-r--r--arch/alpha/vtophys.cc53
-rw-r--r--arch/alpha/vtophys.hh3
2 files changed, 49 insertions, 7 deletions
diff --git a/arch/alpha/vtophys.cc b/arch/alpha/vtophys.cc
index 7a38b296b..f4b2c7ed3 100644
--- a/arch/alpha/vtophys.cc
+++ b/arch/alpha/vtophys.cc
@@ -133,14 +133,14 @@ vtomem(ExecContext *xc, Addr vaddr, size_t len)
}
void
-CopyData(ExecContext *xc, void *dest, Addr vaddr, size_t cplen)
+CopyOut(ExecContext *xc, void *dest, Addr src, size_t cplen)
{
Addr paddr;
char *dmaaddr;
char *dst = (char *)dest;
int len;
- paddr = vtophys(xc, vaddr);
+ paddr = vtophys(xc, src);
len = min((int)(ALPHA_PGBYTES - (paddr & PGOFSET)), (int)cplen);
dmaaddr = (char *)xc->physmem->dma_addr(paddr, len);
assert(dmaaddr);
@@ -151,21 +151,21 @@ CopyData(ExecContext *xc, void *dest, Addr vaddr, size_t cplen)
cplen -= len;
dst += len;
- vaddr += len;
+ src += len;
while (cplen > ALPHA_PGBYTES) {
- paddr = vtophys(xc, vaddr);
+ paddr = vtophys(xc, src);
dmaaddr = (char *)xc->physmem->dma_addr(paddr, ALPHA_PGBYTES);
assert(dmaaddr);
memcpy(dst, dmaaddr, ALPHA_PGBYTES);
cplen -= ALPHA_PGBYTES;
dst += ALPHA_PGBYTES;
- vaddr += ALPHA_PGBYTES;
+ src += ALPHA_PGBYTES;
}
if (cplen > 0) {
- paddr = vtophys(xc, vaddr);
+ paddr = vtophys(xc, src);
dmaaddr = (char *)xc->physmem->dma_addr(paddr, cplen);
assert(dmaaddr);
@@ -174,6 +174,47 @@ CopyData(ExecContext *xc, void *dest, Addr vaddr, size_t cplen)
}
void
+CopyIn(ExecContext *xc, Addr dest, void *source, size_t cplen)
+{
+ Addr paddr;
+ char *dmaaddr;
+ char *src = (char *)source;
+ int len;
+
+ paddr = vtophys(xc, dest);
+ len = min((int)(ALPHA_PGBYTES - (paddr & PGOFSET)), (int)cplen);
+ dmaaddr = (char *)xc->physmem->dma_addr(paddr, len);
+ assert(dmaaddr);
+
+ memcpy(dmaaddr, src, len);
+ if (len == cplen)
+ return;
+
+ cplen -= len;
+ src += len;
+ dest += len;
+
+ while (cplen > ALPHA_PGBYTES) {
+ paddr = vtophys(xc, dest);
+ dmaaddr = (char *)xc->physmem->dma_addr(paddr, ALPHA_PGBYTES);
+ assert(dmaaddr);
+
+ memcpy(dmaaddr, src, ALPHA_PGBYTES);
+ cplen -= ALPHA_PGBYTES;
+ src += ALPHA_PGBYTES;
+ dest += ALPHA_PGBYTES;
+ }
+
+ if (cplen > 0) {
+ paddr = vtophys(xc, dest);
+ dmaaddr = (char *)xc->physmem->dma_addr(paddr, cplen);
+ assert(dmaaddr);
+
+ memcpy(dmaaddr, src, cplen);
+ }
+}
+
+void
CopyString(ExecContext *xc, char *dst, Addr vaddr, size_t maxlen)
{
Addr paddr;
diff --git a/arch/alpha/vtophys.hh b/arch/alpha/vtophys.hh
index 497a53f0d..7c22e3371 100644
--- a/arch/alpha/vtophys.hh
+++ b/arch/alpha/vtophys.hh
@@ -44,7 +44,8 @@ Addr vtophys(ExecContext *xc, Addr vaddr);
uint8_t *vtomem(ExecContext *xc, Addr vaddr, size_t len);
uint8_t *ptomem(ExecContext *xc, Addr paddr, size_t len);
-void CopyData(ExecContext *xc, void *dst, Addr vaddr, size_t len);
+void CopyOut(ExecContext *xc, void *dst, Addr src, size_t len);
+void CopyIn(ExecContext *xc, Addr dst, void *src, size_t len);
void CopyString(ExecContext *xc, char *dst, Addr vaddr, size_t maxlen);
#endif // __VTOPHYS_H__