aboutsummaryrefslogtreecommitdiffstats
path: root/arch/hexagon/kernel/syscall.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/hexagon/kernel/syscall.c')
-rw-r--r--arch/hexagon/kernel/syscall.c46
1 files changed, 2 insertions, 44 deletions
diff --git a/arch/hexagon/kernel/syscall.c b/arch/hexagon/kernel/syscall.c
index 25a9bfe3445d..d2cc3270af3e 100644
--- a/arch/hexagon/kernel/syscall.c
+++ b/arch/hexagon/kernel/syscall.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Hexagon system calls 2 * Hexagon system calls
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 and 7 * it under the terms of the GNU General Public License version 2 and
@@ -35,55 +35,13 @@
35 * See signal.c for signal-related system call wrappers. 35 * See signal.c for signal-related system call wrappers.
36 */ 36 */
37 37
38asmlinkage int sys_execve(char __user *ufilename,
39 const char __user *const __user *argv,
40 const char __user *const __user *envp)
41{
42 struct pt_regs *pregs = current_thread_info()->regs;
43 struct filename *filename;
44 int retval;
45
46 filename = getname(ufilename);
47 retval = PTR_ERR(filename);
48 if (IS_ERR(filename))
49 return retval;
50
51 retval = do_execve(filename->name, argv, envp, pregs);
52 putname(filename);
53
54 return retval;
55}
56
57asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp, 38asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp,
58 unsigned long parent_tidp, unsigned long child_tidp) 39 unsigned long parent_tidp, unsigned long child_tidp)
59{ 40{
60 struct pt_regs *pregs = current_thread_info()->regs; 41 struct pt_regs *pregs = current_pt_regs();
61 42
62 if (!newsp) 43 if (!newsp)
63 newsp = pregs->SP; 44 newsp = pregs->SP;
64 return do_fork(clone_flags, newsp, pregs, 0, (int __user *)parent_tidp, 45 return do_fork(clone_flags, newsp, pregs, 0, (int __user *)parent_tidp,
65 (int __user *)child_tidp); 46 (int __user *)child_tidp);
66} 47}
67
68/*
69 * Do a system call from the kernel, so as to have a proper pt_regs
70 * and recycle the sys_execvpe infrustructure.
71 */
72int kernel_execve(const char *filename,
73 const char *const argv[], const char *const envp[])
74{
75 register unsigned long __a0 asm("r0") = (unsigned long) filename;
76 register unsigned long __a1 asm("r1") = (unsigned long) argv;
77 register unsigned long __a2 asm("r2") = (unsigned long) envp;
78 int retval;
79
80 __asm__ volatile(
81 " R6 = #%4;\n"
82 " trap0(#1);\n"
83 " %0 = R0;\n"
84 : "=r" (retval)
85 : "r" (__a0), "r" (__a1), "r" (__a2), "i" (__NR_execve)
86 );
87
88 return retval;
89}