Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d929b6ae authored by Chris Metcalf's avatar Chris Metcalf
Browse files

arch/tile: Use <asm-generic/syscalls.h>



With this change we now include <asm-generic/syscalls.h> into the "tile"
version of the header.  To take full advantage of the prototypes there,
we also change our naming convention for "struct pt_regs *" syscalls so
that, e.g., _sys_execve() is the "true" syscall entry, which sets the
appropriate register to point to the pt_regs before calling sys_execve().

While doing this I realized I no longer needed the fork and vfork
entry point stubs, since those functions aren't in the generic
syscall ABI, so I removed them as well.

Signed-off-by: default avatarChris Metcalf <cmetcalf@tilera.com>
parent ce0ecc8a
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -216,15 +216,16 @@ struct compat_siginfo;
struct compat_sigaltstack;
long compat_sys_execve(const char __user *path,
		       const compat_uptr_t __user *argv,
		       const compat_uptr_t __user *envp);
		       const compat_uptr_t __user *envp, struct pt_regs *);
long compat_sys_rt_sigaction(int sig, struct compat_sigaction __user *act,
			     struct compat_sigaction __user *oact,
			     size_t sigsetsize);
long compat_sys_rt_sigqueueinfo(int pid, int sig,
				struct compat_siginfo __user *uinfo);
long compat_sys_rt_sigreturn(void);
long compat_sys_rt_sigreturn(struct pt_regs *);
long compat_sys_sigaltstack(const struct compat_sigaltstack __user *uss_ptr,
			    struct compat_sigaltstack __user *uoss_ptr);
			    struct compat_sigaltstack __user *uoss_ptr,
			    struct pt_regs *);
long compat_sys_truncate64(char __user *filename, u32 dummy, u32 low, u32 high);
long compat_sys_ftruncate64(unsigned int fd, u32 dummy, u32 low, u32 high);
long compat_sys_pread64(unsigned int fd, char __user *ubuf, size_t count,
@@ -255,4 +256,12 @@ long tile_compat_sys_ptrace(compat_long_t request, compat_long_t pid,
/* Tilera Linux syscalls that don't have "compat" versions. */
#define compat_sys_flush_cache sys_flush_cache

/* These are the intvec_64.S trampolines. */
long _compat_sys_execve(const char __user *path,
			const compat_uptr_t __user *argv,
			const compat_uptr_t __user *envp);
long _compat_sys_sigaltstack(const struct compat_sigaltstack __user *uss_ptr,
			    struct compat_sigaltstack __user *uoss_ptr);
long _compat_sys_rt_sigreturn(void);

#endif /* _ASM_TILE_COMPAT_H */
+18 −55
Original line number Diff line number Diff line
@@ -32,8 +32,9 @@ extern void *compat_sys_call_table[];

/*
 * Note that by convention, any syscall which requires the current
 * register set takes an additional "struct pt_regs *" pointer; the
 * sys_xxx() function just adds the pointer and tail-calls to _sys_xxx().
 * register set takes an additional "struct pt_regs *" pointer; a
 * _sys_xxx() trampoline in intvec*.S just sets up the pointer and
 * jumps to sys_xxx().
 */

/* kernel/sys.c */
@@ -43,66 +44,17 @@ long sys32_fadvise64(int fd, u32 offset_lo, u32 offset_hi,
int sys32_fadvise64_64(int fd, u32 offset_lo, u32 offset_hi,
		       u32 len_lo, u32 len_hi, int advice);
long sys_flush_cache(void);
long sys_mmap2(unsigned long addr, unsigned long len,
	       unsigned long prot, unsigned long flags,
	       unsigned long fd, unsigned long pgoff);
#ifdef __tilegx__
long sys_mmap(unsigned long addr, unsigned long len,
	      unsigned long prot, unsigned long flags,
	      unsigned long fd, off_t pgoff);
#ifndef __tilegx__  /* No mmap() in the 32-bit kernel. */
#define sys_mmap sys_mmap
#endif

/* kernel/process.c */
long sys_clone(unsigned long clone_flags, unsigned long newsp,
	       void __user *parent_tid, void __user *child_tid);
long _sys_clone(unsigned long clone_flags, unsigned long newsp,
		void __user *parent_tid, void __user *child_tid,
		struct pt_regs *regs);
long sys_fork(void);
long _sys_fork(struct pt_regs *regs);
long sys_vfork(void);
long _sys_vfork(struct pt_regs *regs);
long sys_execve(const char __user *filename,
		const char __user *const __user *argv,
		const char __user *const __user *envp);
long _sys_execve(const char __user *filename,
		 const char __user *const __user *argv,
		 const char __user *const __user *envp, struct pt_regs *regs);

/* kernel/signal.c */
long sys_sigaltstack(const stack_t __user *, stack_t __user *);
long _sys_sigaltstack(const stack_t __user *, stack_t __user *,
		      struct pt_regs *);
long sys_rt_sigreturn(void);
long _sys_rt_sigreturn(struct pt_regs *regs);

/* platform-independent functions */
long sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize);
long sys_rt_sigaction(int sig, const struct sigaction __user *act,
		      struct sigaction __user *oact, size_t sigsetsize);

#ifndef __tilegx__
/* mm/fault.c */
int sys_cmpxchg_badaddr(unsigned long address);
int _sys_cmpxchg_badaddr(unsigned long address, struct pt_regs *);
long sys_cmpxchg_badaddr(unsigned long address, struct pt_regs *);
long _sys_cmpxchg_badaddr(unsigned long address);
#endif

#ifdef CONFIG_COMPAT
long compat_sys_execve(const char __user *path,
		       const compat_uptr_t __user *argv,
		       const compat_uptr_t __user *envp);
long _compat_sys_execve(const char __user *path,
			const compat_uptr_t __user *argv,
			const compat_uptr_t __user *envp,
			struct pt_regs *regs);
long compat_sys_sigaltstack(const struct compat_sigaltstack __user *uss_ptr,
			    struct compat_sigaltstack __user *uoss_ptr);
long _compat_sys_sigaltstack(const struct compat_sigaltstack __user *uss_ptr,
			     struct compat_sigaltstack __user *uoss_ptr,
			     struct pt_regs *regs);
long compat_sys_rt_sigreturn(void);
long _compat_sys_rt_sigreturn(struct pt_regs *regs);

/* These four are not defined for 64-bit, but serve as "compat" syscalls. */
long sys_fcntl64(unsigned int fd, unsigned int cmd, unsigned long arg);
long sys_fstat64(unsigned long fd, struct stat64 __user *statbuf);
@@ -110,4 +62,15 @@ long sys_truncate64(const char __user *path, loff_t length);
long sys_ftruncate64(unsigned int fd, loff_t length);
#endif

/* These are the intvec*.S trampolines. */
long _sys_sigaltstack(const stack_t __user *, stack_t __user *);
long _sys_rt_sigreturn(void);
long _sys_clone(unsigned long clone_flags, unsigned long newsp,
		void __user *parent_tid, void __user *child_tid);
long _sys_execve(const char __user *filename,
		 const char __user *const __user *argv,
		 const char __user *const __user *envp);

#include <asm-generic/syscalls.h>

#endif /* _ASM_TILE_SYSCALLS_H */
+6 −0
Original line number Diff line number Diff line
@@ -157,6 +157,12 @@ long tile_compat_sys_msgrcv(int msqid,
/* Pass full 64-bit values through ptrace. */
#define compat_sys_ptrace tile_compat_sys_ptrace

/* Call the trampolines to manage pt_regs where necessary. */
#define compat_sys_execve _compat_sys_execve
#define compat_sys_sigaltstack _compat_sys_sigaltstack
#define compat_sys_rt_sigreturn _compat_sys_rt_sigreturn
#define sys_clone _sys_clone

/*
 * Note that we can't include <linux/unistd.h> here since the header
 * guard will defeat us; <asm/unistd.h> checks for __SYSCALL as well.
+5 −5
Original line number Diff line number Diff line
@@ -256,7 +256,7 @@ int copy_siginfo_from_user32(siginfo_t *to, struct compat_siginfo __user *from)
	return err;
}

long _compat_sys_sigaltstack(const struct compat_sigaltstack __user *uss_ptr,
long compat_sys_sigaltstack(const struct compat_sigaltstack __user *uss_ptr,
			    struct compat_sigaltstack __user *uoss_ptr,
			    struct pt_regs *regs)
{
@@ -291,7 +291,7 @@ long _compat_sys_sigaltstack(const struct compat_sigaltstack __user *uss_ptr,
	return ret;
}

long _compat_sys_rt_sigreturn(struct pt_regs *regs)
long compat_sys_rt_sigreturn(struct pt_regs *regs)
{
	struct compat_rt_sigframe __user *frame =
		(struct compat_rt_sigframe __user *) compat_ptr(regs->sp);
@@ -312,7 +312,7 @@ long _compat_sys_rt_sigreturn(struct pt_regs *regs)
	if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &r0))
		goto badframe;

	if (_compat_sys_sigaltstack(&frame->uc.uc_stack, NULL, regs) != 0)
	if (compat_sys_sigaltstack(&frame->uc.uc_stack, NULL, regs) != 0)
		goto badframe;

	return r0;
+9 −14
Original line number Diff line number Diff line
@@ -1524,28 +1524,23 @@ STD_ENTRY_LOCAL(bad_intr)

/* Put address of pt_regs in reg and jump. */
#define PTREGS_SYSCALL(x, reg)                          \
	STD_ENTRY(x);                                   \
	STD_ENTRY(_##x);                                \
	{                                               \
	 PTREGS_PTR(reg, PTREGS_OFFSET_BASE);           \
	 j      _##x                                    \
	 j      x                                       \
	};                                              \
	STD_ENDPROC(x)
	STD_ENDPROC(_##x)

PTREGS_SYSCALL(sys_execve, r3)
PTREGS_SYSCALL(sys_sigaltstack, r2)
PTREGS_SYSCALL(sys_rt_sigreturn, r0)
PTREGS_SYSCALL(sys_cmpxchg_badaddr, r1)

/* Save additional callee-saves to pt_regs, put address in reg and jump. */
#define PTREGS_SYSCALL_ALL_REGS(x, reg)                 \
	STD_ENTRY(x);                                   \
	push_extra_callee_saves reg;                    \
	j       _##x;                                   \
	STD_ENDPROC(x)

PTREGS_SYSCALL_ALL_REGS(sys_fork, r0)
PTREGS_SYSCALL_ALL_REGS(sys_vfork, r0)
PTREGS_SYSCALL_ALL_REGS(sys_clone, r4)
PTREGS_SYSCALL_ALL_REGS(sys_cmpxchg_badaddr, r1)
/* Save additional callee-saves to pt_regs, put address in r4 and jump. */
STD_ENTRY(_sys_clone)
	push_extra_callee_saves r4
	j       sys_clone
	STD_ENDPROC(_sys_clone)

/*
 * This entrypoint is taken for the cmpxchg and atomic_update fast
Loading