fs_translating_port_proxy.cc (8706:b1838faf3bcc) fs_translating_port_proxy.cc (8722:78b08f92c290)
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{
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 int len = 0;
142 char *start = dst;
143 FSTranslatingPortProxy* vp = tc->getVirtProxy();
144
141 char *start = dst;
142 FSTranslatingPortProxy* vp = tc->getVirtProxy();
143
145 do {
146 vp->readBlob(vaddr++, (uint8_t*)dst++, 1);
147 } while (len < maxlen && start[len++] != 0 );
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 }
148
151
149 dst[len] = 0;
152 if (!foundNull)
153 *dst = '\0';
150}
151
152void
153CopyStringIn(ThreadContext *tc, char *src, Addr vaddr)
154{
155 FSTranslatingPortProxy* vp = tc->getVirtProxy();
156 for (ChunkGenerator gen(vaddr, strlen(src), TheISA::PageBytes); !gen.done();
157 gen.next())
158 {
159 vp->writeBlob(gen.addr(), (uint8_t*)src, gen.size());
160 src += gen.size();
161 }
162}
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}