Deleted Added
sdiff udiff text old ( 8706:b1838faf3bcc ) new ( 8722:78b08f92c290 )
full compact
1/*
2 * Copyright (c) 2011 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 124 unchanged lines hidden (view full) ---

133 FSTranslatingPortProxy* vp = tc->getVirtProxy();
134
135 vp->writeBlob(dest, src, cplen);
136}
137
138void
139CopyStringOut(ThreadContext *tc, char *dst, Addr vaddr, size_t maxlen)
140{
141 char *start = dst;
142 FSTranslatingPortProxy* vp = tc->getVirtProxy();
143
144 bool foundNull = false;
145 while ((dst - start + 1) < maxlen && !foundNull) {
146 vp->readBlob(vaddr++, (uint8_t*)dst, 1);
147 if (dst == '\0')
148 foundNull = true;
149 dst++;
150 }
151
152 if (!foundNull)
153 *dst = '\0';
154}
155
156void
157CopyStringIn(ThreadContext *tc, char *src, Addr vaddr)
158{
159 FSTranslatingPortProxy* vp = tc->getVirtProxy();
160 for (ChunkGenerator gen(vaddr, strlen(src), TheISA::PageBytes); !gen.done();
161 gen.next())
162 {
163 vp->writeBlob(gen.addr(), (uint8_t*)src, gen.size());
164 src += gen.size();
165 }
166}