diff --git a/.idea/DendrobatesTinctoriusAzureus.iml b/.idea/DendrobatesTinctoriusAzureus.iml
index da820a6..e25d0c7 100644
--- a/.idea/DendrobatesTinctoriusAzureus.iml
+++ b/.idea/DendrobatesTinctoriusAzureus.iml
@@ -40,6 +40,7 @@
+
diff --git a/prefetcher_reverse/.cargo/config b/CacheObserver/.cargo/config
similarity index 100%
rename from prefetcher_reverse/.cargo/config
rename to CacheObserver/.cargo/config
diff --git a/prefetcher_reverse/Cargo.toml b/CacheObserver/Cargo.toml
similarity index 95%
rename from prefetcher_reverse/Cargo.toml
rename to CacheObserver/Cargo.toml
index 8a177f8..cdfaa8d 100644
--- a/prefetcher_reverse/Cargo.toml
+++ b/CacheObserver/Cargo.toml
@@ -1,5 +1,5 @@
[package]
-name = "prefetcher_reverse"
+name = "CacheObserver"
version = "0.1.0"
authors = ["Guillaume DIDIER "]
edition = "2018"
diff --git a/prefetcher_reverse/MSR1A4.txt b/CacheObserver/MSR1A4.txt
similarity index 100%
rename from prefetcher_reverse/MSR1A4.txt
rename to CacheObserver/MSR1A4.txt
diff --git a/prefetcher_reverse/Readme.md b/CacheObserver/Readme.md
similarity index 97%
rename from prefetcher_reverse/Readme.md
rename to CacheObserver/Readme.md
index cdfb335..063ff67 100644
--- a/prefetcher_reverse/Readme.md
+++ b/CacheObserver/Readme.md
@@ -4,7 +4,7 @@ CacheObserver - monitor what happens in the cache when doing memory accesses
This framework, derived from https://github.com/MIAOUS-group/calibration-done-right,
is built to help reverse engineer prefetchers on Intel CPUs.
-The main entry point of the framework is the `prefetcher_reverse` crate.
+The main entry point of the framework is the `CacheObserver` crate.
The code presented runs under Fedora 30, and can also be made to run on Ubuntu 18.04 LTS with minor tweaks
@@ -22,7 +22,7 @@ non-boosted frequency.
One can run all the experiments with the following instructions :
```
-cd prefetcher_reverse
+cd CacheObserver
mkdir results-xxx
cd results-xxx
sudo ../setup.sh
diff --git a/prefetcher_reverse/run-msr-all.sh b/CacheObserver/run-msr-all.sh
similarity index 100%
rename from prefetcher_reverse/run-msr-all.sh
rename to CacheObserver/run-msr-all.sh
diff --git a/CacheObserver/run-msr-bonus.sh b/CacheObserver/run-msr-bonus.sh
new file mode 100755
index 0000000..e8132b7
--- /dev/null
+++ b/CacheObserver/run-msr-bonus.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+PREFETCH_MSR=$1
+sudo wrmsr -a 0x1a4 $PREFETCH_MSR
+sudo echo wrmsr -a 0x1a4 $PREFETCH_MSR
+sudo rdmsr -a 0x1a4
+cargo run --release --bin bonus_access_pattern > bonusap-with-${PREFETCH_MSR}-prefetcher.log
+sudo rdmsr -a 0x1a4
+
diff --git a/prefetcher_reverse/run-msr-eap.sh b/CacheObserver/run-msr-eap.sh
similarity index 100%
rename from prefetcher_reverse/run-msr-eap.sh
rename to CacheObserver/run-msr-eap.sh
diff --git a/CacheObserver/run-msr-extrap.sh b/CacheObserver/run-msr-extrap.sh
new file mode 100755
index 0000000..91bb19e
--- /dev/null
+++ b/CacheObserver/run-msr-extrap.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+PREFETCH_MSR=$1
+sudo wrmsr -a 0x1a4 $PREFETCH_MSR
+sudo echo wrmsr -a 0x1a4 $PREFETCH_MSR
+sudo rdmsr -a 0x1a4
+cargo run --release --bin extra_access_pattern > extrap-with-${PREFETCH_MSR}-prefetcher.log
+sudo rdmsr -a 0x1a4
+
diff --git a/prefetcher_reverse/run-msr-np.sh b/CacheObserver/run-msr-np.sh
similarity index 100%
rename from prefetcher_reverse/run-msr-np.sh
rename to CacheObserver/run-msr-np.sh
diff --git a/prefetcher_reverse/run-msr-rpa.sh b/CacheObserver/run-msr-rpa.sh
similarity index 100%
rename from prefetcher_reverse/run-msr-rpa.sh
rename to CacheObserver/run-msr-rpa.sh
diff --git a/prefetcher_reverse/run-msr-stream.sh b/CacheObserver/run-msr-stream.sh
similarity index 100%
rename from prefetcher_reverse/run-msr-stream.sh
rename to CacheObserver/run-msr-stream.sh
diff --git a/prefetcher_reverse/run-msr-stride.sh b/CacheObserver/run-msr-stride.sh
similarity index 100%
rename from prefetcher_reverse/run-msr-stride.sh
rename to CacheObserver/run-msr-stride.sh
diff --git a/prefetcher_reverse/run-msr.sh b/CacheObserver/run-msr.sh
similarity index 50%
rename from prefetcher_reverse/run-msr.sh
rename to CacheObserver/run-msr.sh
index 8a33aa3..f2a41ea 100755
--- a/prefetcher_reverse/run-msr.sh
+++ b/CacheObserver/run-msr.sh
@@ -2,6 +2,6 @@
PREFETCH_MSR=$1
sudo wrmsr -a 0x1a4 $PREFETCH_MSR
sudo rdmsr -a 0x1a4
-cargo run --bin prefetcher_reverse --release > with-${PREFETCH_MSR}-prefetcher.log
+cargo run --bin CacheObserver --release > with-${PREFETCH_MSR}-prefetcher.log
diff --git a/prefetcher_reverse/setup.sh b/CacheObserver/setup.sh
similarity index 100%
rename from prefetcher_reverse/setup.sh
rename to CacheObserver/setup.sh
diff --git a/prefetcher_reverse/src/bin/all_experiments.rs b/CacheObserver/src/bin/all_experiments.rs
similarity index 79%
rename from prefetcher_reverse/src/bin/all_experiments.rs
rename to CacheObserver/src/bin/all_experiments.rs
index c6fe288..81fd52c 100644
--- a/prefetcher_reverse/src/bin/all_experiments.rs
+++ b/CacheObserver/src/bin/all_experiments.rs
@@ -14,7 +14,7 @@ Alternatively, limit to 3 accesses ?
use cache_utils::ip_tool::{Function, TIMED_MACCESS};
use itertools::Itertools;
use nix::sched::sched_yield;
-use prefetcher_reverse::{
+use CacheObserver::{
pattern_helper, FullPageDualProbeResults, PatternAccess, Prober, PAGE_CACHELINE_LEN,
};
@@ -160,36 +160,28 @@ fn main() {
unique_ip: true,
};
- let mut experiments: Vec<(String, usize, usize, Box Vec>)> = vec![];
- for class in [
- (
- "",
- Box::new(|k: usize| {
-
- let f = Box::new(move |i, j| {
- let mut v = vec![
- i,j,
- ];
- v.truncate(k);
- v
- }) as Box Vec>;
- let i_limit = if k > 0 {
- PAGE_CACHELINE_LEN
- } else {
- 1
- };
- let j_limit = if k > 1 {
- PAGE_CACHELINE_LEN
- } else {
- 1
- };
- (i_limit,j_limit,f)
- }) as Box (usize, usize, Box Vec>)>,
- ),
- ] {
- for k in [0,1,2] {
+ let mut experiments: Vec<(
+ String,
+ usize,
+ usize,
+ Box Vec>,
+ )> = vec![];
+ for class in [(
+ "",
+ Box::new(|k: usize| {
+ let f = Box::new(move |i, j| {
+ let mut v = vec![i, j];
+ v.truncate(k);
+ v
+ }) as Box Vec>;
+ let i_limit = if k > 0 { PAGE_CACHELINE_LEN } else { 1 };
+ let j_limit = if k > 1 { PAGE_CACHELINE_LEN } else { 1 };
+ (i_limit, j_limit, f)
+ }) as Box (usize, usize, Box Vec>)>,
+ )] {
+ for k in [0, 1, 2] {
let exp = class.1(k);
- experiments.push((format!("{}{}", class.0, k),exp.0, exp.1, exp.2));
+ experiments.push((format!("{}{}", class.0, k), exp.0, exp.1, exp.2));
}
}
@@ -224,7 +216,12 @@ fn main() {
),
] {
for k in [1, 2, 3, 4, 8] {
- experiments.push((format!("{}{}", class.0, k), PAGE_CACHELINE_LEN, PAGE_CACHELINE_LEN, class.1(k)));
+ experiments.push((
+ format!("{}{}", class.0, k),
+ PAGE_CACHELINE_LEN,
+ PAGE_CACHELINE_LEN,
+ class.1(k),
+ ));
}
}
@@ -241,29 +238,36 @@ fn main() {
}) as Box Box Vec>>,
)] {
for len in [2, 3, 4] {
- experiments.push((format!("{}{}", class.0, len), PAGE_CACHELINE_LEN, PAGE_CACHELINE_LEN, class.1(len)));
+ experiments.push((
+ format!("{}{}", class.0, len),
+ PAGE_CACHELINE_LEN,
+ PAGE_CACHELINE_LEN,
+ class.1(len),
+ ));
}
}
- for class in [
- (
- "F",
- Box::new(|k: isize| {
- Box::new(move |i, j| {
- vec![
- i,
- (i as isize + k + PAGE_CACHELINE_LEN as isize) as usize
- % PAGE_CACHELINE_LEN,
- j,
- (i as isize + 2 * k + PAGE_CACHELINE_LEN as isize) as usize
- % PAGE_CACHELINE_LEN,
- ]
- }) as Box Vec>
- }) as Box Box Vec>>,
- ),
- ] {
+ for class in [(
+ "F",
+ Box::new(|k: isize| {
+ Box::new(move |i, j| {
+ vec![
+ i,
+ (i as isize + k + PAGE_CACHELINE_LEN as isize) as usize % PAGE_CACHELINE_LEN,
+ j,
+ (i as isize + 2 * k + PAGE_CACHELINE_LEN as isize) as usize
+ % PAGE_CACHELINE_LEN,
+ ]
+ }) as Box Vec>
+ }) as Box Box Vec>>,
+ )] {
for k in [4 as isize, 3, 2, 1, -1, -2, -3, -4] {
- experiments.push((format!("{}{}", class.0, k), PAGE_CACHELINE_LEN, PAGE_CACHELINE_LEN, class.1(k)));
+ experiments.push((
+ format!("{}{}", class.0, k),
+ PAGE_CACHELINE_LEN,
+ PAGE_CACHELINE_LEN,
+ class.1(k),
+ ));
}
}
diff --git a/prefetcher_reverse/src/bin/bonus_access_pattern.rs b/CacheObserver/src/bin/bonus_access_pattern.rs
similarity index 99%
rename from prefetcher_reverse/src/bin/bonus_access_pattern.rs
rename to CacheObserver/src/bin/bonus_access_pattern.rs
index bf2433a..0276eda 100644
--- a/prefetcher_reverse/src/bin/bonus_access_pattern.rs
+++ b/CacheObserver/src/bin/bonus_access_pattern.rs
@@ -14,7 +14,7 @@ Alternatively, limit to 3 accesses ?
use cache_utils::ip_tool::{Function, TIMED_MACCESS};
use itertools::Itertools;
use nix::sched::sched_yield;
-use prefetcher_reverse::{
+use CacheObserver::{
pattern_helper, FullPageDualProbeResults, PatternAccess, Prober, PAGE_CACHELINE_LEN,
};
diff --git a/prefetcher_reverse/src/bin/exhaustive_access_pattern.rs b/CacheObserver/src/bin/exhaustive_access_pattern.rs
similarity index 99%
rename from prefetcher_reverse/src/bin/exhaustive_access_pattern.rs
rename to CacheObserver/src/bin/exhaustive_access_pattern.rs
index b4d4535..89d159e 100644
--- a/prefetcher_reverse/src/bin/exhaustive_access_pattern.rs
+++ b/CacheObserver/src/bin/exhaustive_access_pattern.rs
@@ -14,7 +14,7 @@ Alternatively, limit to 3 accesses ?
use cache_utils::ip_tool::{Function, TIMED_MACCESS};
use itertools::Itertools;
use nix::sched::sched_yield;
-use prefetcher_reverse::{
+use CacheObserver::{
pattern_helper, FullPageDualProbeResults, PatternAccess, Prober, PAGE_CACHELINE_LEN,
};
diff --git a/prefetcher_reverse/src/bin/extra_access_pattern.rs b/CacheObserver/src/bin/extra_access_pattern.rs
similarity index 99%
rename from prefetcher_reverse/src/bin/extra_access_pattern.rs
rename to CacheObserver/src/bin/extra_access_pattern.rs
index 52a8bec..a5ce479 100644
--- a/prefetcher_reverse/src/bin/extra_access_pattern.rs
+++ b/CacheObserver/src/bin/extra_access_pattern.rs
@@ -14,7 +14,7 @@ Alternatively, limit to 3 accesses ?
use cache_utils::ip_tool::{Function, TIMED_MACCESS};
use itertools::Itertools;
use nix::sched::sched_yield;
-use prefetcher_reverse::{
+use CacheObserver::{
pattern_helper, FullPageDualProbeResults, PatternAccess, Prober, PAGE_CACHELINE_LEN,
};
diff --git a/prefetcher_reverse/src/bin/ip_test.rs b/CacheObserver/src/bin/ip_test.rs
similarity index 100%
rename from prefetcher_reverse/src/bin/ip_test.rs
rename to CacheObserver/src/bin/ip_test.rs
diff --git a/prefetcher_reverse/src/bin/naive_flush_flush.rs b/CacheObserver/src/bin/naive_flush_flush.rs
similarity index 98%
rename from prefetcher_reverse/src/bin/naive_flush_flush.rs
rename to CacheObserver/src/bin/naive_flush_flush.rs
index 1d0c995..c88505b 100644
--- a/prefetcher_reverse/src/bin/naive_flush_flush.rs
+++ b/CacheObserver/src/bin/naive_flush_flush.rs
@@ -8,7 +8,7 @@ use cache_utils::calibration::{Threshold, PAGE_LEN};
use cache_utils::maccess;
use cache_utils::mmap::MMappedMemory;
use flush_flush::naive::NaiveFlushAndFlush;
-use prefetcher_reverse::CACHE_LINE_LEN;
+use CacheObserver::CACHE_LINE_LEN;
const ITERATIONS: i32 = 128;
const THRESHOLD: usize = 175; // For Cyber Cobaye
diff --git a/prefetcher_reverse/src/bin/new_page.rs b/CacheObserver/src/bin/new_page.rs
similarity index 90%
rename from prefetcher_reverse/src/bin/new_page.rs
rename to CacheObserver/src/bin/new_page.rs
index 5c4f6f9..ab53b04 100644
--- a/prefetcher_reverse/src/bin/new_page.rs
+++ b/CacheObserver/src/bin/new_page.rs
@@ -1,5 +1,5 @@
use cache_utils::ip_tool::{Function, TIMED_MACCESS};
-use prefetcher_reverse::{pattern_helper, Prober, PAGE_CACHELINE_LEN};
+use CacheObserver::{pattern_helper, Prober, PAGE_CACHELINE_LEN};
pub const NUM_ITERATION: usize = 1 << 10;
diff --git a/prefetcher_reverse/src/bin/rpa_patterns.rs b/CacheObserver/src/bin/rpa_patterns.rs
similarity index 98%
rename from prefetcher_reverse/src/bin/rpa_patterns.rs
rename to CacheObserver/src/bin/rpa_patterns.rs
index 6c0c1ca..f02a56e 100644
--- a/prefetcher_reverse/src/bin/rpa_patterns.rs
+++ b/CacheObserver/src/bin/rpa_patterns.rs
@@ -11,12 +11,12 @@ use cache_utils::mmap;
use cache_utils::mmap::MMappedMemory;
use flush_flush::{FFHandle, FFPrimitives, FlushAndFlush};
use nix::Error;
-use prefetcher_reverse::{
- pattern_helper, reference_patterns, Prober, CACHE_LINE_LEN, PAGE_CACHELINE_LEN,
-};
use rand::seq::SliceRandom;
use std::iter::Cycle;
use std::ops::Range;
+use CacheObserver::{
+ pattern_helper, reference_patterns, Prober, CACHE_LINE_LEN, PAGE_CACHELINE_LEN,
+};
pub const NUM_ITERATION: usize = 1 << 10;
pub const NUM_PAGES: usize = 256;
diff --git a/prefetcher_reverse/src/bin/stream.rs b/CacheObserver/src/bin/stream.rs
similarity index 98%
rename from prefetcher_reverse/src/bin/stream.rs
rename to CacheObserver/src/bin/stream.rs
index a992052..d2fefe3 100644
--- a/prefetcher_reverse/src/bin/stream.rs
+++ b/CacheObserver/src/bin/stream.rs
@@ -1,7 +1,7 @@
use cache_utils::ip_tool::{Function, TIMED_MACCESS};
use cache_utils::{flush, maccess};
-use prefetcher_reverse::{pattern_helper, Prober, PAGE_CACHELINE_LEN};
use std::arch::x86_64 as arch_x86;
+use CacheObserver::{pattern_helper, Prober, PAGE_CACHELINE_LEN};
pub const NUM_ITERATION: usize = 1 << 10;
diff --git a/prefetcher_reverse/src/bin/strides.rs b/CacheObserver/src/bin/strides.rs
similarity index 94%
rename from prefetcher_reverse/src/bin/strides.rs
rename to CacheObserver/src/bin/strides.rs
index 526e37e..53e5ceb 100644
--- a/prefetcher_reverse/src/bin/strides.rs
+++ b/CacheObserver/src/bin/strides.rs
@@ -1,5 +1,5 @@
use cache_utils::ip_tool::{Function, TIMED_MACCESS};
-use prefetcher_reverse::{pattern_helper, Prober, PAGE_CACHELINE_LEN};
+use CacheObserver::{pattern_helper, Prober, PAGE_CACHELINE_LEN};
pub const NUM_ITERATION: usize = 1 << 10;
diff --git a/prefetcher_reverse/src/lib.rs b/CacheObserver/src/lib.rs
similarity index 100%
rename from prefetcher_reverse/src/lib.rs
rename to CacheObserver/src/lib.rs
diff --git a/prefetcher_reverse/src/main.rs b/CacheObserver/src/main.rs
similarity index 98%
rename from prefetcher_reverse/src/main.rs
rename to CacheObserver/src/main.rs
index b070747..b438953 100644
--- a/prefetcher_reverse/src/main.rs
+++ b/CacheObserver/src/main.rs
@@ -11,11 +11,9 @@ use cache_utils::mmap;
use cache_utils::mmap::MMappedMemory;
use flush_flush::{FFHandle, FFPrimitives, FlushAndFlush};
use nix::Error;
-use prefetcher_reverse::{
- pattern_helper, PatternAccess, Prober, CACHE_LINE_LEN, PAGE_CACHELINE_LEN,
-};
use rand::seq::SliceRandom;
use std::iter::Cycle;
+use CacheObserver::{pattern_helper, PatternAccess, Prober, CACHE_LINE_LEN, PAGE_CACHELINE_LEN};
pub const NUM_ITERATION: usize = 1 << 10;
pub const NUM_PAGES: usize = 256;
diff --git a/Cargo.lock b/Cargo.lock
index 1fb5c84..6a23cd1 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2,6 +2,22 @@
# It is not intended for manual editing.
version = 3
+[[package]]
+name = "CacheObserver"
+version = "0.1.0"
+dependencies = [
+ "basic_timing_cache_channel",
+ "bitvec",
+ "cache_side_channel",
+ "cache_utils",
+ "flush_flush",
+ "flush_reload",
+ "itertools",
+ "lazy_static",
+ "nix",
+ "rand",
+]
+
[[package]]
name = "aes-t-tables"
version = "0.1.0"
@@ -366,22 +382,6 @@ version = "0.2.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857"
-[[package]]
-name = "prefetcher_reverse"
-version = "0.1.0"
-dependencies = [
- "basic_timing_cache_channel",
- "bitvec",
- "cache_side_channel",
- "cache_utils",
- "flush_flush",
- "flush_reload",
- "itertools",
- "lazy_static",
- "nix",
- "rand",
-]
-
[[package]]
name = "radium"
version = "0.6.2"
diff --git a/Cargo.toml b/Cargo.toml
index ba0c902..c681c66 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,7 +13,7 @@ members = [
"flush_flush",
"basic_timing_cache_channel",
"turn_lock",
- "prefetcher_reverse",
+ "CacheObserver",
]
[package]