]> gitweb.factorcode.org Git - factor.git/blob - vm/cpu-ppc.linux.S
audio.engine.test: cleanup using
[factor.git] / vm / cpu-ppc.linux.S
1     .file "cpu-ppc.linux.S"
2     .section ".text"
3     .align 2
4     .globl flush_icache
5     .type flush_icache, @function
6 flush_icache:
7     add 4,4,3     # end += ptr
8 #ifdef _ARCH_PPC64
9     clrrdi 3,3,5  # ptr &= ~0x1f
10 #else
11     clrrwi 3,3,5  # ptr &= ~0x1f
12 #endif
13     sub 4,4,3     # end -= aligned_ptr
14     addi 4,4,0x1f # end += 0x1f
15 #ifdef _ARCH_PPC64
16     srdi. 4,4,5   # end >>= 5, set cr
17 #else
18     srwi. 4,4,5   # end >>= 5, set cr
19 #endif
20     beqlr
21
22     # Loop over the buffer by cache line and flush the data cache.
23     mr 5,3
24     mtctr 4
25 loop1:
26     dcbst 0,5
27     addi 5,5,0x20
28     bdnz loop1
29
30     # Synchronize to ensure the cache line flushes are complete.
31     sync
32
33     # Loop over the buffer by cache line and flush the instruction cache.
34     mr 5,3
35     mtctr 4
36 loop2:
37     icbi 0,5
38     addi 5,5,0x20
39     bdnz loop2
40
41     # Clear instruction pipeline to force reloading of instructions.
42     isync
43     blr
44
45     .size flush_icache,.-flush_icache
46     .section .note.GNU-stack,"",@progbits