part2 ver 0.5.0

This commit is contained in:
ClF3 2024-11-04 21:00:04 +08:00
parent 29b495c6b9
commit 5d0fb9c694
1 changed files with 9 additions and 3 deletions

View File

@ -15,6 +15,7 @@
int main() { int main() {
int index = -1; int index = -1;
int flag = -1; int flag = -1;
int maybe_flag= -1;
CYCLES time = -1; CYCLES time = -1;
int offset = 0; int offset = 0;
int new_offset = 0; int new_offset = 0;
@ -36,9 +37,14 @@ int main() {
} }
time = measure_one_block_access_time((ADDR_PTR)buf + offset * 128); time = measure_one_block_access_time((ADDR_PTR)buf + offset * 128);
if(time < CACHE_HIT_THRESHOLD) { if(time < CACHE_HIT_THRESHOLD) {
flag = offset; if(offset == maybe_flag) {
index = i; flag = offset;
break; index = i;
break;
}
else {
maybe_flag = offset;
}
} }
} }
printf("Flag: %d\n", flag); printf("Flag: %d\n", flag);