gdbinvalicache.s
832 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
#include <asm.h>
#include <regdef.h>
#include <R4300.h>
/*
* gdbInvalICache(void *addr, int nbytes)
*/
LEAF(gdbInvalICache)
#ifndef __sgi__
.set mips3
#endif
blez a1,2f # If nbytes <= 0, bail
li t3,ICACHE_SIZE
bgeu a1,t3,3f # Is nbytes >= I-Cache size?
move t0,a0
addu t1,a0,a1
bgeu t0,t1,2f # (Check for address wrap)
subu t1,ICACHE_LINESIZE
andi t2,t0,ICACHE_LINEMASK
subu t0,t2
1:
.set noreorder
cache CACH_PI|C_HINV,0(t0) # If not, use hit invalidate
bltu t0,t1,1b # only on given range
addu t0,ICACHE_LINESIZE
.set reorder
2:
j ra
3:
li t0,K0BASE
addu t1,t0,t3
subu t1,ICACHE_LINESIZE
4:
.set noreorder
cache CACH_PI|C_IINV,0(t0) # If so, use index invalidate on
bltu t0,t1,4b # entire cache
addu t0,ICACHE_LINESIZE
.set reorder
j ra
#ifndef __sgi__
.set mips0
#endif
END(gdbInvalICache)