diff options
author | Jeff Dike <jdike@addtoit.com> | 2006-07-10 07:45:13 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-07-10 16:24:24 -0400 |
commit | 1d3468a6643a6a5905e2ac9ae1fa1aefc06d882a (patch) | |
tree | 9f605490ab72b8027e9f5e0d4c9626516d8a73c5 /arch/um | |
parent | 469226a431f553a7b3ec17d87ce3c2d1c6c25fb2 (diff) |
[PATCH] uml: move _kern.c files
Move most *_kern.c files in arch/um/kernel to *.c. This makes UML somewhat
more closely resemble the other arches.
[akpm@osdl.org: use the new INTF_* flags]
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/um')
-rw-r--r-- | arch/um/kernel/Makefile | 9 | ||||
-rw-r--r-- | arch/um/kernel/exec.c (renamed from arch/um/kernel/exec_kern.c) | 13 | ||||
-rw-r--r-- | arch/um/kernel/sigio.c (renamed from arch/um/kernel/sigio_kern.c) | 2 | ||||
-rw-r--r-- | arch/um/kernel/signal.c (renamed from arch/um/kernel/signal_kern.c) | 10 | ||||
-rw-r--r-- | arch/um/kernel/syscall.c (renamed from arch/um/kernel/syscall_kern.c) | 32 | ||||
-rw-r--r-- | arch/um/kernel/time.c (renamed from arch/um/kernel/time_kern.c) | 0 | ||||
-rw-r--r-- | arch/um/kernel/trap.c (renamed from arch/um/kernel/trap_kern.c) | 18 |
7 files changed, 46 insertions, 38 deletions
diff --git a/arch/um/kernel/Makefile b/arch/um/kernel/Makefile index 82b435897256..a2d93065b2d0 100644 --- a/arch/um/kernel/Makefile +++ b/arch/um/kernel/Makefile | |||
@@ -6,11 +6,10 @@ | |||
6 | extra-y := vmlinux.lds | 6 | extra-y := vmlinux.lds |
7 | clean-files := | 7 | clean-files := |
8 | 8 | ||
9 | obj-y = config.o exec_kern.o exitcode.o \ | 9 | obj-y = config.o exec.o exitcode.o init_task.o irq.o ksyms.o mem.o \ |
10 | init_task.o irq.o ksyms.o mem.o physmem.o \ | 10 | physmem.o process_kern.o ptrace.o reboot.o resource.o sigio.o \ |
11 | process_kern.o ptrace.o reboot.o resource.o sigio_kern.o \ | 11 | signal.o smp.o syscall.o sysrq.o time.o tlb.o trap.o uaccess.o \ |
12 | signal_kern.o smp.o syscall_kern.o sysrq.o \ | 12 | um_arch.o umid.o |
13 | time_kern.o tlb.o trap_kern.o uaccess.o um_arch.o umid.o | ||
14 | 13 | ||
15 | obj-$(CONFIG_BLK_DEV_INITRD) += initrd.o | 14 | obj-$(CONFIG_BLK_DEV_INITRD) += initrd.o |
16 | obj-$(CONFIG_GPROF) += gprof_syms.o | 15 | obj-$(CONFIG_GPROF) += gprof_syms.o |
diff --git a/arch/um/kernel/exec_kern.c b/arch/um/kernel/exec.c index c0cb627bf594..fc38a6d5906d 100644 --- a/arch/um/kernel/exec_kern.c +++ b/arch/um/kernel/exec.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2000, 2001 Jeff Dike (jdike@karaya.com) | 2 | * Copyright (C) 2000, 2001 Jeff Dike (jdike@karaya.com) |
3 | * Licensed under the GPL | 3 | * Licensed under the GPL |
4 | */ | 4 | */ |
@@ -31,18 +31,27 @@ void start_thread(struct pt_regs *regs, unsigned long eip, unsigned long esp) | |||
31 | CHOOSE_MODE_PROC(start_thread_tt, start_thread_skas, regs, eip, esp); | 31 | CHOOSE_MODE_PROC(start_thread_tt, start_thread_skas, regs, eip, esp); |
32 | } | 32 | } |
33 | 33 | ||
34 | #ifdef CONFIG_TTY_LOG | ||
35 | extern void log_exec(char **argv, void *tty); | ||
36 | #endif | ||
37 | |||
34 | static long execve1(char *file, char __user * __user *argv, | 38 | static long execve1(char *file, char __user * __user *argv, |
35 | char __user *__user *env) | 39 | char __user *__user *env) |
36 | { | 40 | { |
37 | long error; | 41 | long error; |
38 | 42 | ||
39 | #ifdef CONFIG_TTY_LOG | 43 | #ifdef CONFIG_TTY_LOG |
40 | log_exec(argv, current->tty); | 44 | task_lock(current); |
45 | log_exec(argv, current->signal->tty); | ||
46 | task_unlock(current); | ||
41 | #endif | 47 | #endif |
42 | error = do_execve(file, argv, env, ¤t->thread.regs); | 48 | error = do_execve(file, argv, env, ¤t->thread.regs); |
43 | if (error == 0){ | 49 | if (error == 0){ |
44 | task_lock(current); | 50 | task_lock(current); |
45 | current->ptrace &= ~PT_DTRACE; | 51 | current->ptrace &= ~PT_DTRACE; |
52 | #ifdef SUBARCH_EXECVE1 | ||
53 | SUBARCH_EXECVE1(¤t->thread.regs.regs); | ||
54 | #endif | ||
46 | task_unlock(current); | 55 | task_unlock(current); |
47 | set_cmdline(current_cmd()); | 56 | set_cmdline(current_cmd()); |
48 | } | 57 | } |
diff --git a/arch/um/kernel/sigio_kern.c b/arch/um/kernel/sigio.c index 5102ba5d5bd0..0ad755ceb212 100644 --- a/arch/um/kernel/sigio_kern.c +++ b/arch/um/kernel/sigio.c | |||
@@ -31,7 +31,7 @@ int write_sigio_irq(int fd) | |||
31 | int err; | 31 | int err; |
32 | 32 | ||
33 | err = um_request_irq(SIGIO_WRITE_IRQ, fd, IRQ_READ, sigio_interrupt, | 33 | err = um_request_irq(SIGIO_WRITE_IRQ, fd, IRQ_READ, sigio_interrupt, |
34 | IRQF_DISABLED | IRQF_SAMPLE_RANDOM, "write sigio", | 34 | IRQF_DISABLED|IRQF_SAMPLE_RANDOM, "write sigio", |
35 | NULL); | 35 | NULL); |
36 | if(err){ | 36 | if(err){ |
37 | printk("write_sigio_irq : um_request_irq failed, err = %d\n", | 37 | printk("write_sigio_irq : um_request_irq failed, err = %d\n", |
diff --git a/arch/um/kernel/signal_kern.c b/arch/um/kernel/signal.c index da17b7541e08..4aa9808ba264 100644 --- a/arch/um/kernel/signal_kern.c +++ b/arch/um/kernel/signal.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) | 2 | * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) |
3 | * Licensed under the GPL | 3 | * Licensed under the GPL |
4 | */ | 4 | */ |
@@ -36,7 +36,7 @@ EXPORT_SYMBOL(unblock_signals); | |||
36 | 36 | ||
37 | /* | 37 | /* |
38 | * OK, we're invoking a handler | 38 | * OK, we're invoking a handler |
39 | */ | 39 | */ |
40 | static int handle_signal(struct pt_regs *regs, unsigned long signr, | 40 | static int handle_signal(struct pt_regs *regs, unsigned long signr, |
41 | struct k_sigaction *ka, siginfo_t *info, | 41 | struct k_sigaction *ka, siginfo_t *info, |
42 | sigset_t *oldset) | 42 | sigset_t *oldset) |
@@ -88,7 +88,7 @@ static int handle_signal(struct pt_regs *regs, unsigned long signr, | |||
88 | force_sigsegv(signr, current); | 88 | force_sigsegv(signr, current); |
89 | } else { | 89 | } else { |
90 | spin_lock_irq(¤t->sighand->siglock); | 90 | spin_lock_irq(¤t->sighand->siglock); |
91 | sigorsets(¤t->blocked, ¤t->blocked, | 91 | sigorsets(¤t->blocked, ¤t->blocked, |
92 | &ka->sa.sa_mask); | 92 | &ka->sa.sa_mask); |
93 | if(!(ka->sa.sa_flags & SA_NODEFER)) | 93 | if(!(ka->sa.sa_flags & SA_NODEFER)) |
94 | sigaddset(¤t->blocked, signr); | 94 | sigaddset(¤t->blocked, signr); |
@@ -136,7 +136,7 @@ static int kern_do_signal(struct pt_regs *regs) | |||
136 | PT_REGS_RESTART_SYSCALL(regs); | 136 | PT_REGS_RESTART_SYSCALL(regs); |
137 | break; | 137 | break; |
138 | case -ERESTART_RESTARTBLOCK: | 138 | case -ERESTART_RESTARTBLOCK: |
139 | PT_REGS_SYSCALL_RET(regs) = __NR_restart_syscall; | 139 | PT_REGS_ORIG_SYSCALL(regs) = __NR_restart_syscall; |
140 | PT_REGS_RESTART_SYSCALL(regs); | 140 | PT_REGS_RESTART_SYSCALL(regs); |
141 | break; | 141 | break; |
142 | } | 142 | } |
@@ -146,7 +146,7 @@ static int kern_do_signal(struct pt_regs *regs) | |||
146 | * you set a breakpoint on a system call instruction and singlestep | 146 | * you set a breakpoint on a system call instruction and singlestep |
147 | * from it, the tracing thread used to PTRACE_SINGLESTEP the process | 147 | * from it, the tracing thread used to PTRACE_SINGLESTEP the process |
148 | * rather than PTRACE_SYSCALL it, allowing the system call to execute | 148 | * rather than PTRACE_SYSCALL it, allowing the system call to execute |
149 | * on the host. The tracing thread will check this flag and | 149 | * on the host. The tracing thread will check this flag and |
150 | * PTRACE_SYSCALL if necessary. | 150 | * PTRACE_SYSCALL if necessary. |
151 | */ | 151 | */ |
152 | if(current->ptrace & PT_DTRACE) | 152 | if(current->ptrace & PT_DTRACE) |
diff --git a/arch/um/kernel/syscall_kern.c b/arch/um/kernel/syscall.c index 37d3978337d8..abf14aaf905f 100644 --- a/arch/um/kernel/syscall_kern.c +++ b/arch/um/kernel/syscall.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2000 - 2003 Jeff Dike (jdike@addtoit.com) | 2 | * Copyright (C) 2000 - 2003 Jeff Dike (jdike@addtoit.com) |
3 | * Licensed under the GPL | 3 | * Licensed under the GPL |
4 | */ | 4 | */ |
@@ -110,7 +110,7 @@ long sys_uname(struct old_utsname __user * name) | |||
110 | if (!name) | 110 | if (!name) |
111 | return -EFAULT; | 111 | return -EFAULT; |
112 | down_read(&uts_sem); | 112 | down_read(&uts_sem); |
113 | err=copy_to_user(name, &system_utsname, sizeof (*name)); | 113 | err = copy_to_user(name, utsname(), sizeof (*name)); |
114 | up_read(&uts_sem); | 114 | up_read(&uts_sem); |
115 | return err?-EFAULT:0; | 115 | return err?-EFAULT:0; |
116 | } | 116 | } |
@@ -123,27 +123,27 @@ long sys_olduname(struct oldold_utsname __user * name) | |||
123 | return -EFAULT; | 123 | return -EFAULT; |
124 | if (!access_ok(VERIFY_WRITE,name,sizeof(struct oldold_utsname))) | 124 | if (!access_ok(VERIFY_WRITE,name,sizeof(struct oldold_utsname))) |
125 | return -EFAULT; | 125 | return -EFAULT; |
126 | 126 | ||
127 | down_read(&uts_sem); | 127 | down_read(&uts_sem); |
128 | 128 | ||
129 | error = __copy_to_user(&name->sysname,&system_utsname.sysname, | 129 | error = __copy_to_user(&name->sysname, &utsname()->sysname, |
130 | __OLD_UTS_LEN); | 130 | __OLD_UTS_LEN); |
131 | error |= __put_user(0,name->sysname+__OLD_UTS_LEN); | 131 | error |= __put_user(0, name->sysname + __OLD_UTS_LEN); |
132 | error |= __copy_to_user(&name->nodename,&system_utsname.nodename, | 132 | error |= __copy_to_user(&name->nodename, &utsname()->nodename, |
133 | __OLD_UTS_LEN); | 133 | __OLD_UTS_LEN); |
134 | error |= __put_user(0,name->nodename+__OLD_UTS_LEN); | 134 | error |= __put_user(0, name->nodename + __OLD_UTS_LEN); |
135 | error |= __copy_to_user(&name->release,&system_utsname.release, | 135 | error |= __copy_to_user(&name->release, &utsname()->release, |
136 | __OLD_UTS_LEN); | 136 | __OLD_UTS_LEN); |
137 | error |= __put_user(0,name->release+__OLD_UTS_LEN); | 137 | error |= __put_user(0, name->release + __OLD_UTS_LEN); |
138 | error |= __copy_to_user(&name->version,&system_utsname.version, | 138 | error |= __copy_to_user(&name->version, &utsname()->version, |
139 | __OLD_UTS_LEN); | 139 | __OLD_UTS_LEN); |
140 | error |= __put_user(0,name->version+__OLD_UTS_LEN); | 140 | error |= __put_user(0, name->version + __OLD_UTS_LEN); |
141 | error |= __copy_to_user(&name->machine,&system_utsname.machine, | 141 | error |= __copy_to_user(&name->machine, &utsname()->machine, |
142 | __OLD_UTS_LEN); | 142 | __OLD_UTS_LEN); |
143 | error |= __put_user(0,name->machine+__OLD_UTS_LEN); | 143 | error |= __put_user(0, name->machine + __OLD_UTS_LEN); |
144 | 144 | ||
145 | up_read(&uts_sem); | 145 | up_read(&uts_sem); |
146 | 146 | ||
147 | error = error ? -EFAULT : 0; | 147 | error = error ? -EFAULT : 0; |
148 | 148 | ||
149 | return error; | 149 | return error; |
diff --git a/arch/um/kernel/time_kern.c b/arch/um/kernel/time.c index 552ca1cb9847..552ca1cb9847 100644 --- a/arch/um/kernel/time_kern.c +++ b/arch/um/kernel/time.c | |||
diff --git a/arch/um/kernel/trap_kern.c b/arch/um/kernel/trap.c index 02f6d4d8dc3a..ac70fa5a2e2a 100644 --- a/arch/um/kernel/trap_kern.c +++ b/arch/um/kernel/trap.c | |||
@@ -35,7 +35,7 @@ | |||
35 | #include "os.h" | 35 | #include "os.h" |
36 | 36 | ||
37 | /* Note this is constrained to return 0, -EFAULT, -EACCESS, -ENOMEM by segv(). */ | 37 | /* Note this is constrained to return 0, -EFAULT, -EACCESS, -ENOMEM by segv(). */ |
38 | int handle_page_fault(unsigned long address, unsigned long ip, | 38 | int handle_page_fault(unsigned long address, unsigned long ip, |
39 | int is_write, int is_user, int *code_out) | 39 | int is_write, int is_user, int *code_out) |
40 | { | 40 | { |
41 | struct mm_struct *mm = current->mm; | 41 | struct mm_struct *mm = current->mm; |
@@ -55,20 +55,20 @@ int handle_page_fault(unsigned long address, unsigned long ip, | |||
55 | 55 | ||
56 | down_read(&mm->mmap_sem); | 56 | down_read(&mm->mmap_sem); |
57 | vma = find_vma(mm, address); | 57 | vma = find_vma(mm, address); |
58 | if(!vma) | 58 | if(!vma) |
59 | goto out; | 59 | goto out; |
60 | else if(vma->vm_start <= address) | 60 | else if(vma->vm_start <= address) |
61 | goto good_area; | 61 | goto good_area; |
62 | else if(!(vma->vm_flags & VM_GROWSDOWN)) | 62 | else if(!(vma->vm_flags & VM_GROWSDOWN)) |
63 | goto out; | 63 | goto out; |
64 | else if(is_user && !ARCH_IS_STACKGROW(address)) | 64 | else if(is_user && !ARCH_IS_STACKGROW(address)) |
65 | goto out; | 65 | goto out; |
66 | else if(expand_stack(vma, address)) | 66 | else if(expand_stack(vma, address)) |
67 | goto out; | 67 | goto out; |
68 | 68 | ||
69 | good_area: | 69 | good_area: |
70 | *code_out = SEGV_ACCERR; | 70 | *code_out = SEGV_ACCERR; |
71 | if(is_write && !(vma->vm_flags & VM_WRITE)) | 71 | if(is_write && !(vma->vm_flags & VM_WRITE)) |
72 | goto out; | 72 | goto out; |
73 | 73 | ||
74 | /* Don't require VM_READ|VM_EXEC for write faults! */ | 74 | /* Don't require VM_READ|VM_EXEC for write faults! */ |
@@ -184,14 +184,14 @@ unsigned long segv(struct faultinfo fi, unsigned long ip, int is_user, void *sc) | |||
184 | else if(catcher != NULL){ | 184 | else if(catcher != NULL){ |
185 | current->thread.fault_addr = (void *) address; | 185 | current->thread.fault_addr = (void *) address; |
186 | do_longjmp(catcher, 1); | 186 | do_longjmp(catcher, 1); |
187 | } | 187 | } |
188 | else if(current->thread.fault_addr != NULL) | 188 | else if(current->thread.fault_addr != NULL) |
189 | panic("fault_addr set but no fault catcher"); | 189 | panic("fault_addr set but no fault catcher"); |
190 | else if(!is_user && arch_fixup(ip, sc)) | 190 | else if(!is_user && arch_fixup(ip, sc)) |
191 | return(0); | 191 | return(0); |
192 | 192 | ||
193 | if(!is_user) | 193 | if(!is_user) |
194 | panic("Kernel mode fault at addr 0x%lx, ip 0x%lx", | 194 | panic("Kernel mode fault at addr 0x%lx, ip 0x%lx", |
195 | address, ip); | 195 | address, ip); |
196 | 196 | ||
197 | if (err == -EACCES) { | 197 | if (err == -EACCES) { |