[PATCH] sys_move_pages: 32bit support (i386, x86_64)
authorChristoph Lameter <clameter@sgi.com>
Fri, 23 Jun 2006 09:03:56 +0000 (02:03 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 23 Jun 2006 14:42:53 +0000 (07:42 -0700)
sys_move_pages() support for 32bit (i386 plus x86_64 compat layer)

Add support for move_pages() on i386 and also add the compat functions
necessary to run 32 bit binaries on x86_64.

Add compat_sys_move_pages to the x86_64 32bit binary layer.  Note that it is
not up to date so I added the missing pieces.  Not sure if this is done the
right way.

[akpm@osdl.org: compile fix]
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Cc: Andi Kleen <ak@muc.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/i386/kernel/syscall_table.S
arch/x86_64/ia32/ia32entry.S
include/asm-i386/unistd.h
include/linux/syscalls.h
kernel/compat.c
kernel/sys_ni.c

index af56987f69b02503c82cdc2a48660f56db02153a..dd63d4775398a301341063458a19d1a24e202279 100644 (file)
@@ -316,3 +316,4 @@ ENTRY(sys_call_table)
        .long sys_sync_file_range
        .long sys_tee                   /* 315 */
        .long sys_vmsplice
+       .long sys_move_pages
index 5a92fed2d1d5a853b8d04c4162ae6d3c15bf709b..4ec594ab1a9819777f7c58337cc3741b05274c42 100644 (file)
@@ -696,4 +696,5 @@ ia32_sys_call_table:
        .quad sys_sync_file_range
        .quad sys_tee
        .quad compat_sys_vmsplice
+       .quad compat_sys_move_pages
 ia32_syscall_end:              
index de2ccc149e3406008eb516141754c12a5ed411d8..fc1c8ddae149830a0442e8e9cb7609068c0792cb 100644 (file)
 #define __NR_sync_file_range   314
 #define __NR_tee               315
 #define __NR_vmsplice          316
+#define __NR_move_pages                317
 
 #ifdef __KERNEL__
 
-#define NR_syscalls 317
+#define NR_syscalls 318
 
 /*
  * user-visible error numbers are in the range -1 - -128: see
index 7e3f23490918cbd38df83a3bbed209fefeaa9c7b..e42738c69166fe592181c3d3405d865528de68b5 100644 (file)
@@ -521,6 +521,11 @@ asmlinkage long sys_move_pages(pid_t pid, unsigned long nr_pages,
                                const int __user *nodes,
                                int __user *status,
                                int flags);
+asmlinkage long compat_sys_move_pages(pid_t pid, unsigned long nr_page,
+                               void __user *pages,
+                               const int __user *nodes,
+                               int __user *status,
+                               int flags);
 asmlinkage long sys_mbind(unsigned long start, unsigned long len,
                                unsigned long mode,
                                unsigned long __user *nmask,
index c1601a84f8d8d4c667fe656a2dd343e49f6b78cf..ccea93e28954fb5594eaef0b8982d4ef98ad977d 100644 (file)
@@ -21,6 +21,7 @@
 #include <linux/unistd.h>
 #include <linux/security.h>
 #include <linux/timex.h>
+#include <linux/migrate.h>
 
 #include <asm/uaccess.h>
 
@@ -934,3 +935,25 @@ asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp)
 
        return ret;
 }
+
+#ifdef CONFIG_NUMA
+asmlinkage long compat_sys_move_pages(pid_t pid, unsigned long nr_pages,
+               void __user *pages32,
+               const int __user *nodes,
+               int __user *status,
+               int flags)
+{
+       const void __user * __user *pages;
+       int i;
+
+       pages = compat_alloc_user_space(nr_pages * sizeof(void *));
+       for (i = 0; i < nr_pages; i++) {
+               compat_uptr_t p;
+
+               if (get_user(p, (compat_uptr_t *)(pages32 + i)) ||
+                       put_user(compat_ptr(p), pages + i))
+                       return -EFAULT;
+       }
+       return sys_move_pages(pid, nr_pages, pages, nodes, status, flags);
+}
+#endif
index 597229749dec68e1ea6926cf44a6db250271ec1a..6991bece67e8e7609e5d18920183246e0e007143 100644 (file)
@@ -133,3 +133,4 @@ cond_syscall(sys_mincore);
 cond_syscall(sys_madvise);
 cond_syscall(sys_mremap);
 cond_syscall(sys_remap_file_pages);
+cond_syscall(compat_sys_move_pages);