aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/kernel
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2007-10-16 04:26:54 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-16 12:43:05 -0400
commit4c9e13851315a25a705e7a686116e491041ca228 (patch)
treea323e1dcfe89f6c9d7e873a1bf2ad7aab9cdb9e6 /arch/um/kernel
parentc28b59d4779a43e9b7e786c7004cbee8fab1527d (diff)
uml: style fixes pass 1
Formatting changes in the files which have been changed in the tt-removal patchset so far. These include: copyright updates header file trimming style fixes adding severity to printks indenting Kconfig help according to the predominant kernel style These changes should be entirely non-functional. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/um/kernel')
-rw-r--r--arch/um/kernel/Makefile2
-rw-r--r--arch/um/kernel/init_task.c8
-rw-r--r--arch/um/kernel/smp.c31
-rw-r--r--arch/um/kernel/trap.c111
4 files changed, 71 insertions, 81 deletions
diff --git a/arch/um/kernel/Makefile b/arch/um/kernel/Makefile
index 6651937a2d26..499e5e95e609 100644
--- a/arch/um/kernel/Makefile
+++ b/arch/um/kernel/Makefile
@@ -1,5 +1,5 @@
1# 1#
2# Copyright (C) 2002 Jeff Dike (jdike@karaya.com) 2# Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux,intel}.com)
3# Licensed under the GPL 3# Licensed under the GPL
4# 4#
5 5
diff --git a/arch/um/kernel/init_task.c b/arch/um/kernel/init_task.c
index 33055082356e..dcfceca95052 100644
--- a/arch/um/kernel/init_task.c
+++ b/arch/um/kernel/init_task.c
@@ -3,16 +3,12 @@
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include "linux/mm.h"
7#include "linux/fs.h"
8#include "linux/module.h"
9#include "linux/sched.h" 6#include "linux/sched.h"
10#include "linux/init_task.h" 7#include "linux/init_task.h"
8#include "linux/fs.h"
9#include "linux/module.h"
11#include "linux/mqueue.h" 10#include "linux/mqueue.h"
12#include "asm/uaccess.h" 11#include "asm/uaccess.h"
13#include "asm/pgtable.h"
14#include "mem_user.h"
15#include "os.h"
16 12
17static struct fs_struct init_fs = INIT_FS; 13static struct fs_struct init_fs = INIT_FS;
18struct mm_struct init_mm = INIT_MM(init_mm); 14struct mm_struct init_mm = INIT_MM(init_mm);
diff --git a/arch/um/kernel/smp.c b/arch/um/kernel/smp.c
index 15bb54365779..36d89cf8d20b 100644
--- a/arch/um/kernel/smp.c
+++ b/arch/um/kernel/smp.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2000 - 2003 Jeff Dike (jdike@addtoit.com) 2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
@@ -56,12 +56,12 @@ void smp_send_stop(void)
56 int i; 56 int i;
57 57
58 printk(KERN_INFO "Stopping all CPUs..."); 58 printk(KERN_INFO "Stopping all CPUs...");
59 for(i = 0; i < num_online_cpus(); i++){ 59 for (i = 0; i < num_online_cpus(); i++) {
60 if(i == current_thread->cpu) 60 if (i == current_thread->cpu)
61 continue; 61 continue;
62 os_write_file(cpu_data[i].ipi_pipe[1], "S", 1); 62 os_write_file(cpu_data[i].ipi_pipe[1], "S", 1);
63 } 63 }
64 printk("done\n"); 64 printk(KERN_INFO "done\n");
65} 65}
66 66
67static cpumask_t smp_commenced_mask = CPU_MASK_NONE; 67static cpumask_t smp_commenced_mask = CPU_MASK_NONE;
@@ -72,7 +72,7 @@ static int idle_proc(void *cpup)
72 int cpu = (int) cpup, err; 72 int cpu = (int) cpup, err;
73 73
74 err = os_pipe(cpu_data[cpu].ipi_pipe, 1, 1); 74 err = os_pipe(cpu_data[cpu].ipi_pipe, 1, 1);
75 if(err < 0) 75 if (err < 0)
76 panic("CPU#%d failed to create IPI pipe, err = %d", cpu, -err); 76 panic("CPU#%d failed to create IPI pipe, err = %d", cpu, -err);
77 77
78 os_set_fd_async(cpu_data[cpu].ipi_pipe[0], 78 os_set_fd_async(cpu_data[cpu].ipi_pipe[0],
@@ -80,7 +80,7 @@ static int idle_proc(void *cpup)
80 80
81 wmb(); 81 wmb();
82 if (cpu_test_and_set(cpu, cpu_callin_map)) { 82 if (cpu_test_and_set(cpu, cpu_callin_map)) {
83 printk("huh, CPU#%d already present??\n", cpu); 83 printk(KERN_ERR "huh, CPU#%d already present??\n", cpu);
84 BUG(); 84 BUG();
85 } 85 }
86 86
@@ -99,7 +99,7 @@ static struct task_struct *idle_thread(int cpu)
99 current->thread.request.u.thread.proc = idle_proc; 99 current->thread.request.u.thread.proc = idle_proc;
100 current->thread.request.u.thread.arg = (void *) cpu; 100 current->thread.request.u.thread.arg = (void *) cpu;
101 new_task = fork_idle(cpu); 101 new_task = fork_idle(cpu);
102 if(IS_ERR(new_task)) 102 if (IS_ERR(new_task))
103 panic("copy_process failed in idle_thread, error = %ld", 103 panic("copy_process failed in idle_thread, error = %ld",
104 PTR_ERR(new_task)); 104 PTR_ERR(new_task));
105 105
@@ -126,14 +126,14 @@ void smp_prepare_cpus(unsigned int maxcpus)
126 cpu_set(me, cpu_callin_map); 126 cpu_set(me, cpu_callin_map);
127 127
128 err = os_pipe(cpu_data[me].ipi_pipe, 1, 1); 128 err = os_pipe(cpu_data[me].ipi_pipe, 1, 1);
129 if(err < 0) 129 if (err < 0)
130 panic("CPU#0 failed to create IPI pipe, errno = %d", -err); 130 panic("CPU#0 failed to create IPI pipe, errno = %d", -err);
131 131
132 os_set_fd_async(cpu_data[me].ipi_pipe[0], 132 os_set_fd_async(cpu_data[me].ipi_pipe[0],
133 current->thread.mode.tt.extern_pid); 133 current->thread.mode.tt.extern_pid);
134 134
135 for(cpu = 1; cpu < ncpus; cpu++){ 135 for (cpu = 1; cpu < ncpus; cpu++) {
136 printk("Booting processor %d...\n", cpu); 136 printk(KERN_INFO "Booting processor %d...\n", cpu);
137 137
138 idle = idle_thread(cpu); 138 idle = idle_thread(cpu);
139 139
@@ -144,8 +144,8 @@ void smp_prepare_cpus(unsigned int maxcpus)
144 cpu_relax(); 144 cpu_relax();
145 145
146 if (cpu_isset(cpu, cpu_callin_map)) 146 if (cpu_isset(cpu, cpu_callin_map))
147 printk("done\n"); 147 printk(KERN_INFO "done\n");
148 else printk("failed\n"); 148 else printk(KERN_INFO "failed\n");
149 } 149 }
150} 150}
151 151
@@ -187,13 +187,14 @@ void IPI_handler(int cpu)
187 break; 187 break;
188 188
189 case 'S': 189 case 'S':
190 printk("CPU#%d stopping\n", cpu); 190 printk(KERN_INFO "CPU#%d stopping\n", cpu);
191 while(1) 191 while (1)
192 pause(); 192 pause();
193 break; 193 break;
194 194
195 default: 195 default:
196 printk("CPU#%d received unknown IPI [%c]!\n", cpu, c); 196 printk(KERN_ERR "CPU#%d received unknown IPI [%c]!\n",
197 cpu, c);
197 break; 198 break;
198 } 199 }
199 } 200 }
diff --git a/arch/um/kernel/trap.c b/arch/um/kernel/trap.c
index c517c449d0dd..4b472ca53485 100644
--- a/arch/um/kernel/trap.c
+++ b/arch/um/kernel/trap.c
@@ -1,38 +1,24 @@
1/* 1/*
2 * Copyright (C) 2000, 2001 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include "linux/kernel.h" 6#include <linux/mm.h>
7#include "asm/errno.h" 7#include <linux/sched.h>
8#include "linux/sched.h" 8#include <linux/hardirq.h>
9#include "linux/mm.h" 9#include <asm/current.h>
10#include "linux/spinlock.h" 10#include <asm/pgtable.h>
11#include "linux/init.h" 11#include <asm/tlbflush.h>
12#include "linux/ptrace.h"
13#include "asm/semaphore.h"
14#include "asm/pgtable.h"
15#include "asm/pgalloc.h"
16#include "asm/tlbflush.h"
17#include "asm/a.out.h"
18#include "asm/current.h"
19#include "asm/irq.h"
20#include "sysdep/sigcontext.h"
21#include "kern_util.h"
22#include "as-layout.h"
23#include "arch.h" 12#include "arch.h"
24#include "kern.h" 13#include "as-layout.h"
25#include "chan_kern.h" 14#include "kern_util.h"
26#include "mconsole_kern.h"
27#include "mem.h"
28#include "mem_kern.h"
29#include "sysdep/sigcontext.h"
30#include "sysdep/ptrace.h"
31#include "os.h"
32#include "skas.h"
33#include "os.h" 15#include "os.h"
16#include "sysdep/sigcontext.h"
34 17
35/* Note this is constrained to return 0, -EFAULT, -EACCESS, -ENOMEM by segv(). */ 18/*
19 * Note this is constrained to return 0, -EFAULT, -EACCESS, -ENOMEM by
20 * segv().
21 */
36int handle_page_fault(unsigned long address, unsigned long ip, 22int handle_page_fault(unsigned long address, unsigned long ip,
37 int is_write, int is_user, int *code_out) 23 int is_write, int is_user, int *code_out)
38{ 24{
@@ -46,31 +32,33 @@ int handle_page_fault(unsigned long address, unsigned long ip,
46 32
47 *code_out = SEGV_MAPERR; 33 *code_out = SEGV_MAPERR;
48 34
49 /* If the fault was during atomic operation, don't take the fault, just 35 /*
50 * fail. */ 36 * If the fault was during atomic operation, don't take the fault, just
37 * fail.
38 */
51 if (in_atomic()) 39 if (in_atomic())
52 goto out_nosemaphore; 40 goto out_nosemaphore;
53 41
54 down_read(&mm->mmap_sem); 42 down_read(&mm->mmap_sem);
55 vma = find_vma(mm, address); 43 vma = find_vma(mm, address);
56 if(!vma) 44 if (!vma)
57 goto out; 45 goto out;
58 else if(vma->vm_start <= address) 46 else if (vma->vm_start <= address)
59 goto good_area; 47 goto good_area;
60 else if(!(vma->vm_flags & VM_GROWSDOWN)) 48 else if (!(vma->vm_flags & VM_GROWSDOWN))
61 goto out; 49 goto out;
62 else if(is_user && !ARCH_IS_STACKGROW(address)) 50 else if (is_user && !ARCH_IS_STACKGROW(address))
63 goto out; 51 goto out;
64 else if(expand_stack(vma, address)) 52 else if (expand_stack(vma, address))
65 goto out; 53 goto out;
66 54
67good_area: 55good_area:
68 *code_out = SEGV_ACCERR; 56 *code_out = SEGV_ACCERR;
69 if(is_write && !(vma->vm_flags & VM_WRITE)) 57 if (is_write && !(vma->vm_flags & VM_WRITE))
70 goto out; 58 goto out;
71 59
72 /* Don't require VM_READ|VM_EXEC for write faults! */ 60 /* Don't require VM_READ|VM_EXEC for write faults! */
73 if(!is_write && !(vma->vm_flags & (VM_READ | VM_EXEC))) 61 if (!is_write && !(vma->vm_flags & (VM_READ | VM_EXEC)))
74 goto out; 62 goto out;
75 63
76 do { 64 do {
@@ -96,9 +84,10 @@ survive:
96 pud = pud_offset(pgd, address); 84 pud = pud_offset(pgd, address);
97 pmd = pmd_offset(pud, address); 85 pmd = pmd_offset(pud, address);
98 pte = pte_offset_kernel(pmd, address); 86 pte = pte_offset_kernel(pmd, address);
99 } while(!pte_present(*pte)); 87 } while (!pte_present(*pte));
100 err = 0; 88 err = 0;
101 /* The below warning was added in place of 89 /*
90 * The below warning was added in place of
102 * pte_mkyoung(); if (is_write) pte_mkdirty(); 91 * pte_mkyoung(); if (is_write) pte_mkdirty();
103 * If it's triggered, we'd see normally a hang here (a clean pte is 92 * If it's triggered, we'd see normally a hang here (a clean pte is
104 * marked read-only to emulate the dirty bit). 93 * marked read-only to emulate the dirty bit).
@@ -112,7 +101,7 @@ survive:
112out: 101out:
113 up_read(&mm->mmap_sem); 102 up_read(&mm->mmap_sem);
114out_nosemaphore: 103out_nosemaphore:
115 return(err); 104 return err;
116 105
117/* 106/*
118 * We ran out of memory, or some other thing happened to us that made 107 * We ran out of memory, or some other thing happened to us that made
@@ -143,7 +132,7 @@ static void segv_handler(int sig, union uml_pt_regs *regs)
143{ 132{
144 struct faultinfo * fi = UPT_FAULTINFO(regs); 133 struct faultinfo * fi = UPT_FAULTINFO(regs);
145 134
146 if(UPT_IS_USER(regs) && !SEGV_IS_FIXABLE(fi)){ 135 if (UPT_IS_USER(regs) && !SEGV_IS_FIXABLE(fi)) {
147 bad_segv(*fi, UPT_IP(regs)); 136 bad_segv(*fi, UPT_IP(regs));
148 return; 137 return;
149 } 138 }
@@ -165,37 +154,41 @@ unsigned long segv(struct faultinfo fi, unsigned long ip, int is_user,
165 int is_write = FAULT_WRITE(fi); 154 int is_write = FAULT_WRITE(fi);
166 unsigned long address = FAULT_ADDRESS(fi); 155 unsigned long address = FAULT_ADDRESS(fi);
167 156
168 if(!is_user && (address >= start_vm) && (address < end_vm)){ 157 if (!is_user && (address >= start_vm) && (address < end_vm)) {
169 flush_tlb_kernel_vm(); 158 flush_tlb_kernel_vm();
170 return 0; 159 return 0;
171 } 160 }
172 else if(current->mm == NULL) { 161 else if (current->mm == NULL) {
173 show_regs(container_of(regs, struct pt_regs, regs)); 162 show_regs(container_of(regs, struct pt_regs, regs));
174 panic("Segfault with no mm"); 163 panic("Segfault with no mm");
175 } 164 }
176 165
177 if (SEGV_IS_FIXABLE(&fi) || SEGV_MAYBE_FIXABLE(&fi)) 166 if (SEGV_IS_FIXABLE(&fi) || SEGV_MAYBE_FIXABLE(&fi))
178 err = handle_page_fault(address, ip, is_write, is_user, &si.si_code); 167 err = handle_page_fault(address, ip, is_write, is_user,
168 &si.si_code);
179 else { 169 else {
180 err = -EFAULT; 170 err = -EFAULT;
181 /* A thread accessed NULL, we get a fault, but CR2 is invalid. 171 /*
182 * This code is used in __do_copy_from_user() of TT mode. */ 172 * A thread accessed NULL, we get a fault, but CR2 is invalid.
173 * This code is used in __do_copy_from_user() of TT mode.
174 * XXX tt mode is gone, so maybe this isn't needed any more
175 */
183 address = 0; 176 address = 0;
184 } 177 }
185 178
186 catcher = current->thread.fault_catcher; 179 catcher = current->thread.fault_catcher;
187 if(!err) 180 if (!err)
188 return 0; 181 return 0;
189 else if(catcher != NULL){ 182 else if (catcher != NULL) {
190 current->thread.fault_addr = (void *) address; 183 current->thread.fault_addr = (void *) address;
191 do_longjmp(catcher, 1); 184 do_longjmp(catcher, 1);
192 } 185 }
193 else if(current->thread.fault_addr != NULL) 186 else if (current->thread.fault_addr != NULL)
194 panic("fault_addr set but no fault catcher"); 187 panic("fault_addr set but no fault catcher");
195 else if(!is_user && arch_fixup(ip, regs)) 188 else if (!is_user && arch_fixup(ip, regs))
196 return 0; 189 return 0;
197 190
198 if(!is_user) { 191 if (!is_user) {
199 show_regs(container_of(regs, struct pt_regs, regs)); 192 show_regs(container_of(regs, struct pt_regs, regs));
200 panic("Kernel mode fault at addr 0x%lx, ip 0x%lx", 193 panic("Kernel mode fault at addr 0x%lx, ip 0x%lx",
201 address, ip); 194 address, ip);
@@ -209,7 +202,7 @@ unsigned long segv(struct faultinfo fi, unsigned long ip, int is_user,
209 current->thread.arch.faultinfo = fi; 202 current->thread.arch.faultinfo = fi;
210 force_sig_info(SIGBUS, &si, current); 203 force_sig_info(SIGBUS, &si, current);
211 } else if (err == -ENOMEM) { 204 } else if (err == -ENOMEM) {
212 printk("VM: killing process %s\n", current->comm); 205 printk(KERN_INFO "VM: killing process %s\n", current->comm);
213 do_exit(SIGKILL); 206 do_exit(SIGKILL);
214 } else { 207 } else {
215 BUG_ON(err != -EFAULT); 208 BUG_ON(err != -EFAULT);
@@ -223,13 +216,13 @@ unsigned long segv(struct faultinfo fi, unsigned long ip, int is_user,
223 216
224void relay_signal(int sig, union uml_pt_regs *regs) 217void relay_signal(int sig, union uml_pt_regs *regs)
225{ 218{
226 if(arch_handle_signal(sig, regs)) 219 if (arch_handle_signal(sig, regs))
227 return; 220 return;
228 221
229 if(!UPT_IS_USER(regs)){ 222 if (!UPT_IS_USER(regs)) {
230 if(sig == SIGBUS) 223 if (sig == SIGBUS)
231 printk("Bus error - the host /dev/shm or /tmp mount " 224 printk(KERN_ERR "Bus error - the host /dev/shm or /tmp "
232 "likely just ran out of space\n"); 225 "mount likely just ran out of space\n");
233 panic("Kernel mode signal %d", sig); 226 panic("Kernel mode signal %d", sig);
234 } 227 }
235 228
@@ -239,7 +232,7 @@ void relay_signal(int sig, union uml_pt_regs *regs)
239 232
240static void bus_handler(int sig, union uml_pt_regs *regs) 233static void bus_handler(int sig, union uml_pt_regs *regs)
241{ 234{
242 if(current->thread.fault_catcher != NULL) 235 if (current->thread.fault_catcher != NULL)
243 do_longjmp(current->thread.fault_catcher, 1); 236 do_longjmp(current->thread.fault_catcher, 1);
244 else relay_signal(sig, regs); 237 else relay_signal(sig, regs);
245} 238}