| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* | 
| Paul Mundt | bcb28e4 | 2007-11-20 15:50:59 +0900 | [diff] [blame] | 2 | * arch/sh/kernel/sys_sh64.c | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | * | 
|  | 4 | * Copyright (C) 2000, 2001  Paolo Alberelli | 
|  | 5 | * | 
|  | 6 | * This file contains various random system calls that | 
|  | 7 | * have a non-standard calling sequence on the Linux/SH5 | 
|  | 8 | * platform. | 
|  | 9 | * | 
| Paul Mundt | bcb28e4 | 2007-11-20 15:50:59 +0900 | [diff] [blame] | 10 | * This file is subject to the terms and conditions of the GNU General Public | 
|  | 11 | * License.  See the file "COPYING" in the main directory of this archive | 
|  | 12 | * for more details. | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14 | #include <linux/errno.h> | 
|  | 15 | #include <linux/rwsem.h> | 
|  | 16 | #include <linux/sched.h> | 
|  | 17 | #include <linux/mm.h> | 
| Paul Mundt | 78d9827 | 2007-07-31 13:03:02 +0900 | [diff] [blame] | 18 | #include <linux/fs.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 | #include <linux/smp.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | #include <linux/sem.h> | 
|  | 21 | #include <linux/msg.h> | 
|  | 22 | #include <linux/shm.h> | 
|  | 23 | #include <linux/stat.h> | 
|  | 24 | #include <linux/mman.h> | 
|  | 25 | #include <linux/file.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | #include <linux/syscalls.h> | 
| Adrian Bunk | cba4fbb | 2007-10-16 23:29:24 -0700 | [diff] [blame] | 27 | #include <linux/ipc.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 28 | #include <asm/uaccess.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 | #include <asm/ptrace.h> | 
| Arnd Bergmann | fe74290 | 2006-10-02 02:18:34 -0700 | [diff] [blame] | 30 | #include <asm/unistd.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 | /* | 
| Arnd Bergmann | fe74290 | 2006-10-02 02:18:34 -0700 | [diff] [blame] | 33 | * Do a system call from kernel instead of calling sys_execve so we | 
|  | 34 | * end up with proper pt_regs. | 
|  | 35 | */ | 
| David Howells | d762746 | 2010-08-17 23:52:56 +0100 | [diff] [blame] | 36 | int kernel_execve(const char *filename, | 
|  | 37 | const char *const argv[], | 
|  | 38 | const char *const envp[]) | 
| Arnd Bergmann | fe74290 | 2006-10-02 02:18:34 -0700 | [diff] [blame] | 39 | { | 
|  | 40 | register unsigned long __sc0 __asm__ ("r9") = ((0x13 << 16) | __NR_execve); | 
|  | 41 | register unsigned long __sc2 __asm__ ("r2") = (unsigned long) filename; | 
|  | 42 | register unsigned long __sc3 __asm__ ("r3") = (unsigned long) argv; | 
|  | 43 | register unsigned long __sc4 __asm__ ("r4") = (unsigned long) envp; | 
|  | 44 | __asm__ __volatile__ ("trapa	%1 !\t\t\t execve(%2,%3,%4)" | 
|  | 45 | : "=r" (__sc0) | 
|  | 46 | : "r" (__sc0), "r" (__sc2), "r" (__sc3), "r" (__sc4) ); | 
|  | 47 | __asm__ __volatile__ ("!dummy	%0 %1 %2 %3" | 
|  | 48 | : : "r" (__sc0), "r" (__sc2), "r" (__sc3), "r" (__sc4) : "memory"); | 
|  | 49 | return __sc0; | 
|  | 50 | } |