]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
m68k: Wire up clone3() syscall
authorKars de Jong <jongk@linux-m68k.org>
Sun, 24 Nov 2019 19:52:25 +0000 (20:52 +0100)
committerGeert Uytterhoeven <geert@linux-m68k.org>
Sun, 12 Jan 2020 15:49:20 +0000 (16:49 +0100)
Wire up the clone3() syscall for m68k. The special entry point is done in
assembler as was done for clone() as well. This is needed because all
registers need to be saved. The C wrapper then calls the generic
sys_clone3() with the correct arguments.

Tested on A1200 using the simple test program from:

  https://lore.kernel.org/lkml/20190716130631.tohj4ub54md25dys@brauner.io/

Signed-off-by: Kars de Jong <jongk@linux-m68k.org>
Link: https://lore.kernel.org/r/20191124195225.31230-1-jongk@linux-m68k.org
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
arch/m68k/include/asm/unistd.h
arch/m68k/kernel/entry.S
arch/m68k/kernel/process.c
arch/m68k/kernel/syscalls/syscall.tbl

index 2e0047cf86f838487ceb84a5e78e80f3bc2316c6..4ae52414cd9d4392e509d0301161ac28b4d44956 100644 (file)
@@ -30,5 +30,6 @@
 #define __ARCH_WANT_SYS_SIGPROCMASK
 #define __ARCH_WANT_SYS_FORK
 #define __ARCH_WANT_SYS_VFORK
+#define __ARCH_WANT_SYS_CLONE3
 
 #endif /* _ASM_M68K_UNISTD_H_ */
index 97cd3ea5f10b837949b124024951912d6973e8f6..9dd76fbb7c6b2752b0a8eefb847a65e2f26251b1 100644 (file)
@@ -69,6 +69,13 @@ ENTRY(__sys_vfork)
        lea     %sp@(24),%sp
        rts
 
+ENTRY(__sys_clone3)
+       SAVE_SWITCH_STACK
+       pea     %sp@(SWITCH_STACK_SIZE)
+       jbsr    m68k_clone3
+       lea     %sp@(28),%sp
+       rts
+
 ENTRY(sys_sigreturn)
        SAVE_SWITCH_STACK
        movel   %sp,%sp@-                 | switch_stack pointer
index 4e77a06735c1b8a8d591bee7bde4677495307ef3..22e6b8f4f9582aa4ab6231ffe9c19bebe8baa70e 100644 (file)
@@ -30,8 +30,9 @@
 #include <linux/init_task.h>
 #include <linux/mqueue.h>
 #include <linux/rcupdate.h>
-
+#include <linux/syscalls.h>
 #include <linux/uaccess.h>
+
 #include <asm/traps.h>
 #include <asm/machdep.h>
 #include <asm/setup.h>
@@ -119,6 +120,16 @@ asmlinkage int m68k_clone(struct pt_regs *regs)
                       (int __user *)regs->d3, (int __user *)regs->d4);
 }
 
+/*
+ * Because extra registers are saved on the stack after the sys_clone3()
+ * arguments, this C wrapper extracts them from pt_regs * and then calls the
+ * generic sys_clone3() implementation.
+ */
+asmlinkage int m68k_clone3(struct pt_regs *regs)
+{
+       return sys_clone3((struct clone_args __user *)regs->d1, regs->d2);
+}
+
 int copy_thread(unsigned long clone_flags, unsigned long usp,
                 unsigned long arg, struct task_struct *p)
 {
index a88a285a0e5f6c5ca724ad27c36b59b362f0b988..a00a5d0db602fba71725ecb897538dacfe48fbfb 100644 (file)
 432    common  fsmount                         sys_fsmount
 433    common  fspick                          sys_fspick
 434    common  pidfd_open                      sys_pidfd_open
-# 435 reserved for clone3
+435    common  clone3                          __sys_clone3