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>
This commit is contained in:
committed by
Linus Torvalds
parent
4c9e138513
commit
6aa802ce6a
@@ -18,18 +18,17 @@
|
||||
#include "irq_user.h"
|
||||
#include "tlb.h"
|
||||
#include "os.h"
|
||||
#include "choose-mode.h"
|
||||
#include "mode_kern.h"
|
||||
|
||||
void flush_thread(void)
|
||||
{
|
||||
arch_flush_thread(¤t->thread.arch);
|
||||
CHOOSE_MODE(flush_thread_tt(), flush_thread_skas());
|
||||
flush_thread_skas();
|
||||
}
|
||||
|
||||
void start_thread(struct pt_regs *regs, unsigned long eip, unsigned long esp)
|
||||
{
|
||||
CHOOSE_MODE_PROC(start_thread_tt, start_thread_skas, regs, eip, esp);
|
||||
start_thread_skas(regs, eip, esp);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_TTY_LOG
|
||||
|
@@ -37,11 +37,11 @@ EXPORT_SYMBOL(um_virt_to_phys);
|
||||
EXPORT_SYMBOL(handle_page_fault);
|
||||
EXPORT_SYMBOL(find_iomem);
|
||||
|
||||
EXPORT_SYMBOL(strnlen_user_skas);
|
||||
EXPORT_SYMBOL(strncpy_from_user_skas);
|
||||
EXPORT_SYMBOL(copy_to_user_skas);
|
||||
EXPORT_SYMBOL(copy_from_user_skas);
|
||||
EXPORT_SYMBOL(clear_user_skas);
|
||||
EXPORT_SYMBOL(strnlen_user);
|
||||
EXPORT_SYMBOL(strncpy_from_user);
|
||||
EXPORT_SYMBOL(copy_to_user);
|
||||
EXPORT_SYMBOL(copy_from_user);
|
||||
EXPORT_SYMBOL(clear_user);
|
||||
EXPORT_SYMBOL(uml_strdup);
|
||||
|
||||
EXPORT_SYMBOL(os_stat_fd);
|
||||
|
@@ -61,7 +61,7 @@ static unsigned long kmem_top = 0;
|
||||
unsigned long get_kmem_end(void)
|
||||
{
|
||||
if (kmem_top == 0)
|
||||
kmem_top = CHOOSE_MODE(kmem_end_tt, kmem_end_skas);
|
||||
kmem_top = kmem_end_skas;
|
||||
return kmem_top;
|
||||
}
|
||||
|
||||
|
@@ -45,7 +45,6 @@
|
||||
#include "os.h"
|
||||
#include "mode.h"
|
||||
#include "mode_kern.h"
|
||||
#include "choose-mode.h"
|
||||
|
||||
/* This is a per-cpu array. A processor only modifies its entry and it only
|
||||
* 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 } };
|
||||
|
||||
static inline int external_pid(struct task_struct *task)
|
||||
{
|
||||
return CHOOSE_MODE_PROC(external_pid_tt, external_pid_skas, task);
|
||||
return external_pid_skas(task);
|
||||
}
|
||||
|
||||
int pid_to_processor_id(int pid)
|
||||
@@ -114,8 +113,8 @@ void *_switch_to(void *prev, void *next, void *last)
|
||||
set_current(to);
|
||||
|
||||
do {
|
||||
current->thread.saved_task = NULL ;
|
||||
CHOOSE_MODE_PROC(switch_to_tt, switch_to_skas, prev, next);
|
||||
current->thread.saved_task = NULL;
|
||||
switch_to_skas(prev, next);
|
||||
if(current->thread.saved_task)
|
||||
show_regs(&(current->thread.regs));
|
||||
next= current->thread.saved_task;
|
||||
@@ -136,7 +135,7 @@ void interrupt_end(void)
|
||||
|
||||
void release_thread(struct task_struct *task)
|
||||
{
|
||||
CHOOSE_MODE(release_thread_tt(task), release_thread_skas(task));
|
||||
release_thread_skas(task);
|
||||
}
|
||||
|
||||
void exit_thread(void)
|
||||
@@ -155,8 +154,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
|
||||
int ret;
|
||||
|
||||
p->thread = (struct thread_struct) INIT_THREAD;
|
||||
ret = CHOOSE_MODE_PROC(copy_thread_tt, copy_thread_skas, nr,
|
||||
clone_flags, sp, stack_top, p, regs);
|
||||
ret = copy_thread_skas(nr, clone_flags, sp, stack_top, p, regs);
|
||||
|
||||
if (ret || !current->thread.forking)
|
||||
goto out;
|
||||
@@ -178,15 +176,12 @@ void initial_thread_cb(void (*proc)(void *), void *arg)
|
||||
int save_kmalloc_ok = kmalloc_ok;
|
||||
|
||||
kmalloc_ok = 0;
|
||||
CHOOSE_MODE_PROC(initial_thread_cb_tt, initial_thread_cb_skas, proc,
|
||||
arg);
|
||||
initial_thread_cb_skas(proc, arg);
|
||||
kmalloc_ok = save_kmalloc_ok;
|
||||
}
|
||||
|
||||
void default_idle(void)
|
||||
{
|
||||
CHOOSE_MODE(uml_idle_timer(), (void) 0);
|
||||
|
||||
while(1){
|
||||
/* endless idle loop with no priority at all */
|
||||
|
||||
@@ -203,7 +198,7 @@ void default_idle(void)
|
||||
|
||||
void cpu_idle(void)
|
||||
{
|
||||
CHOOSE_MODE(init_idle_tt(), init_idle_skas());
|
||||
init_idle_skas();
|
||||
}
|
||||
|
||||
void *um_virt_to_phys(struct task_struct *task, unsigned long addr,
|
||||
|
@@ -10,13 +10,12 @@
|
||||
#include "kern.h"
|
||||
#include "os.h"
|
||||
#include "mode.h"
|
||||
#include "choose-mode.h"
|
||||
|
||||
void (*pm_power_off)(void);
|
||||
|
||||
static void kill_off_processes(void)
|
||||
{
|
||||
CHOOSE_MODE(kill_off_processes_tt(), kill_off_processes_skas());
|
||||
kill_off_processes_skas();
|
||||
}
|
||||
|
||||
void uml_cleanup(void)
|
||||
@@ -29,13 +28,13 @@ void uml_cleanup(void)
|
||||
void machine_restart(char * __unused)
|
||||
{
|
||||
uml_cleanup();
|
||||
CHOOSE_MODE(reboot_tt(), reboot_skas());
|
||||
reboot_skas();
|
||||
}
|
||||
|
||||
void machine_power_off(void)
|
||||
{
|
||||
uml_cleanup();
|
||||
CHOOSE_MODE(halt_tt(), halt_skas());
|
||||
halt_skas();
|
||||
}
|
||||
|
||||
void machine_halt(void)
|
||||
|
@@ -139,7 +139,7 @@ static int copy_chunk_from_user(unsigned long from, int len, void *arg)
|
||||
return(0);
|
||||
}
|
||||
|
||||
int copy_from_user_skas(void *to, const void __user *from, int n)
|
||||
int copy_from_user(void *to, const void __user *from, int n)
|
||||
{
|
||||
if(segment_eq(get_fs(), KERNEL_DS)){
|
||||
memcpy(to, (__force void*)from, n);
|
||||
@@ -160,7 +160,7 @@ static int copy_chunk_to_user(unsigned long to, int len, void *arg)
|
||||
return(0);
|
||||
}
|
||||
|
||||
int copy_to_user_skas(void __user *to, const void *from, int n)
|
||||
int copy_to_user(void __user *to, const void *from, int n)
|
||||
{
|
||||
if(segment_eq(get_fs(), KERNEL_DS)){
|
||||
memcpy((__force void*)to, from, n);
|
||||
@@ -186,7 +186,7 @@ static int strncpy_chunk_from_user(unsigned long from, int len, void *arg)
|
||||
return(0);
|
||||
}
|
||||
|
||||
int strncpy_from_user_skas(char *dst, const char __user *src, int count)
|
||||
int strncpy_from_user(char *dst, const char __user *src, int count)
|
||||
{
|
||||
int n;
|
||||
char *ptr = dst;
|
||||
@@ -212,12 +212,12 @@ static int clear_chunk(unsigned long addr, int len, void *unused)
|
||||
return(0);
|
||||
}
|
||||
|
||||
int __clear_user_skas(void __user *mem, int len)
|
||||
int __clear_user(void __user *mem, int len)
|
||||
{
|
||||
return(buffer_op((unsigned long) mem, len, 1, clear_chunk, NULL));
|
||||
}
|
||||
|
||||
int clear_user_skas(void __user *mem, int len)
|
||||
int clear_user(void __user *mem, int len)
|
||||
{
|
||||
if(segment_eq(get_fs(), KERNEL_DS)){
|
||||
memset((__force void*)mem, 0, len);
|
||||
@@ -240,7 +240,7 @@ static int strnlen_chunk(unsigned long str, int len, void *arg)
|
||||
return(0);
|
||||
}
|
||||
|
||||
int strnlen_user_skas(const void __user *str, int len)
|
||||
int strnlen_user(const void __user *str, int len)
|
||||
{
|
||||
int count = 0, n;
|
||||
|
||||
|
@@ -21,7 +21,6 @@
|
||||
#include "kern_util.h"
|
||||
#include "sysdep/syscalls.h"
|
||||
#include "mode_kern.h"
|
||||
#include "choose-mode.h"
|
||||
|
||||
/* Unlocked, I don't care if this is a bit off */
|
||||
int nsyscalls = 0;
|
||||
|
@@ -181,9 +181,7 @@ void timer_handler(int sig, union uml_pt_regs *regs)
|
||||
timer_irq(regs);
|
||||
local_irq_disable();
|
||||
irq_enter();
|
||||
update_process_times(CHOOSE_MODE(
|
||||
(UPT_SC(regs) && user_context(UPT_SP(regs))),
|
||||
(regs)->skas.is_user));
|
||||
update_process_times((regs)->skas.is_user);
|
||||
irq_exit();
|
||||
local_irq_enable();
|
||||
}
|
||||
|
@@ -8,7 +8,6 @@
|
||||
#include "asm/pgalloc.h"
|
||||
#include "asm/pgtable.h"
|
||||
#include "asm/tlbflush.h"
|
||||
#include "choose-mode.h"
|
||||
#include "mode_kern.h"
|
||||
#include "as-layout.h"
|
||||
#include "tlb.h"
|
||||
@@ -378,35 +377,31 @@ void flush_tlb_all(void)
|
||||
|
||||
void flush_tlb_kernel_range(unsigned long start, unsigned long end)
|
||||
{
|
||||
CHOOSE_MODE_PROC(flush_tlb_kernel_range_tt,
|
||||
flush_tlb_kernel_range_common, start, end);
|
||||
flush_tlb_kernel_range_common(start, end);
|
||||
}
|
||||
|
||||
void flush_tlb_kernel_vm(void)
|
||||
{
|
||||
CHOOSE_MODE(flush_tlb_kernel_vm_tt(),
|
||||
flush_tlb_kernel_range_common(start_vm, end_vm));
|
||||
flush_tlb_kernel_range_common(start_vm, end_vm);
|
||||
}
|
||||
|
||||
void __flush_tlb_one(unsigned long addr)
|
||||
{
|
||||
CHOOSE_MODE_PROC(__flush_tlb_one_tt, __flush_tlb_one_skas, addr);
|
||||
__flush_tlb_one_skas(addr);
|
||||
}
|
||||
|
||||
void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
|
||||
unsigned long end)
|
||||
{
|
||||
CHOOSE_MODE_PROC(flush_tlb_range_tt, flush_tlb_range_skas, vma, start,
|
||||
end);
|
||||
flush_tlb_range_skas(vma, start, end);
|
||||
}
|
||||
|
||||
void flush_tlb_mm(struct mm_struct *mm)
|
||||
{
|
||||
CHOOSE_MODE_PROC(flush_tlb_mm_tt, flush_tlb_mm_skas, mm);
|
||||
flush_tlb_mm_skas(mm);
|
||||
}
|
||||
|
||||
void force_flush_all(void)
|
||||
{
|
||||
CHOOSE_MODE(force_flush_all_tt(), force_flush_all_skas());
|
||||
force_flush_all_skas();
|
||||
}
|
||||
|
||||
|
@@ -35,7 +35,6 @@
|
||||
#include "initrd.h"
|
||||
#include "init.h"
|
||||
#include "os.h"
|
||||
#include "choose-mode.h"
|
||||
#include "mode_kern.h"
|
||||
#include "mode.h"
|
||||
#include "skas.h"
|
||||
@@ -68,8 +67,7 @@ struct cpuinfo_um boot_cpu_data = {
|
||||
|
||||
unsigned long thread_saved_pc(struct task_struct *task)
|
||||
{
|
||||
return os_process_pc(CHOOSE_MODE_PROC(thread_pid_tt, thread_pid_skas,
|
||||
task));
|
||||
return os_process_pc(thread_pid_skas(task));
|
||||
}
|
||||
|
||||
/* Changed in setup_arch, which is called in early boot */
|
||||
@@ -88,7 +86,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
|
||||
seq_printf(m, "processor\t: %d\n", index);
|
||||
seq_printf(m, "vendor_id\t: User Mode Linux\n");
|
||||
seq_printf(m, "model name\t: UML\n");
|
||||
seq_printf(m, "mode\t\t: %s\n", CHOOSE_MODE("tt", "skas"));
|
||||
seq_printf(m, "mode\t\t: skas\n");
|
||||
seq_printf(m, "host\t\t: %s\n", host_info);
|
||||
seq_printf(m, "bogomips\t: %lu.%02lu\n\n",
|
||||
loops_per_jiffy/(500000/HZ),
|
||||
@@ -283,8 +281,7 @@ int __init linux_main(int argc, char **argv)
|
||||
|
||||
printf("UML running in %s mode\n", mode);
|
||||
|
||||
host_task_size = CHOOSE_MODE_PROC(set_task_sizes_tt,
|
||||
set_task_sizes_skas, &task_size);
|
||||
host_task_size = set_task_sizes_skas(&task_size);
|
||||
|
||||
/*
|
||||
* Setting up handlers to 'sig_info' struct
|
||||
@@ -292,7 +289,7 @@ int __init linux_main(int argc, char **argv)
|
||||
os_fill_handlinfo(handlinfo_kern);
|
||||
|
||||
brk_start = (unsigned long) sbrk(0);
|
||||
CHOOSE_MODE_PROC(before_mem_tt, before_mem_skas, brk_start);
|
||||
before_mem_skas(brk_start);
|
||||
/* Increase physical memory size for exec-shield users
|
||||
so they actually get what they asked for. This should
|
||||
add zero for non-exec shield users */
|
||||
@@ -357,7 +354,7 @@ int __init linux_main(int argc, char **argv)
|
||||
stack_protections((unsigned long) &init_thread_info);
|
||||
os_flush_stdout();
|
||||
|
||||
return CHOOSE_MODE(start_uml_tt(), start_uml_skas());
|
||||
return start_uml_skas();
|
||||
}
|
||||
|
||||
extern int uml_exitcode;
|
||||
|
Reference in New Issue
Block a user