Created
April 3, 2019 02:37
-
-
Save z4yx/6d61470c97c1c949f2212b757756b048 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
uint64_t mask = 0; | |
for(int i=0; i<2; i++){ | |
volatile uint64_t *ptr = (volatile uint64_t*)0x80100000; | |
uint64_t rnd = 12345; | |
for(; (uint64_t)ptr < 0x80800000; ptr+=1) | |
{ | |
*ptr = rnd^mask; // Write MEM | |
// if((uint64_t)ptr == 0x802a0d90){ | |
// printHex(rnd^mask); | |
// sbi_ecall_console_putc('\n'); | |
// printHex(*ptr); | |
// sbi_ecall_console_putc('\n'); | |
// } | |
rnd = rnd * 1103515245 + 12345; | |
} | |
ptr = (void*)0x80100000; | |
rnd = 12345; | |
for(; (uint64_t)ptr < 0x80800000; ptr+=1) | |
{ | |
if(*ptr != (rnd^mask)){ // Read MEM | |
sbi_ecall_console_puts("mem test fail @ 0x"); | |
printHex((uint64_t)ptr); | |
sbi_ecall_console_puts("\n "); | |
printHex(*ptr); | |
sbi_ecall_console_puts(" != "); | |
printHex(rnd^mask); | |
sbi_ecall_console_putc('\n'); | |
// while (1) | |
// wfi(); | |
} | |
rnd = rnd * 1103515245 + 12345; | |
} | |
// sbi_ecall_console_puts("mem test ok\n"); | |
mask = ~mask; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment