]> pilppa.org Git - linux-2.6-omap-h63xx.git/blob - arch/um/kernel/exec_kern.c
Merge branch 'mv-merge'
[linux-2.6-omap-h63xx.git] / arch / um / kernel / exec_kern.c
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
23 void flush_thread(void)
24 {
25         CHOOSE_MODE(flush_thread_tt(), flush_thread_skas());
26 }
27
28 void start_thread(struct pt_regs *regs, unsigned long eip, unsigned long esp)
29 {
30         CHOOSE_MODE_PROC(start_thread_tt, start_thread_skas, regs, eip, esp);
31 }
32
33 static long execve1(char *file, char __user * __user *argv,
34                     char __user *__user *env)
35 {
36         long error;
37
38 #ifdef CONFIG_TTY_LOG
39         log_exec(argv, current->tty);
40 #endif
41         error = do_execve(file, argv, env, &current->thread.regs);
42         if (error == 0){
43                 task_lock(current);
44                 current->ptrace &= ~PT_DTRACE;
45                 task_unlock(current);
46                 set_cmdline(current_cmd());
47         }
48         return(error);
49 }
50
51 long um_execve(char *file, char __user *__user *argv, char __user *__user *env)
52 {
53         long err;
54
55         err = execve1(file, argv, env);
56         if(!err)
57                 do_longjmp(current->thread.exec_buf, 1);
58         return(err);
59 }
60
61 long sys_execve(char *file, char __user *__user *argv,
62                 char __user *__user *env)
63 {
64         long error;
65         char *filename;
66
67         lock_kernel();
68         filename = getname((char __user *) file);
69         error = PTR_ERR(filename);
70         if (IS_ERR(filename)) goto out;
71         error = execve1(filename, argv, env);
72         putname(filename);
73  out:
74         unlock_kernel();
75         return(error);
76 }
77
78 /*
79  * Overrides for Emacs so that we follow Linus's tabbing style.
80  * Emacs will notice this stuff at the end of the file and automatically
81  * adjust the settings for this buffer only.  This must remain at the end
82  * of the file.
83  * ---------------------------------------------------------------------------
84  * Local variables:
85  * c-file-style: "linux"
86  * End:
87  */