ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.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 "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 static int execve1(char *file, char **argv, char **env)
36 {
37         int error;
38
39         error = do_execve(file, argv, env, &current->thread.regs);
40         if (error == 0){
41                 current->ptrace &= ~PT_DTRACE;
42                 set_cmdline(current_cmd());
43         }
44         return(error);
45 }
46
47 int um_execve(char *file, char **argv, char **env)
48 {
49         int err;
50
51         err = execve1(file, argv, env);
52         if(!err) 
53                 do_longjmp(current->thread.exec_buf, 1);
54         return(err);
55 }
56
57 int sys_execve(char *file, char **argv, char **env)
58 {
59         int error;
60         char *filename;
61
62         lock_kernel();
63         filename = getname((char *) file);
64         error = PTR_ERR(filename);
65         if (IS_ERR(filename)) goto out;
66         error = execve1(filename, argv, env);
67         putname(filename);
68  out:
69         unlock_kernel();
70         return(error);
71 }
72
73 /*
74  * Overrides for Emacs so that we follow Linus's tabbing style.
75  * Emacs will notice this stuff at the end of the file and automatically
76  * adjust the settings for this buffer only.  This must remain at the end
77  * of the file.
78  * ---------------------------------------------------------------------------
79  * Local variables:
80  * c-file-style: "linux"
81  * End:
82  */