Add missing files

This commit is contained in:
GuillaumeDIDIER 2020-09-22 14:36:07 +02:00
parent 26b37fdfde
commit 11d1ea28f2
3 changed files with 67 additions and 0 deletions

View File

@ -0,0 +1,9 @@
Core 2 :
MSR 0x1A0 [9] HW prfetcher disable
MSR 0x1A0 [19] Adjacent Cache line HW prfetcher disable
MSR 0x1A0 [37] DCU HW prfetcher disable
MSR 0x1A0 [39] IP HW prfetcher disable
Sandy Bridge
MSR 0x1A4 (420) [0,1,2,3] various prefetcher disable

9
aes-t-tables/setup.sh Normal file
View File

@ -0,0 +1,9 @@
# For citron vert or Cyber cobaye - run with sudo
# disable prefetchers
wrmsr -a 420 15
# performance cpu frequency governor
cpupower frequency-set -g performance
# No Turbo Boost
echo 1 > /sys/devices/system/cpu/intel_pstate/no_turbo

View File

@ -0,0 +1,49 @@
use crate::{CacheStatus, ChannelFatalError, SideChannelError, SingleAddrCacheSideChannel};
use cache_utils::calibration::only_reload;
use cache_utils::flush;
#[derive(Debug)]
pub struct NaiveFlushAndReload {
pub threshold: u64,
current: Option<*const u8>,
}
impl NaiveFlushAndReload {
pub fn from_threshold(threshold: u64) -> Self {
NaiveFlushAndReload {
threshold,
current: None,
}
}
}
impl SingleAddrCacheSideChannel for NaiveFlushAndReload {
fn test_single(&mut self, addr: *const u8) -> Result<CacheStatus, SideChannelError> {
if self.current != Some(addr) {
panic!(); // FIXME
}
let t = unsafe { only_reload(addr) };
if t > self.threshold {
Ok(CacheStatus::Miss)
} else {
Ok(CacheStatus::Hit)
}
}
fn prepare_single(&mut self, addr: *const u8) -> Result<(), SideChannelError> {
unsafe { flush(addr) };
self.current = Some(addr);
Ok(())
}
fn victim_single(&mut self, operation: &dyn Fn()) {
operation()
}
fn calibrate_single(
&mut self,
_addresses: impl IntoIterator<Item = *const u8>,
) -> Result<(), ChannelFatalError> {
Ok(())
}
}