diff options
Diffstat (limited to 'arch/um/kernel/exec_kern.c')
-rw-r--r-- | arch/um/kernel/exec_kern.c | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/arch/um/kernel/exec_kern.c b/arch/um/kernel/exec_kern.c new file mode 100644 index 000000000000..49ddabe69be7 --- /dev/null +++ b/arch/um/kernel/exec_kern.c | |||
@@ -0,0 +1,91 @@ | |||
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 "2_5compat.h" | ||
20 | #include "os.h" | ||
21 | #include "time_user.h" | ||
22 | #include "choose-mode.h" | ||
23 | #include "mode_kern.h" | ||
24 | |||
25 | void flush_thread(void) | ||
26 | { | ||
27 | CHOOSE_MODE(flush_thread_tt(), flush_thread_skas()); | ||
28 | } | ||
29 | |||
30 | void start_thread(struct pt_regs *regs, unsigned long eip, unsigned long esp) | ||
31 | { | ||
32 | CHOOSE_MODE_PROC(start_thread_tt, start_thread_skas, regs, eip, esp); | ||
33 | } | ||
34 | |||
35 | extern void log_exec(char **argv, void *tty); | ||
36 | |||
37 | static long execve1(char *file, char __user * __user *argv, | ||
38 | char *__user __user *env) | ||
39 | { | ||
40 | long error; | ||
41 | |||
42 | #ifdef CONFIG_TTY_LOG | ||
43 | log_exec(argv, current->tty); | ||
44 | #endif | ||
45 | error = do_execve(file, argv, env, ¤t->thread.regs); | ||
46 | if (error == 0){ | ||
47 | task_lock(current); | ||
48 | current->ptrace &= ~PT_DTRACE; | ||
49 | task_unlock(current); | ||
50 | set_cmdline(current_cmd()); | ||
51 | } | ||
52 | return(error); | ||
53 | } | ||
54 | |||
55 | long um_execve(char *file, char __user *__user *argv, char __user *__user *env) | ||
56 | { | ||
57 | long err; | ||
58 | |||
59 | err = execve1(file, argv, env); | ||
60 | if(!err) | ||
61 | do_longjmp(current->thread.exec_buf, 1); | ||
62 | return(err); | ||
63 | } | ||
64 | |||
65 | long sys_execve(char *file, char __user *__user *argv, | ||
66 | char __user *__user *env) | ||
67 | { | ||
68 | long error; | ||
69 | char *filename; | ||
70 | |||
71 | lock_kernel(); | ||
72 | filename = getname((char __user *) file); | ||
73 | error = PTR_ERR(filename); | ||
74 | if (IS_ERR(filename)) goto out; | ||
75 | error = execve1(filename, argv, env); | ||
76 | putname(filename); | ||
77 | out: | ||
78 | unlock_kernel(); | ||
79 | return(error); | ||
80 | } | ||
81 | |||
82 | /* | ||
83 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
84 | * Emacs will notice this stuff at the end of the file and automatically | ||
85 | * adjust the settings for this buffer only. This must remain at the end | ||
86 | * of the file. | ||
87 | * --------------------------------------------------------------------------- | ||
88 | * Local variables: | ||
89 | * c-file-style: "linux" | ||
90 | * End: | ||
91 | */ | ||