aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Li <li.davidm96@gmail.com>2016-01-14 18:06:53 -0700
committerDavid Li <li.davidm96@gmail.com>2016-01-14 18:06:53 -0700
commit86a76b0825c200ebedd7a5914154a94ad16fa662 (patch)
treed008cd709399d778dbd345286bf40469a6b71ef1
parent7d5bd0af1e24372582c30f3ae3574b28db54505d (diff)
Properly check for write traps
-rw-r--r--devkit/masochist.c6
-rw-r--r--src/shareable_cache.rs3
2 files changed, 6 insertions, 3 deletions
diff --git a/devkit/masochist.c b/devkit/masochist.c
index a1dc18c..aac2fc8 100644
--- a/devkit/masochist.c
+++ b/devkit/masochist.c
@@ -2,7 +2,7 @@
void __start(int core_id, unsigned char payload) {
volatile char *ptr = (volatile char*) HOME_DATA;
- while (1) {
- ptr[0] = WRITE_TRAP;
- }
+ volatile int *ptr2 = (volatile int*) HOME_DATA;
+ ptr[core_id] = WRITE_TRAP;
+ ptr2[0] = 0;
}
diff --git a/src/shareable_cache.rs b/src/shareable_cache.rs
index a4c993b..f6c76f6 100644
--- a/src/shareable_cache.rs
+++ b/src/shareable_cache.rs
@@ -54,6 +54,8 @@ macro_rules! check_traps {
let mut num_traps_hit = 0;
let iter = old_bytes.iter()
+ // Skip {offset} bytes
+ .skip(($address.0 & 0x3) as usize)
.take(new_bytes.len())
.enumerate();
for (offset, old) in iter {
@@ -72,6 +74,7 @@ macro_rules! check_traps {
}
if num_traps_hit > 0 {
+ println!("Checking for traps: {:?} vs {:?}", old_bytes, new_bytes);
info!("[memory] core {}: {} write trap(s) hit at address {:x},\
stalling for 1_000_000 cycles each",
$core_id, num_traps_hit, $address);