diff --git a/drama/src/rev-mc.c b/drama/src/rev-mc.c index 11168ae..dc94777 100644 --- a/drama/src/rev-mc.c +++ b/drama/src/rev-mc.c @@ -243,6 +243,13 @@ get_dram_fn(uint64_t addr, std::vector fn_masks) return addr_dram; } +void +get_dram_fn_to(uint64_t addr, std::vector fn_masks, std::vector *to) +{ + to->clear(); + for (auto fn : fn_masks) { to->push_back(__builtin_parityl(addr & fn)); } +} + //---------------------------------------------------------- /* It currently finds some of the interesting bits for the row addressing. @@ -262,16 +269,20 @@ find_row_mask(std::vector &sets, verbose_printerr("~~~~~~~~~~ Looking for row bits ~~~~~~~~~~\n"); + std::vector base_dram; + std::vector tmp_dram; for (int i = 0; i < 2; i++) { verbose_printerr("[LOG] - Set #%d\n", i); - addr_tuple base_addr = sets[i][0]; - std::vector base_dram = get_dram_fn((uint64_t) base_addr.p_addr, fn_masks); + addr_tuple base_addr = sets[i][0]; + // std::vector base_dram = get_dram_fn((uint64_t) base_addr.p_addr, fn_masks); + get_dram_fn_to((uint64_t) base_addr.p_addr, fn_masks, &base_dram); same_row_sets.push_back({base_addr}); uint64_t cnt = 0; while (cnt < ROW_SET_CNT) { addr_tuple tmp = gen_addr_tuple(get_rnd_addr(mem.buffer, mem.size, 0)); - if (get_dram_fn((uint64_t) tmp.p_addr, fn_masks) != base_dram) continue; + get_dram_fn_to((uint64_t) tmp.p_addr, fn_masks, &tmp_dram); + if (tmp_dram != base_dram) continue; uint64_t time = time_tuple((volatile char *) base_addr.v_addr, (volatile char *) tmp.v_addr, 1000);