patch-2.3.39 linux/arch/ppc/treeboot/misc.S
Next file: linux/arch/ppc/xmon/start.c
Previous file: linux/arch/ppc/treeboot/main.c
Back to the patch index
Back to the overall index
- Lines: 43
- Date:
Mon Jan 10 18:25:05 2000
- Orig file:
v2.3.38/linux/arch/ppc/treeboot/misc.S
- Orig date:
Tue Dec 7 09:32:42 1999
diff -u --recursive --new-file v2.3.38/linux/arch/ppc/treeboot/misc.S linux/arch/ppc/treeboot/misc.S
@@ -6,6 +6,9 @@
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/
+
+#include "../kernel/ppc_asm.tmpl"
+
.text
/*
@@ -15,14 +18,23 @@
*/
.global flush_cache
flush_cache:
- addi 4,4,0x1f /* len = (len + 0x1f) / 0x20 */
- rlwinm. 4,4,27,5,31
- mtctr 4
- beqlr
-1: dcbf 0,3
- icbi 0,3
- addi 3,3,0x20
- bdnz 1b
+ mfpvr r5 # Get processor version register
+ extrwi r5,r5,16,0 # Get the version bits
+ cmpwi cr0,r5,0x0020 # Is this a 403-based processor?
+ beq 1f # Yes, it is
+ li r5,32 # It is not a 403, set to 32 bytes
+ addi r4,r4,32-1 # len += line_size - 1
+ srwi. r4,r4,5 # Convert from bytes to lines
+ b 2f
+1: li r5,16 # It is a 403, set to 16 bytes
+ addi r4,r4,16-1 # len += line_size - 1
+ srwi. r4,r4,4 # Convert from bytes to lines
+2: mtctr r4 # Set-up the counter register
+ beqlr # If it is 0, we are done
+3: dcbf r0,r3 # Flush and invalidate the data line
+ icbi r0,r3 # Invalidate the instruction line
+ add r3,r3,r5 # Move to the next line
+ bdnz 3b # Are we done yet?
sync
isync
- blr
+ blr # Return to the caller
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)