From 843cf63ba9636e514fd1abf89583567a4c82798b Mon Sep 17 00:00:00 2001 From: Guillume DIDIER Date: Wed, 13 Oct 2021 15:39:05 +0200 Subject: [PATCH] Add preliminary support for IP control --- prefetcher_reverse/src/bin/ip_test.rs | 5 +++++ prefetcher_reverse/src/ip_tool.rs | 20 ++++++++++++++++++++ prefetcher_reverse/src/lib.rs | 1 + 3 files changed, 26 insertions(+) create mode 100644 prefetcher_reverse/src/bin/ip_test.rs diff --git a/prefetcher_reverse/src/bin/ip_test.rs b/prefetcher_reverse/src/bin/ip_test.rs new file mode 100644 index 0000000..ad0444b --- /dev/null +++ b/prefetcher_reverse/src/bin/ip_test.rs @@ -0,0 +1,5 @@ +use prefetcher_reverse::ip_tool::tmp_test; + +fn main() { + tmp_test(); +} diff --git a/prefetcher_reverse/src/ip_tool.rs b/prefetcher_reverse/src/ip_tool.rs index e69de29..8bb2492 100644 --- a/prefetcher_reverse/src/ip_tool.rs +++ b/prefetcher_reverse/src/ip_tool.rs @@ -0,0 +1,20 @@ +global_asm!( + ".global timed_maccess_template", + "timed_maccess_template:", + "nop", + "ret", + ".global timed_maccess_template_end", + "timed_maccess_template_end:", + "nop", +); + +extern "C" { + fn timed_maccess_template(pointer: *const u8) -> u64; + fn timed_maccess_template_end(); +} + +pub fn tmp_test() { + let size = timed_maccess_template_end as *const u8 as usize + - timed_maccess_template as *const u8 as usize; + println!("function size : {}", size); +} diff --git a/prefetcher_reverse/src/lib.rs b/prefetcher_reverse/src/lib.rs index fdd1668..4706ace 100644 --- a/prefetcher_reverse/src/lib.rs +++ b/prefetcher_reverse/src/lib.rs @@ -1,3 +1,4 @@ +#![feature(global_asm)] #![deny(unsafe_op_in_unsafe_fn)] use crate::Probe::{Flush, FullFlush, Load};