From d67badb12e9687975720077b89a5bf48201dead2 Mon Sep 17 00:00:00 2001 From: emanuele Date: Sat, 14 Mar 2020 14:24:24 +0100 Subject: [PATCH] Bug fix 'refill row with bad data pattern' --- hammersuite/src/hammer-suite.c | 28 +++++++++++++++------------- hammersuite/src/main.c | 3 +++ 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/hammersuite/src/hammer-suite.c b/hammersuite/src/hammer-suite.c index 502864f..a0ccb59 100644 --- a/hammersuite/src/hammer-suite.c +++ b/hammersuite/src/hammer-suite.c @@ -273,13 +273,18 @@ void fill_stripe(DRAMAddr d_addr, uint8_t val, ADDRMapper * mapper) } -void fill_row(HammerSuite * suite, DRAMAddr * d_addr, HammerData data_patt) +void fill_row(HammerSuite *suite, DRAMAddr *d_addr, HammerData data_patt, int reverse) { if (p->vpat != (void *)NULL && p->tpat != (void *)NULL) { - fill_stripe(*d_addr, (uint8_t) * p->tpat, suite->mapper); + uint8_t pat = reverse ? *p->vpat : *p->tpat; + fill_stripe(*d_addr, pat, suite->mapper); return; } + if (reverse) { + data_patt = (HammerData)((int)data_patt ^(int)REVERSE); + } + switch (data_patt) { case RANDOM: // rows are already filled for random data patt @@ -587,15 +592,14 @@ int free_triple_sided_test(HammerSuite * suite) h_patt.d_lst[2].bank = bk; // fill all the aggressor rows for (int idx = 0; idx < 3; idx++) { - fill_row(suite, &h_patt.d_lst[idx], cfg->d_cfg); + fill_row(suite, &h_patt.d_lst[idx], cfg->d_cfg, 0); } uint64_t time = hammer_it(&h_patt, mem); fprintf(stderr, "%ld ", time); scan_rows(suite, &h_patt, 0); for (int idx = 0; idx < 3; idx++) { - fill_row(suite, &h_patt.d_lst[idx], (HammerData) ((int)cfg-> - d_cfg ^ (int) REVERSE)); + fill_row(suite, &h_patt.d_lst[idx], cfg->d_cfg, 1); } } fprintf(stderr, "\n"); @@ -646,7 +650,7 @@ int assisted_double_sided_test(HammerSuite * suite) h_patt.d_lst[2].bank = bk; // fill all the aggressor rows for (int idx = 0; idx < 3; idx++) { - fill_row(suite, &h_patt.d_lst[idx], cfg->d_cfg); + fill_row(suite, &h_patt.d_lst[idx], cfg->d_cfg, 0); // fprintf(stderr, "d_addr: %s\n", dram_2_str(&h_patt.d_lst[idx])); } // fprintf(stderr, "d_addr: %s\n", dram_2_str(&h_patt.d_lst[idx])); @@ -655,7 +659,7 @@ int assisted_double_sided_test(HammerSuite * suite) scan_rows(suite, &h_patt, 0); for (int idx = 0; idx<3; idx++) { - fill_row(suite, &h_patt.d_lst[idx], (HammerData) ((int)cfg->d_cfg ^ (int)REVERSE)); + fill_row(suite, &h_patt.d_lst[idx], cfg->d_cfg, 1); } } fprintf(stderr, "\n"); @@ -707,7 +711,7 @@ int n_sided_test(HammerSuite * suite) #endif // fill all the aggressor rows for (int idx = 0; idx < cfg->aggr_n; idx++) { - fill_row(suite, &h_patt.d_lst[idx], cfg->d_cfg); + fill_row(suite, &h_patt.d_lst[idx], cfg->d_cfg, 0); } uint64_t time = hammer_it(&h_patt, mem); @@ -715,8 +719,7 @@ int n_sided_test(HammerSuite * suite) scan_rows(suite, &h_patt, 0); for (int idx = 0; idxd_cfg ^ (int)REVERSE)); + fill_row(suite, &h_patt.d_lst[idx], cfg->d_cfg, 1); #ifdef FLIPTABLE print_end_attack(); #endif @@ -767,15 +770,14 @@ void fuzz(HammerSuite *suite, int d, int v) print_start_attack(&h_patt); #endif for (int idx = 0; idx < h_patt.len; idx++) - fill_row(suite, &h_patt.d_lst[idx], suite->cfg->d_cfg); + fill_row(suite, &h_patt.d_lst[idx], suite->cfg->d_cfg, 0); uint64_t time = hammer_it(&h_patt, suite->mem); fprintf(stderr, "%lu ",time); scan_rows(suite, &h_patt, 0); for (int idx = 0; idxcfg->d_cfg ^ (int)REVERSE)); + fill_row(suite, &h_patt.d_lst[idx], suite->cfg->d_cfg, 1); } #ifdef FLIPTABLE diff --git a/hammersuite/src/main.c b/hammersuite/src/main.c index 0ce28a3..ee43eda 100644 --- a/hammersuite/src/main.c +++ b/hammersuite/src/main.c @@ -25,6 +25,9 @@ ProfileParams *p; +// DRAMLayout g_mem_layout = {{{0x4080,0x88000,0x110000,0x220000,0x440000,0x4b300}, 6}, 0xffff80000, ((1<<13)-1)}; +// DRAMLayout g_mem_layout = { {{0x2040, 0x44000, 0x88000, 0x110000, 0x220000}, 5}, 0xffffc0000, ((1 << 13) - 1) }; +// DRAMLayout g_mem_layout = {{{0x2040,0x24000,0x48000,0x90000},4}, 0xffffe0000, ((1<<13)-1)}; DRAMLayout g_mem_layout = {{{0x4080,0x48000,0x90000,0x120000,0x1b300}, 5}, 0xffffc0000, ROW_SIZE-1}; void read_config(SessionConfig * cfg, char *f_name)