Commit bcd1340b authored by Anton Blanchard's avatar Anton Blanchard Committed by Linus Torvalds

[PATCH] ppc64: Remove A() and AA()

Remove the A() and AA() macros.  Now we have compat_ptr we should be using
that.
Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 890d643b
...@@ -22,9 +22,7 @@ ...@@ -22,9 +22,7 @@
#define INCLUDES #define INCLUDES
#include "compat_ioctl.c" #include "compat_ioctl.c"
#include <linux/ncp_fs.h>
#include <linux/syscalls.h> #include <linux/syscalls.h>
#include <asm/ppc32.h>
#define CODE #define CODE
#include "compat_ioctl.c" #include "compat_ioctl.c"
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include <linux/unistd.h> #include <linux/unistd.h>
#include <linux/stddef.h> #include <linux/stddef.h>
#include <linux/elf.h> #include <linux/elf.h>
#include <asm/ppc32.h>
#include <asm/sigcontext.h> #include <asm/sigcontext.h>
#include <asm/ucontext.h> #include <asm/ucontext.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
......
...@@ -72,7 +72,6 @@ ...@@ -72,7 +72,6 @@
#include <asm/semaphore.h> #include <asm/semaphore.h>
#include <asm/ppcdebug.h> #include <asm/ppcdebug.h>
#include <asm/time.h> #include <asm/time.h>
#include <asm/ppc32.h>
#include <asm/mmu_context.h> #include <asm/mmu_context.h>
#include "pci.h" #include "pci.h"
...@@ -700,7 +699,7 @@ asmlinkage int sys32_pciconfig_read(u32 bus, u32 dfn, u32 off, u32 len, u32 ubuf ...@@ -700,7 +699,7 @@ asmlinkage int sys32_pciconfig_read(u32 bus, u32 dfn, u32 off, u32 len, u32 ubuf
(unsigned long) dfn, (unsigned long) dfn,
(unsigned long) off, (unsigned long) off,
(unsigned long) len, (unsigned long) len,
(unsigned char __user *)AA(ubuf)); compat_ptr(ubuf));
} }
asmlinkage int sys32_pciconfig_write(u32 bus, u32 dfn, u32 off, u32 len, u32 ubuf) asmlinkage int sys32_pciconfig_write(u32 bus, u32 dfn, u32 off, u32 len, u32 ubuf)
...@@ -709,7 +708,7 @@ asmlinkage int sys32_pciconfig_write(u32 bus, u32 dfn, u32 off, u32 len, u32 ubu ...@@ -709,7 +708,7 @@ asmlinkage int sys32_pciconfig_write(u32 bus, u32 dfn, u32 off, u32 len, u32 ubu
(unsigned long) dfn, (unsigned long) dfn,
(unsigned long) off, (unsigned long) off,
(unsigned long) len, (unsigned long) len,
(unsigned char __user *)AA(ubuf)); compat_ptr(ubuf));
} }
#define IOBASE_BRIDGE_NUMBER 0 #define IOBASE_BRIDGE_NUMBER 0
...@@ -1095,7 +1094,7 @@ struct __sysctl_args32 { ...@@ -1095,7 +1094,7 @@ struct __sysctl_args32 {
u32 __unused[4]; u32 __unused[4];
}; };
extern asmlinkage long sys32_sysctl(struct __sysctl_args32 __user *args) asmlinkage long sys32_sysctl(struct __sysctl_args32 __user *args)
{ {
struct __sysctl_args32 tmp; struct __sysctl_args32 tmp;
int error; int error;
...@@ -1114,19 +1113,20 @@ extern asmlinkage long sys32_sysctl(struct __sysctl_args32 __user *args) ...@@ -1114,19 +1113,20 @@ extern asmlinkage long sys32_sysctl(struct __sysctl_args32 __user *args)
glibc's __sysctl uses rw memory for the structure glibc's __sysctl uses rw memory for the structure
anyway. */ anyway. */
oldlenp = (size_t __user *)addr; oldlenp = (size_t __user *)addr;
if (get_user(oldlen, (u32 __user *)A(tmp.oldlenp)) || if (get_user(oldlen, (compat_size_t __user *)compat_ptr(tmp.oldlenp)) ||
put_user(oldlen, oldlenp)) put_user(oldlen, oldlenp))
return -EFAULT; return -EFAULT;
} }
lock_kernel(); lock_kernel();
error = do_sysctl((int __user *)A(tmp.name), tmp.nlen, (void __user *)A(tmp.oldval), error = do_sysctl(compat_ptr(tmp.name), tmp.nlen,
oldlenp, (void __user *)A(tmp.newval), tmp.newlen); compat_ptr(tmp.oldval), oldlenp,
compat_ptr(tmp.newval), tmp.newlen);
unlock_kernel(); unlock_kernel();
if (oldlenp) { if (oldlenp) {
if (!error) { if (!error) {
if (get_user(oldlen, oldlenp) || if (get_user(oldlen, oldlenp) ||
put_user(oldlen, (u32 __user *)A(tmp.oldlenp))) put_user(oldlen, (compat_size_t __user *)compat_ptr(tmp.oldlenp)))
error = -EFAULT; error = -EFAULT;
} }
copy_to_user(args->__unused, tmp.__unused, sizeof(tmp.__unused)); copy_to_user(args->__unused, tmp.__unused, sizeof(tmp.__unused));
......
...@@ -14,30 +14,6 @@ ...@@ -14,30 +14,6 @@
* 2 of the License, or (at your option) any later version. * 2 of the License, or (at your option) any later version.
*/ */
/* Use this to get at 32-bit user passed pointers. */
/* Things to consider: the low-level assembly stub does
srl x, 0, x for first four arguments, so if you have
pointer to something in the first four arguments, just
declare it as a pointer, not u32. On the other side,
arguments from 5th onwards should be declared as u32
for pointers, and need AA() around each usage.
A() macro should be used for places where you e.g.
have some internal variable u32 and just want to get
rid of a compiler warning. AA() has to be used in
places where you want to convert a function argument
to 32bit pointer or when you e.g. access pt_regs
structure and want to consider 32bit registers only.
-
*/
#define A(__x) ((unsigned long)(__x))
#define AA(__x) \
({ unsigned long __ret; \
__asm__ ("clrldi %0, %0, 32" \
: "=r" (__ret) \
: "0" (__x)); \
__ret; \
})
/* These are here to support 32-bit syscalls on a 64-bit kernel. */ /* These are here to support 32-bit syscalls on a 64-bit kernel. */
typedef struct compat_siginfo { typedef struct compat_siginfo {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment