]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
sh: Consolidate addr/access_ok across mmu/nommu on 32bit.
authorPaul Mundt <lethal@linux-sh.org>
Tue, 3 Jun 2008 10:38:22 +0000 (19:38 +0900)
committerPaul Mundt <lethal@linux-sh.org>
Mon, 28 Jul 2008 09:10:29 +0000 (18:10 +0900)
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
include/asm-sh/uaccess_32.h

index 0795ee5919d1f7b69d09ba3900addba27afef12c..44abd16823294209279499f8f8f3384c093ddb2f 100644 (file)
 #define VERIFY_READ    0
 #define VERIFY_WRITE   1
 
-
-#if !defined(CONFIG_MMU)
-/* NOMMU is always true */
-#define __addr_ok(addr) (1)
-
-/*
- * __access_ok: Check if address with size is OK or not.
- *
- * If we don't have an MMU (or if its disabled) the only thing we really have
- * to look out for is if the address resides somewhere outside of what
- * available RAM we have.
- */
-static inline int __access_ok(unsigned long addr, unsigned long size)
-{
-       return 1;
-}
-#else /* CONFIG_MMU */
 #define __addr_ok(addr) \
-       ((unsigned long)(addr) < (current_thread_info()->addr_limit.seg))
-
+       ((unsigned long __force)(addr) < current_thread_info()->addr_limit.seg)
 
 /*
  * __access_ok: Check if address with size is OK or not.
@@ -48,23 +30,8 @@ static inline int __access_ok(unsigned long addr, unsigned long size)
  * sum := addr + size;  carry? --> flag = true;
  * if (sum >= addr_limit) flag = true;
  */
-static inline int __access_ok(unsigned long addr, unsigned long size)
-{
-       unsigned long flag, sum;
-
-       __asm__("clrt\n\t"
-               "addc   %3, %1\n\t"
-               "movt   %0\n\t"
-               "cmp/hi %4, %1\n\t"
-               "rotcl  %0"
-               :"=&r" (flag), "=r" (sum)
-               :"1" (addr), "r" (size),
-                "r" (current_thread_info()->addr_limit.seg)
-               :"t");
-       return flag == 0;
-}
-#endif /* CONFIG_MMU */
-
+#define __access_ok(addr, size)                \
+       (__addr_ok((addr) + (size)))
 #define access_ok(type, addr, size)    \
        (__chk_user_ptr(addr),          \
         __access_ok((unsigned long __force)(addr), (size)))