tlbprobe.c
931 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include <R4300.h>
#include <ultra64.h>
/*
#include "setjmp.h"
*/
#include "cpu.h"
/*
* See if all the tlb slots respond to probes upon address match.
*/
s32
tlbProbe(s32 *pt)
{
s32 error = 0;
s32 i;
s32 index;
u32 tlblo_attrib = TLBLO_V | TLBLO_UNCACHED;
XDEBUG(PRINTF("TLB probe test\n"));
for (i = 0; i < NTLBENTRIES; i++) {
tlbwired(i, 0, i * PAGESIZE * 2,
(pt[i * 2] >> 6) | tlblo_attrib,
(pt[i * 2 + 1] >> 6) | tlblo_attrib);
index = probe_tlb(i * PAGESIZE * 2, 0);
if (index != i) {
XDEBUG(PRINTF (
"ERR: Index probed, Exp: 0x%08x, Act: 0x%8x\n",
i, index));
error++;
}
index = probe_tlb((i * 2 + 1) * PAGESIZE, 0);
if (index != i) {
XDEBUG(PRINTF (
"ERR: Index probed, Exp: 0x%08x, Act: 0x%8x\n",
i, index));
error++;
}
osUnmapTLB(i);
}
XDEBUG(PRINTF("******** Test DONE with %d errors ********\n",
error));
return error;
}