Minor refactor

This commit is contained in:
guillaume didier 2020-04-01 16:12:36 +02:00
parent 65f94dcb67
commit f8b02c4b6f
2 changed files with 17 additions and 14 deletions

View File

@ -31,12 +31,13 @@ pub enum CacheType {
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[allow(non_snake_case)]
pub struct CacheInfo {
pub cache_type: CacheType,
pub level: u8,
pub self_init: bool,
pub fully_assoc: bool,
pub maxID_for_cache: u16,
pub max_ID_for_cache: u16,
pub core_in_package: u16,
pub cache_line_size: u16,
pub physical_line_partition: u16,
@ -64,7 +65,8 @@ impl CacheInfo {
let level: u8 = (cr.eax >> 5 & 0x7) as u8;
let self_init = (cr.eax >> 8 & 0x1) != 0;
let fully_assoc = (cr.eax >> 9 & 0x1) != 0;
let maxID_for_cache = (cr.eax >> 14 & 0xfff) as u16 + 1;
#[allow(non_snake_case)]
let max_ID_for_cache = (cr.eax >> 14 & 0xfff) as u16 + 1;
let core_in_package = (cr.eax >> 26 & 0x3f) as u16 + 1;
let cache_line_size = (cr.ebx & 0xfff) as u16 + 1;
let physical_line_partition = (cr.ebx >> 12 & 0x3ff) as u16 + 1;
@ -79,7 +81,7 @@ impl CacheInfo {
level,
self_init,
fully_assoc,
maxID_for_cache,
max_ID_for_cache,
core_in_package,
cache_line_size,
physical_line_partition,

View File

@ -30,12 +30,12 @@ pub fn enable_prefetchers(status: bool) {
pub fn prefetcher_fun(
victim_4k_addr: *mut u8,
victim_2M_addr: *mut u8,
#[allow(non_snake_case)] _victim_2M_addr: *mut u8,
threshold_ff: u64,
) -> Vec<i32> {
let mut results = vec![0; 4096 / 64];
return results;
if false {
for _ in 0..N {
//unsafe { maccess(victim4kaddr) };
for j in (0..4096).step_by(64).rev() {
@ -48,5 +48,6 @@ pub fn prefetcher_fun(
}
}
}
}
results
}