optim: find_row_mask
This commit is contained in:
parent
77ff82d0f2
commit
74730a17be
@ -243,6 +243,13 @@ get_dram_fn(uint64_t addr, std::vector<uint64_t> fn_masks)
|
||||
return addr_dram;
|
||||
}
|
||||
|
||||
void
|
||||
get_dram_fn_to(uint64_t addr, std::vector<uint64_t> fn_masks, std::vector<uint8_t> *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<set_t> &sets,
|
||||
|
||||
verbose_printerr("~~~~~~~~~~ Looking for row bits ~~~~~~~~~~\n");
|
||||
|
||||
std::vector<uint8_t> base_dram;
|
||||
std::vector<uint8_t> 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<uint8_t> base_dram = get_dram_fn((uint64_t) base_addr.p_addr, fn_masks);
|
||||
addr_tuple base_addr = sets[i][0];
|
||||
// std::vector<uint8_t> 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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user