From 43bc61d86f8ea6edef2e02d1dc47617883fa9a9c Mon Sep 17 00:00:00 2001 From: Paul Mundt Date: Sat, 15 Aug 2009 01:57:36 +0900 Subject: sh: Add register alignment helpers for shared flushers. This plugs in some register alignment helpers for the shared flushers, allowing them to also be used on SH-5. The main rationale here is that in the SH-5 case we have a variable ABI, where the pointer size may not equal the register width. This register extension is taken care of by the SH-5 code already today, and is otherwise unused on the SH-4 code. This combines the two and allows us to kill off the SH-5 implementation. Signed-off-by: Paul Mundt --- arch/sh/mm/flush-sh4.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'arch/sh/mm/flush-sh4.c') diff --git a/arch/sh/mm/flush-sh4.c b/arch/sh/mm/flush-sh4.c index edefc53891a8..1b6b6a12a99b 100644 --- a/arch/sh/mm/flush-sh4.c +++ b/arch/sh/mm/flush-sh4.c @@ -10,10 +10,11 @@ */ void __weak __flush_wback_region(void *start, int size) { - unsigned long v, cnt, end; + reg_size_t aligned_start, v, cnt, end; - v = (unsigned long)start & ~(L1_CACHE_BYTES-1); - end = ((unsigned long)start + size + L1_CACHE_BYTES-1) + aligned_start = register_align(start); + v = aligned_start & ~(L1_CACHE_BYTES-1); + end = (aligned_start + size + L1_CACHE_BYTES-1) & ~(L1_CACHE_BYTES-1); cnt = (end - v) / L1_CACHE_BYTES; @@ -52,10 +53,11 @@ void __weak __flush_wback_region(void *start, int size) */ void __weak __flush_purge_region(void *start, int size) { - unsigned long v, cnt, end; + reg_size_t aligned_start, v, cnt, end; - v = (unsigned long)start & ~(L1_CACHE_BYTES-1); - end = ((unsigned long)start + size + L1_CACHE_BYTES-1) + aligned_start = register_align(start); + v = aligned_start & ~(L1_CACHE_BYTES-1); + end = (aligned_start + size + L1_CACHE_BYTES-1) & ~(L1_CACHE_BYTES-1); cnt = (end - v) / L1_CACHE_BYTES; @@ -90,10 +92,11 @@ void __weak __flush_purge_region(void *start, int size) */ void __weak __flush_invalidate_region(void *start, int size) { - unsigned long v, cnt, end; + reg_size_t aligned_start, v, cnt, end; - v = (unsigned long)start & ~(L1_CACHE_BYTES-1); - end = ((unsigned long)start + size + L1_CACHE_BYTES-1) + aligned_start = register_align(start); + v = aligned_start & ~(L1_CACHE_BYTES-1); + end = (aligned_start + size + L1_CACHE_BYTES-1) & ~(L1_CACHE_BYTES-1); cnt = (end - v) / L1_CACHE_BYTES; -- cgit v1.2.3