aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/kernel/exec.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um/kernel/exec.c')
-rw-r--r--arch/um/kernel/exec.c86
1 files changed, 86 insertions, 0 deletions
diff --git a/arch/um/kernel/exec.c b/arch/um/kernel/exec.c
new file mode 100644
index 000000000000..fc38a6d5906d
--- /dev/null
+++ b/arch/um/kernel/exec.c
@@ -0,0 +1,86 @@
1/*
2 * Copyright (C) 2000, 2001 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#include "linux/slab.h"
7#include "linux/smp_lock.h"
8#include "linux/ptrace.h"
9#include "asm/ptrace.h"
10#include "asm/pgtable.h"
11#include "asm/tlbflush.h"
12#include "asm/uaccess.h"
13#include "user_util.h"
14#include "kern_util.h"
15#include "mem_user.h"
16#include "kern.h"
17#include "irq_user.h"
18#include "tlb.h"
19#include "os.h"
20#include "choose-mode.h"
21#include "mode_kern.h"
22
23void flush_thread(void)
24{
25 arch_flush_thread(&current->thread.arch);
26 CHOOSE_MODE(flush_thread_tt(), flush_thread_skas());
27}
28
29void start_thread(struct pt_regs *regs, unsigned long eip, unsigned long esp)
30{
31 CHOOSE_MODE_PROC(start_thread_tt, start_thread_skas, regs, eip, esp);
32}
33
34#ifdef CONFIG_TTY_LOG
35extern void log_exec(char **argv, void *tty);
36#endif
37
38static long execve1(char *file, char __user * __user *argv,
39 char __user *__user *env)
40{
41 long error;
42
43#ifdef CONFIG_TTY_LOG
44 task_lock(current);
45 log_exec(argv, current->signal->tty);
46 task_unlock(current);
47#endif
48 error = do_execve(file, argv, env, &current->thread.regs);
49 if (error == 0){
50 task_lock(current);
51 current->ptrace &= ~PT_DTRACE;
52#ifdef SUBARCH_EXECVE1
53 SUBARCH_EXECVE1(&current->thread.regs.regs);
54#endif
55 task_unlock(current);
56 set_cmdline(current_cmd());
57 }
58 return(error);
59}
60
61long um_execve(char *file, char __user *__user *argv, char __user *__user *env)
62{
63 long err;
64
65 err = execve1(file, argv, env);
66 if(!err)
67 do_longjmp(current->thread.exec_buf, 1);
68 return(err);
69}
70
71long sys_execve(char __user *file, char __user *__user *argv,
72 char __user *__user *env)
73{
74 long error;
75 char *filename;
76
77 lock_kernel();
78 filename = getname(file);
79 error = PTR_ERR(filename);
80 if (IS_ERR(filename)) goto out;
81 error = execve1(filename, argv, env);
82 putname(filename);
83 out:
84 unlock_kernel();
85 return(error);
86}