We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b333b1d commit 145445fCopy full SHA for 145445f
difftest/difftest.cc
@@ -245,9 +245,19 @@ void DifftestRef::set_regs(diff_context_t *ctx, bool on_demand) {
245
246
void DifftestRef::memcpy_from_dut(reg_t dest, void* src, size_t n) {
247
while (n) {
248
- char *base = sim->addr_to_mem(dest);
+ bool is_zero = true;
249
+ for (int i=0; i < (PGSIZE/sizeof(uint64_t)); i++) {
250
+ if (((uint64_t*)src)[i] != 0) {
251
+ is_zero = false;
252
+ break;
253
+ }
254
255
+
256
size_t n_bytes = (n > PGSIZE) ? PGSIZE : n;
- memcpy(base, src, n_bytes);
257
+ if (!is_zero) {
258
+ char *base = sim->addr_to_mem(dest);
259
+ memcpy(base, src, n_bytes);
260
261
dest += PGSIZE;
262
src = (char *)src + PGSIZE;
263
n -= n_bytes;
0 commit comments