2 * vDSO provided cache flush routines
4 * Copyright (C) 2004 Benjamin Herrenschmuidt (benh@kernel.crashing.org),
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
12 #include <asm/processor.h>
13 #include <asm/ppc_asm.h>
15 #include <asm/asm-offsets.h>
20 * Default "generic" version of __kernel_sync_dicache.
22 * void __kernel_sync_dicache(unsigned long start, unsigned long end)
24 * Flushes the data cache & invalidate the instruction cache for the
25 * provided range [start, end[
27 V_FUNCTION_BEGIN(__kernel_sync_dicache)
32 bl V_LOCAL_FUNC(__get_datapage)
36 lwz r7,CFG_DCACHE_BLOCKSZ(r10)
38 andc r6,r11,r5 /* round low to line bdy */
39 subf r8,r6,r4 /* compute length */
40 add r8,r8,r5 /* ensure we get enough */
41 lwz r9,CFG_DCACHE_LOGBLOCKSZ(r10)
42 srw. r8,r8,r9 /* compute line count */
44 beqlr /* nothing to do? */
51 /* Now invalidate the instruction cache */
53 lwz r7,CFG_ICACHE_BLOCKSZ(r10)
55 andc r6,r11,r5 /* round low to line bdy */
56 subf r8,r6,r4 /* compute length */
58 lwz r9,CFG_ICACHE_LOGBLOCKSZ(r10)
59 srw. r8,r8,r9 /* compute line count */
61 beqlr /* nothing to do? */
70 V_FUNCTION_END(__kernel_sync_dicache)
74 * POWER5 version of __kernel_sync_dicache
76 V_FUNCTION_BEGIN(__kernel_sync_dicache_p5)
84 V_FUNCTION_END(__kernel_sync_dicache_p5)