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 --- 126 unchanged lines hidden (view full) --- 135CopyStringOut(ThreadContext *tc, char *dst, Addr vaddr, size_t maxlen) 136{ 137 char *start = dst; 138 FSTranslatingPortProxy &vp = tc->getVirtProxy(); 139 140 bool foundNull = false; 141 while ((dst - start + 1) < maxlen && !foundNull) { 142 vp.readBlob(vaddr++, (uint8_t*)dst, 1); |
143 if (*dst == '\0') |
144 foundNull = true; 145 dst++; 146 } 147 148 if (!foundNull) 149 *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} |