aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/kernel
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2007-10-16 04:26:56 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-16 12:43:05 -0400
commit6aa802ce6acc9b1f0b34114b3f7c21c84872cc3a (patch)
tree74523303349693ef482dec4a1d803566b69c6abd /arch/um/kernel
parent4c9e13851315a25a705e7a686116e491041ca228 (diff)
uml: throw out CHOOSE_MODE
The next stage after removing code which depends on CONFIG_MODE_TT is removing the CHOOSE_MODE abstraction, which provided both compile-time and run-time branching to either tt-mode or skas-mode code. This patch removes choose-mode.h and all inclusions of it, and replaces all CHOOSE_MODE invocations with the skas branch. This leaves a number of trivial functions which will be dealt with in a later patch. There are some changes in the uaccess and tls support which go somewhat beyond this and eliminate some of the now-redundant functions. 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/exec.c5
-rw-r--r--arch/um/kernel/ksyms.c10
-rw-r--r--arch/um/kernel/physmem.c2
-rw-r--r--arch/um/kernel/process.c19
-rw-r--r--arch/um/kernel/reboot.c7
-rw-r--r--arch/um/kernel/skas/uaccess.c12
-rw-r--r--arch/um/kernel/syscall.c1
-rw-r--r--arch/um/kernel/time.c4
-rw-r--r--arch/um/kernel/tlb.c17
-rw-r--r--arch/um/kernel/um_arch.c13
10 files changed, 36 insertions, 54 deletions
diff --git a/arch/um/kernel/exec.c b/arch/um/kernel/exec.c
index 84d77a0d138c..8f774c25b765 100644
--- a/arch/um/kernel/exec.c
+++ b/arch/um/kernel/exec.c
@@ -18,18 +18,17 @@
18#include "irq_user.h" 18#include "irq_user.h"
19#include "tlb.h" 19#include "tlb.h"
20#include "os.h" 20#include "os.h"
21#include "choose-mode.h"
22#include "mode_kern.h" 21#include "mode_kern.h"
23 22
24void flush_thread(void) 23void flush_thread(void)
25{ 24{
26 arch_flush_thread(&current->thread.arch); 25 arch_flush_thread(&current->thread.arch);
27 CHOOSE_MODE(flush_thread_tt(), flush_thread_skas()); 26 flush_thread_skas();
28} 27}
29 28
30void start_thread(struct pt_regs *regs, unsigned long eip, unsigned long esp) 29void start_thread(struct pt_regs *regs, unsigned long eip, unsigned long esp)
31{ 30{
32 CHOOSE_MODE_PROC(start_thread_tt, start_thread_skas, regs, eip, esp); 31 start_thread_skas(regs, eip, esp);
33} 32}
34 33
35#ifdef CONFIG_TTY_LOG 34#ifdef CONFIG_TTY_LOG
diff --git a/arch/um/kernel/ksyms.c b/arch/um/kernel/ksyms.c
index 59e22d27b239..996412c0bb47 100644
--- a/arch/um/kernel/ksyms.c
+++ b/arch/um/kernel/ksyms.c
@@ -37,11 +37,11 @@ EXPORT_SYMBOL(um_virt_to_phys);
37EXPORT_SYMBOL(handle_page_fault); 37EXPORT_SYMBOL(handle_page_fault);
38EXPORT_SYMBOL(find_iomem); 38EXPORT_SYMBOL(find_iomem);
39 39
40EXPORT_SYMBOL(strnlen_user_skas); 40EXPORT_SYMBOL(strnlen_user);
41EXPORT_SYMBOL(strncpy_from_user_skas); 41EXPORT_SYMBOL(strncpy_from_user);
42EXPORT_SYMBOL(copy_to_user_skas); 42EXPORT_SYMBOL(copy_to_user);
43EXPORT_SYMBOL(copy_from_user_skas); 43EXPORT_SYMBOL(copy_from_user);
44EXPORT_SYMBOL(clear_user_skas); 44EXPORT_SYMBOL(clear_user);
45EXPORT_SYMBOL(uml_strdup); 45EXPORT_SYMBOL(uml_strdup);
46 46
47EXPORT_SYMBOL(os_stat_fd); 47EXPORT_SYMBOL(os_stat_fd);
diff --git a/arch/um/kernel/physmem.c b/arch/um/kernel/physmem.c
index fb695e48fad7..f7b2f3594793 100644
--- a/arch/um/kernel/physmem.c
+++ b/arch/um/kernel/physmem.c
@@ -61,7 +61,7 @@ static unsigned long kmem_top = 0;
61unsigned long get_kmem_end(void) 61unsigned long get_kmem_end(void)
62{ 62{
63 if (kmem_top == 0) 63 if (kmem_top == 0)
64 kmem_top = CHOOSE_MODE(kmem_end_tt, kmem_end_skas); 64 kmem_top = kmem_end_skas;
65 return kmem_top; 65 return kmem_top;
66} 66}
67 67
diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c
index 005ed44d4a8e..22ad46fd2c08 100644
--- a/arch/um/kernel/process.c
+++ b/arch/um/kernel/process.c
@@ -45,7 +45,6 @@
45#include "os.h" 45#include "os.h"
46#include "mode.h" 46#include "mode.h"
47#include "mode_kern.h" 47#include "mode_kern.h"
48#include "choose-mode.h"
49 48
50/* This is a per-cpu array. A processor only modifies its entry and it only 49/* This is a per-cpu array. A processor only modifies its entry and it only
51 * cares about its entry, so it's OK if another processor is modifying its 50 * cares about its entry, so it's OK if another processor is modifying its
@@ -55,7 +54,7 @@ struct cpu_task cpu_tasks[NR_CPUS] = { [0 ... NR_CPUS - 1] = { -1, NULL } };
55 54
56static inline int external_pid(struct task_struct *task) 55static inline int external_pid(struct task_struct *task)
57{ 56{
58 return CHOOSE_MODE_PROC(external_pid_tt, external_pid_skas, task); 57 return external_pid_skas(task);
59} 58}
60 59
61int pid_to_processor_id(int pid) 60int pid_to_processor_id(int pid)
@@ -114,8 +113,8 @@ void *_switch_to(void *prev, void *next, void *last)
114 set_current(to); 113 set_current(to);
115 114
116 do { 115 do {
117 current->thread.saved_task = NULL ; 116 current->thread.saved_task = NULL;
118 CHOOSE_MODE_PROC(switch_to_tt, switch_to_skas, prev, next); 117 switch_to_skas(prev, next);
119 if(current->thread.saved_task) 118 if(current->thread.saved_task)
120 show_regs(&(current->thread.regs)); 119 show_regs(&(current->thread.regs));
121 next= current->thread.saved_task; 120 next= current->thread.saved_task;
@@ -136,7 +135,7 @@ void interrupt_end(void)
136 135
137void release_thread(struct task_struct *task) 136void release_thread(struct task_struct *task)
138{ 137{
139 CHOOSE_MODE(release_thread_tt(task), release_thread_skas(task)); 138 release_thread_skas(task);
140} 139}
141 140
142void exit_thread(void) 141void exit_thread(void)
@@ -155,8 +154,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
155 int ret; 154 int ret;
156 155
157 p->thread = (struct thread_struct) INIT_THREAD; 156 p->thread = (struct thread_struct) INIT_THREAD;
158 ret = CHOOSE_MODE_PROC(copy_thread_tt, copy_thread_skas, nr, 157 ret = copy_thread_skas(nr, clone_flags, sp, stack_top, p, regs);
159 clone_flags, sp, stack_top, p, regs);
160 158
161 if (ret || !current->thread.forking) 159 if (ret || !current->thread.forking)
162 goto out; 160 goto out;
@@ -178,15 +176,12 @@ void initial_thread_cb(void (*proc)(void *), void *arg)
178 int save_kmalloc_ok = kmalloc_ok; 176 int save_kmalloc_ok = kmalloc_ok;
179 177
180 kmalloc_ok = 0; 178 kmalloc_ok = 0;
181 CHOOSE_MODE_PROC(initial_thread_cb_tt, initial_thread_cb_skas, proc, 179 initial_thread_cb_skas(proc, arg);
182 arg);
183 kmalloc_ok = save_kmalloc_ok; 180 kmalloc_ok = save_kmalloc_ok;
184} 181}
185 182
186void default_idle(void) 183void default_idle(void)
187{ 184{
188 CHOOSE_MODE(uml_idle_timer(), (void) 0);
189
190 while(1){ 185 while(1){
191 /* endless idle loop with no priority at all */ 186 /* endless idle loop with no priority at all */
192 187
@@ -203,7 +198,7 @@ void default_idle(void)
203 198
204void cpu_idle(void) 199void cpu_idle(void)
205{ 200{
206 CHOOSE_MODE(init_idle_tt(), init_idle_skas()); 201 init_idle_skas();
207} 202}
208 203
209void *um_virt_to_phys(struct task_struct *task, unsigned long addr, 204void *um_virt_to_phys(struct task_struct *task, unsigned long addr,
diff --git a/arch/um/kernel/reboot.c b/arch/um/kernel/reboot.c
index 93df0672d022..4a0def32e323 100644
--- a/arch/um/kernel/reboot.c
+++ b/arch/um/kernel/reboot.c
@@ -10,13 +10,12 @@
10#include "kern.h" 10#include "kern.h"
11#include "os.h" 11#include "os.h"
12#include "mode.h" 12#include "mode.h"
13#include "choose-mode.h"
14 13
15void (*pm_power_off)(void); 14void (*pm_power_off)(void);
16 15
17static void kill_off_processes(void) 16static void kill_off_processes(void)
18{ 17{
19 CHOOSE_MODE(kill_off_processes_tt(), kill_off_processes_skas()); 18 kill_off_processes_skas();
20} 19}
21 20
22void uml_cleanup(void) 21void uml_cleanup(void)
@@ -29,13 +28,13 @@ void uml_cleanup(void)
29void machine_restart(char * __unused) 28void machine_restart(char * __unused)
30{ 29{
31 uml_cleanup(); 30 uml_cleanup();
32 CHOOSE_MODE(reboot_tt(), reboot_skas()); 31 reboot_skas();
33} 32}
34 33
35void machine_power_off(void) 34void machine_power_off(void)
36{ 35{
37 uml_cleanup(); 36 uml_cleanup();
38 CHOOSE_MODE(halt_tt(), halt_skas()); 37 halt_skas();
39} 38}
40 39
41void machine_halt(void) 40void machine_halt(void)
diff --git a/arch/um/kernel/skas/uaccess.c b/arch/um/kernel/skas/uaccess.c
index 8912cec0fe43..b14422e2c07c 100644
--- a/arch/um/kernel/skas/uaccess.c
+++ b/arch/um/kernel/skas/uaccess.c
@@ -139,7 +139,7 @@ static int copy_chunk_from_user(unsigned long from, int len, void *arg)
139 return(0); 139 return(0);
140} 140}
141 141
142int copy_from_user_skas(void *to, const void __user *from, int n) 142int copy_from_user(void *to, const void __user *from, int n)
143{ 143{
144 if(segment_eq(get_fs(), KERNEL_DS)){ 144 if(segment_eq(get_fs(), KERNEL_DS)){
145 memcpy(to, (__force void*)from, n); 145 memcpy(to, (__force void*)from, n);
@@ -160,7 +160,7 @@ static int copy_chunk_to_user(unsigned long to, int len, void *arg)
160 return(0); 160 return(0);
161} 161}
162 162
163int copy_to_user_skas(void __user *to, const void *from, int n) 163int copy_to_user(void __user *to, const void *from, int n)
164{ 164{
165 if(segment_eq(get_fs(), KERNEL_DS)){ 165 if(segment_eq(get_fs(), KERNEL_DS)){
166 memcpy((__force void*)to, from, n); 166 memcpy((__force void*)to, from, n);
@@ -186,7 +186,7 @@ static int strncpy_chunk_from_user(unsigned long from, int len, void *arg)
186 return(0); 186 return(0);
187} 187}
188 188
189int strncpy_from_user_skas(char *dst, const char __user *src, int count) 189int strncpy_from_user(char *dst, const char __user *src, int count)
190{ 190{
191 int n; 191 int n;
192 char *ptr = dst; 192 char *ptr = dst;
@@ -212,12 +212,12 @@ static int clear_chunk(unsigned long addr, int len, void *unused)
212 return(0); 212 return(0);
213} 213}
214 214
215int __clear_user_skas(void __user *mem, int len) 215int __clear_user(void __user *mem, int len)
216{ 216{
217 return(buffer_op((unsigned long) mem, len, 1, clear_chunk, NULL)); 217 return(buffer_op((unsigned long) mem, len, 1, clear_chunk, NULL));
218} 218}
219 219
220int clear_user_skas(void __user *mem, int len) 220int clear_user(void __user *mem, int len)
221{ 221{
222 if(segment_eq(get_fs(), KERNEL_DS)){ 222 if(segment_eq(get_fs(), KERNEL_DS)){
223 memset((__force void*)mem, 0, len); 223 memset((__force void*)mem, 0, len);
@@ -240,7 +240,7 @@ static int strnlen_chunk(unsigned long str, int len, void *arg)
240 return(0); 240 return(0);
241} 241}
242 242
243int strnlen_user_skas(const void __user *str, int len) 243int strnlen_user(const void __user *str, int len)
244{ 244{
245 int count = 0, n; 245 int count = 0, n;
246 246
diff --git a/arch/um/kernel/syscall.c b/arch/um/kernel/syscall.c
index 7b3b67333ff3..138bcb43b997 100644
--- a/arch/um/kernel/syscall.c
+++ b/arch/um/kernel/syscall.c
@@ -21,7 +21,6 @@
21#include "kern_util.h" 21#include "kern_util.h"
22#include "sysdep/syscalls.h" 22#include "sysdep/syscalls.h"
23#include "mode_kern.h" 23#include "mode_kern.h"
24#include "choose-mode.h"
25 24
26/* Unlocked, I don't care if this is a bit off */ 25/* Unlocked, I don't care if this is a bit off */
27int nsyscalls = 0; 26int nsyscalls = 0;
diff --git a/arch/um/kernel/time.c b/arch/um/kernel/time.c
index 259c49da7ff5..3571703a7cb4 100644
--- a/arch/um/kernel/time.c
+++ b/arch/um/kernel/time.c
@@ -181,9 +181,7 @@ void timer_handler(int sig, union uml_pt_regs *regs)
181 timer_irq(regs); 181 timer_irq(regs);
182 local_irq_disable(); 182 local_irq_disable();
183 irq_enter(); 183 irq_enter();
184 update_process_times(CHOOSE_MODE( 184 update_process_times((regs)->skas.is_user);
185 (UPT_SC(regs) && user_context(UPT_SP(regs))),
186 (regs)->skas.is_user));
187 irq_exit(); 185 irq_exit();
188 local_irq_enable(); 186 local_irq_enable();
189} 187}
diff --git a/arch/um/kernel/tlb.c b/arch/um/kernel/tlb.c
index 8a8d52851443..312e8ba30cd3 100644
--- a/arch/um/kernel/tlb.c
+++ b/arch/um/kernel/tlb.c
@@ -8,7 +8,6 @@
8#include "asm/pgalloc.h" 8#include "asm/pgalloc.h"
9#include "asm/pgtable.h" 9#include "asm/pgtable.h"
10#include "asm/tlbflush.h" 10#include "asm/tlbflush.h"
11#include "choose-mode.h"
12#include "mode_kern.h" 11#include "mode_kern.h"
13#include "as-layout.h" 12#include "as-layout.h"
14#include "tlb.h" 13#include "tlb.h"
@@ -378,35 +377,31 @@ void flush_tlb_all(void)
378 377
379void flush_tlb_kernel_range(unsigned long start, unsigned long end) 378void flush_tlb_kernel_range(unsigned long start, unsigned long end)
380{ 379{
381 CHOOSE_MODE_PROC(flush_tlb_kernel_range_tt, 380 flush_tlb_kernel_range_common(start, end);
382 flush_tlb_kernel_range_common, start, end);
383} 381}
384 382
385void flush_tlb_kernel_vm(void) 383void flush_tlb_kernel_vm(void)
386{ 384{
387 CHOOSE_MODE(flush_tlb_kernel_vm_tt(), 385 flush_tlb_kernel_range_common(start_vm, end_vm);
388 flush_tlb_kernel_range_common(start_vm, end_vm));
389} 386}
390 387
391void __flush_tlb_one(unsigned long addr) 388void __flush_tlb_one(unsigned long addr)
392{ 389{
393 CHOOSE_MODE_PROC(__flush_tlb_one_tt, __flush_tlb_one_skas, addr); 390 __flush_tlb_one_skas(addr);
394} 391}
395 392
396void flush_tlb_range(struct vm_area_struct *vma, unsigned long start, 393void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
397 unsigned long end) 394 unsigned long end)
398{ 395{
399 CHOOSE_MODE_PROC(flush_tlb_range_tt, flush_tlb_range_skas, vma, start, 396 flush_tlb_range_skas(vma, start, end);
400 end);
401} 397}
402 398
403void flush_tlb_mm(struct mm_struct *mm) 399void flush_tlb_mm(struct mm_struct *mm)
404{ 400{
405 CHOOSE_MODE_PROC(flush_tlb_mm_tt, flush_tlb_mm_skas, mm); 401 flush_tlb_mm_skas(mm);
406} 402}
407 403
408void force_flush_all(void) 404void force_flush_all(void)
409{ 405{
410 CHOOSE_MODE(force_flush_all_tt(), force_flush_all_skas()); 406 force_flush_all_skas();
411} 407}
412
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c
index aa7b067565d9..9f3a207eb81f 100644
--- a/arch/um/kernel/um_arch.c
+++ b/arch/um/kernel/um_arch.c
@@ -35,7 +35,6 @@
35#include "initrd.h" 35#include "initrd.h"
36#include "init.h" 36#include "init.h"
37#include "os.h" 37#include "os.h"
38#include "choose-mode.h"
39#include "mode_kern.h" 38#include "mode_kern.h"
40#include "mode.h" 39#include "mode.h"
41#include "skas.h" 40#include "skas.h"
@@ -68,8 +67,7 @@ struct cpuinfo_um boot_cpu_data = {
68 67
69unsigned long thread_saved_pc(struct task_struct *task) 68unsigned long thread_saved_pc(struct task_struct *task)
70{ 69{
71 return os_process_pc(CHOOSE_MODE_PROC(thread_pid_tt, thread_pid_skas, 70 return os_process_pc(thread_pid_skas(task));
72 task));
73} 71}
74 72
75/* Changed in setup_arch, which is called in early boot */ 73/* Changed in setup_arch, which is called in early boot */
@@ -88,7 +86,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
88 seq_printf(m, "processor\t: %d\n", index); 86 seq_printf(m, "processor\t: %d\n", index);
89 seq_printf(m, "vendor_id\t: User Mode Linux\n"); 87 seq_printf(m, "vendor_id\t: User Mode Linux\n");
90 seq_printf(m, "model name\t: UML\n"); 88 seq_printf(m, "model name\t: UML\n");
91 seq_printf(m, "mode\t\t: %s\n", CHOOSE_MODE("tt", "skas")); 89 seq_printf(m, "mode\t\t: skas\n");
92 seq_printf(m, "host\t\t: %s\n", host_info); 90 seq_printf(m, "host\t\t: %s\n", host_info);
93 seq_printf(m, "bogomips\t: %lu.%02lu\n\n", 91 seq_printf(m, "bogomips\t: %lu.%02lu\n\n",
94 loops_per_jiffy/(500000/HZ), 92 loops_per_jiffy/(500000/HZ),
@@ -283,8 +281,7 @@ int __init linux_main(int argc, char **argv)
283 281
284 printf("UML running in %s mode\n", mode); 282 printf("UML running in %s mode\n", mode);
285 283
286 host_task_size = CHOOSE_MODE_PROC(set_task_sizes_tt, 284 host_task_size = set_task_sizes_skas(&task_size);
287 set_task_sizes_skas, &task_size);
288 285
289 /* 286 /*
290 * Setting up handlers to 'sig_info' struct 287 * Setting up handlers to 'sig_info' struct
@@ -292,7 +289,7 @@ int __init linux_main(int argc, char **argv)
292 os_fill_handlinfo(handlinfo_kern); 289 os_fill_handlinfo(handlinfo_kern);
293 290
294 brk_start = (unsigned long) sbrk(0); 291 brk_start = (unsigned long) sbrk(0);
295 CHOOSE_MODE_PROC(before_mem_tt, before_mem_skas, brk_start); 292 before_mem_skas(brk_start);
296 /* Increase physical memory size for exec-shield users 293 /* Increase physical memory size for exec-shield users
297 so they actually get what they asked for. This should 294 so they actually get what they asked for. This should
298 add zero for non-exec shield users */ 295 add zero for non-exec shield users */
@@ -357,7 +354,7 @@ int __init linux_main(int argc, char **argv)
357 stack_protections((unsigned long) &init_thread_info); 354 stack_protections((unsigned long) &init_thread_info);
358 os_flush_stdout(); 355 os_flush_stdout();
359 356
360 return CHOOSE_MODE(start_uml_tt(), start_uml_skas()); 357 return start_uml_skas();
361} 358}
362 359
363extern int uml_exitcode; 360extern int uml_exitcode;