summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/cachepc.c13
-rwxr-xr-xsrc/cachepc.h5
2 files changed, 14 insertions, 4 deletions
diff --git a/src/cachepc.c b/src/cachepc.c
index b5f8589..bde514b 100755
--- a/src/cachepc.c
+++ b/src/cachepc.c
@@ -95,12 +95,19 @@ cachepc_prepare_ds(cache_ctx *ctx)
}
void
-cachepc_save_msrmts(cacheline *head, const char *prefix, int index)
+cachepc_save_msrmts(cacheline *head)
{
- char filename[256];
+ cacheline *curr_cl;
- snprintf(filename, sizeof(filename), "%s.%i", prefix, index);
+ curr_cl = head;
+ do {
+ if (IS_FIRST(curr_cl->flags)) {
+ BUG_ON(curr_cl->cache_set >= cachepc_msrmts_count);
+ cachepc_msrmts[curr_cl->cache_set] = curr_cl->count;
+ }
+ curr_cl = curr_cl->prev;
+ } while (curr_cl != head);
}
void
diff --git a/src/cachepc.h b/src/cachepc.h
index c40fc10..72c348b 100755
--- a/src/cachepc.h
+++ b/src/cachepc.h
@@ -15,7 +15,7 @@ void cachepc_init_counters(void);
cache_ctx *cachepc_get_ctx(cache_level cl);
cacheline *cachepc_prepare_ds(cache_ctx *ctx);
-void cachepc_save_msrmts(cacheline *head, const char *prefix, int index);
+void cachepc_save_msrmts(cacheline *head);
void cachepc_print_msrmts(cacheline *head);
void cachepc_release_ds(cache_ctx *ctx, cacheline *ds);
void cachepc_release_ctx(cache_ctx *ctx);
@@ -32,6 +32,9 @@ static inline cacheline *cachepc_probe_set(cacheline *curr_cl);
__attribute__((always_inline))
static inline cacheline *cachepc_probe(cacheline *head);
+extern uint8_t *cachepc_msrmts;
+extern size_t cachepc_msrmts_count;
+
/*
* Prime phase: fill the target cache (encoded in the size of the data structure)
* with the prepared data structure, i.e. with attacker data.