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 <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
Jeff Dike 2007-10-16 01:26:56 -07:00 • committed by Linus Torvalds
commit 6aa802ce6a
36 changed files with 132 additions and 312 deletions

View file

@ -2,7 +2,6 @@
#define __UM_A_OUT_H
#include "asm/arch/a.out.h"
#include "choose-mode.h"
#undef STACK_TOP
#undef STACK_TOP_MAX
@ -13,10 +12,8 @@ extern unsigned long host_task_size;
#define STACK_ROOM (stacksizelim)
extern int honeypot;
#define STACK_TOP \
CHOOSE_MODE((honeypot ? host_task_size : task_size), task_size)
#define STACK_TOP task_size
#define STACK_TOP_MAX STACK_TOP
#define STACK_TOP_MAX STACK_TOP
#endif

View file

@ -9,7 +9,6 @@
#include <asm-generic/mm_hooks.h>
#include "linux/sched.h"
#include "choose-mode.h"
#include "um_mmu.h"
#define get_mmu_context(task) do ; while(0)
@ -30,8 +29,7 @@ static inline void activate_mm(struct mm_struct *old, struct mm_struct *new)
* possible.
*/
if (old != new && (current->flags & PF_BORROWED_MM))
CHOOSE_MODE(force_flush_all(),
switch_mm_skas(&new->context.skas.id));
switch_mm_skas(&new->context.skas.id);
}
static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
@ -43,8 +41,7 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
cpu_clear(cpu, prev->cpu_vm_mask);
cpu_set(cpu, next->cpu_vm_mask);
if(next != &init_mm)
CHOOSE_MODE((void) 0,
switch_mm_skas(&next->context.skas.id));
switch_mm_skas(&next->context.skas.id);
}
}
@ -59,15 +56,14 @@ extern int init_new_context_skas(struct task_struct *task,
static inline int init_new_context(struct task_struct *task,
struct mm_struct *mm)
{
return(CHOOSE_MODE_PROC(init_new_context_tt, init_new_context_skas,
task, mm));
return(init_new_context_skas(task, mm));
}
extern void destroy_context_skas(struct mm_struct *mm);
static inline void destroy_context(struct mm_struct *mm)
{
CHOOSE_MODE((void) 0, destroy_context_skas(mm));
destroy_context_skas(mm);
}
#endif

View file

@ -11,7 +11,6 @@ struct pt_regs;
struct task_struct;
#include "asm/ptrace.h"
#include "choose-mode.h"
#include "registers.h"
#include "sysdep/archsetjmp.h"

View file

@ -12,7 +12,6 @@
#include "sysdep/ptrace.h"
#include "asm/ptrace-generic.h"
#include "asm/host_ldt.h"
#include "choose-mode.h"
#define PT_REGS_EAX(r) UPT_EAX(&(r)->regs)
#define PT_REGS_EBX(r) UPT_EBX(&(r)->regs)
@ -59,15 +58,8 @@ extern int arch_switch_tls_tt(struct task_struct *from, struct task_struct *to);
extern void arch_switch_to_tt(struct task_struct *from, struct task_struct *to);
extern void arch_switch_to_skas(struct task_struct *from, struct task_struct *to);
static inline int do_get_thread_area(struct user_desc *info)
{
return CHOOSE_MODE_PROC(do_get_thread_area_tt, do_get_thread_area_skas, info);
}
static inline int do_set_thread_area(struct user_desc *info)
{
return CHOOSE_MODE_PROC(do_set_thread_area_tt, do_set_thread_area_skas, info);
}
extern int do_get_thread_area_skas(struct user_desc *info);
extern int do_set_thread_area_skas(struct user_desc *info);
struct task_struct;

View file

@ -7,7 +7,6 @@
#define __UM_TLBFLUSH_H
#include <linux/mm.h>
#include "choose-mode.h"
/*
* TLB flushing:
@ -31,10 +30,7 @@ extern void flush_tlb_page_skas(struct vm_area_struct *vma,
static inline void flush_tlb_page(struct vm_area_struct *vma,
unsigned long address)
{
address &= PAGE_MASK;
CHOOSE_MODE(flush_tlb_range(vma, address, address + PAGE_SIZE),
flush_tlb_page_skas(vma, address));
flush_tlb_page_skas(vma, address & PAGE_MASK);
}
extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr);

View file

@ -80,7 +80,7 @@
__put_user(x, private_ptr) : -EFAULT); \
})
#define strlen_user(str) strnlen_user(str, ~0UL >> 1)
#define strlen_user(str) strnlen_user(str, ~0U >> 1)
struct exception_table_entry
{