1 #include <linux/errno.h>
2 #include <linux/sched.h>
8 #include <linux/stat.h>
9 #include <linux/syscalls.h>
10 #include <linux/mman.h>
11 #include <linux/file.h>
12 #include <linux/utsname.h>
13 #include <linux/module.h>
15 #include <linux/ipc.h>
16 #include <asm/cacheflush.h>
17 #include <asm/uaccess.h>
18 #include <asm/unistd.h>
21 * sys_pipe() is the normal C calling standard for creating
22 * a pipe. It's not the way Unix traditionally does this, though.
24 asmlinkage int sys_pipe(unsigned long r4, unsigned long r5,
25 unsigned long r6, unsigned long r7,
26 struct pt_regs __regs)
28 struct pt_regs *regs = RELOC_HIDE(&__regs, 0);
34 regs->regs[1] = fd[1];
40 asmlinkage ssize_t sys_pread_wrapper(unsigned int fd, char * buf,
41 size_t count, long dummy, loff_t pos)
43 return sys_pread64(fd, buf, count, pos);
46 asmlinkage ssize_t sys_pwrite_wrapper(unsigned int fd, const char * buf,
47 size_t count, long dummy, loff_t pos)
49 return sys_pwrite64(fd, buf, count, pos);
52 asmlinkage int sys_fadvise64_64_wrapper(int fd, u32 offset0, u32 offset1,
53 u32 len0, u32 len1, int advice)
55 #ifdef __LITTLE_ENDIAN__
56 return sys_fadvise64_64(fd, (u64)offset1 << 32 | offset0,
57 (u64)len1 << 32 | len0, advice);
59 return sys_fadvise64_64(fd, (u64)offset0 << 32 | offset1,
60 (u64)len0 << 32 | len1, advice);
64 #if defined(CONFIG_CPU_SH2) || defined(CONFIG_CPU_SH2A)
65 #define SYSCALL_ARG3 "trapa #0x23"
67 #define SYSCALL_ARG3 "trapa #0x13"
71 * Do a system call from kernel instead of calling sys_execve so we
72 * end up with proper pt_regs.
74 int kernel_execve(const char *filename, char *const argv[], char *const envp[])
76 register long __sc0 __asm__ ("r3") = __NR_execve;
77 register long __sc4 __asm__ ("r4") = (long) filename;
78 register long __sc5 __asm__ ("r5") = (long) argv;
79 register long __sc6 __asm__ ("r6") = (long) envp;
80 __asm__ __volatile__ (SYSCALL_ARG3 : "=z" (__sc0)
81 : "0" (__sc0), "r" (__sc4), "r" (__sc5), "r" (__sc6)