]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] simplify access_ok() for all m68knommu targets
authorGreg Ungerer <gerg@snapgear.com>
Sun, 6 Jul 2003 10:20:56 +0000 (03:20 -0700)
committerLinus Torvalds <torvalds@home.osdl.org>
Sun, 6 Jul 2003 10:20:56 +0000 (03:20 -0700)
Unify access_ok for all m68knommu targets. All targets use the
common linker script and have common end symbols. So now we can
just use a simple check.

include/asm-m68knommu/uaccess.h

index 6ff1747b02e07d86efb68845382d82789a8aa95d..9f890ed45b4fd061e83249ba3cd734dd4d893e19 100644 (file)
 #define VERIFY_READ    0
 #define VERIFY_WRITE   1
 
-/* We let the MMU do all checking */
-extern inline int access_ok(int type, const void * addr, unsigned long size)
+#define access_ok(type,addr,size)      _access_ok((unsigned long)(addr),(size))
+
+static inline int _access_ok(unsigned long addr, unsigned long size)
 {
-#define        RANGE_CHECK_OK(addr, size, lower, upper) \
-       (((addr) >= (lower)) && (((addr) + (size)) < (upper)))
-
-#ifdef CONFIG_COLDFIRE
-       extern unsigned long _ramend;
-       return(RANGE_CHECK_OK((unsigned long) addr, size, 0L, _ramend) ||
-                       (is_in_rom((unsigned long) addr) &&
-                                       is_in_rom((unsigned long) addr + size)));
-#else
-       /* DAVIDM - this could be restricted a lot more */
-       return(RANGE_CHECK_OK((unsigned long)addr, size, 0, 0x10f00000));
-#endif
+       extern unsigned long memory_start, memory_end;
+
+       return (((addr >= memory_start) && (addr+size < memory_end)) ||
+               (is_in_rom(addr) && is_in_rom(addr+size)));
 }
 
 extern inline int verify_area(int type, const void * addr, unsigned long size)