From 77bf4400319db9d2a8af6b00c2be6faa0f3d07cb Mon Sep 17 00:00:00 2001 From: Jeff Dike Date: Tue, 16 Oct 2007 01:26:58 -0700 Subject: uml: remove code made redundant by CHOOSE_MODE removal This patch makes a number of simplifications enabled by the removal of CHOOSE_MODE. There were lots of functions that looked like int foo(args){ foo_skas(args); } The bodies of foo_skas are now folded into foo, and their declarations (and sometimes entire header files) are deleted. In addition, the union uml_pt_regs, which was a union between the tt and skas register formats, is now a struct, with the tt-mode arm of the union being removed. It turns out that usr2_handler was unused, so it is gone. Signed-off-by: Jeff Dike Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/um/sys-i386/bugs.c | 2 +- arch/um/sys-i386/fault.c | 2 +- arch/um/sys-i386/ldt.c | 7 ++-- arch/um/sys-i386/ptrace.c | 10 +++--- arch/um/sys-i386/signal.c | 86 +++++++++++++++++++++-------------------------- arch/um/sys-i386/tls.c | 4 +-- 6 files changed, 50 insertions(+), 61 deletions(-) (limited to 'arch/um/sys-i386') diff --git a/arch/um/sys-i386/bugs.c b/arch/um/sys-i386/bugs.c index 0393e44813e7..25c1165d8093 100644 --- a/arch/um/sys-i386/bugs.c +++ b/arch/um/sys-i386/bugs.c @@ -162,7 +162,7 @@ void arch_check_bugs(void) host_has_xmm = have_it; } -int arch_handle_signal(int sig, union uml_pt_regs *regs) +int arch_handle_signal(int sig, struct uml_pt_regs *regs) { unsigned char tmp[2]; diff --git a/arch/um/sys-i386/fault.c b/arch/um/sys-i386/fault.c index 745b4fd49e9f..cc06a5737df0 100644 --- a/arch/um/sys-i386/fault.c +++ b/arch/um/sys-i386/fault.c @@ -15,7 +15,7 @@ struct exception_table_entry const struct exception_table_entry *search_exception_tables(unsigned long add); /* Compare this to arch/i386/mm/extable.c:fixup_exception() */ -int arch_fixup(unsigned long address, union uml_pt_regs *regs) +int arch_fixup(unsigned long address, struct uml_pt_regs *regs) { const struct exception_table_entry *fixup; diff --git a/arch/um/sys-i386/ldt.c b/arch/um/sys-i386/ldt.c index 2683d302395d..906c2a4e7279 100644 --- a/arch/um/sys-i386/ldt.c +++ b/arch/um/sys-i386/ldt.c @@ -13,7 +13,6 @@ #include "asm/ldt.h" #include "asm/unistd.h" #include "kern.h" -#include "mode_kern.h" #include "os.h" extern int modify_ldt(int func, void *ptr, unsigned long bytecount); @@ -33,7 +32,7 @@ long write_ldt_entry(struct mm_id * mm_idp, int func, struct user_desc * desc, * modify isn't current->active_mm. * If this is called directly by modify_ldt, * (current->active_mm->context.skas.u == mm_idp) - * will be true. So no call to switch_mm_skas(mm_idp) is done. + * will be true. So no call to __switch_mm(mm_idp) is done. * If this is called in case of init_new_ldt or PTRACE_LDT, * mm_idp won't belong to current->active_mm, but child->mm. * So we need to switch child's mm into our userspace, then @@ -43,7 +42,7 @@ long write_ldt_entry(struct mm_id * mm_idp, int func, struct user_desc * desc, */ if(!current->active_mm || current->active_mm == &init_mm || mm_idp != ¤t->active_mm->context.skas.id) - switch_mm_skas(mm_idp); + __switch_mm(mm_idp); } if(ptrace_ldt) { @@ -88,7 +87,7 @@ long write_ldt_entry(struct mm_id * mm_idp, int func, struct user_desc * desc, */ if(current->active_mm && current->active_mm != &init_mm && mm_idp != ¤t->active_mm->context.skas.id) - switch_mm_skas(¤t->active_mm->context.skas.id); + __switch_mm(¤t->active_mm->context.skas.id); } return res; diff --git a/arch/um/sys-i386/ptrace.c b/arch/um/sys-i386/ptrace.c index 7792365827a2..dcf0c6b310c8 100644 --- a/arch/um/sys-i386/ptrace.c +++ b/arch/um/sys-i386/ptrace.c @@ -14,16 +14,18 @@ #include "sysdep/sigcontext.h" #include "sysdep/sc.h" -void arch_switch_to_skas(struct task_struct *from, struct task_struct *to) +extern int arch_switch_tls(struct task_struct *from, struct task_struct *to); + +void arch_switch_to(struct task_struct *from, struct task_struct *to) { - int err = arch_switch_tls_skas(from, to); + int err = arch_switch_tls(from, to); if (!err) return; if (err != -EINVAL) - printk(KERN_WARNING "arch_switch_tls_skas failed, errno %d, not EINVAL\n", -err); + printk(KERN_WARNING "arch_switch_tls failed, errno %d, not EINVAL\n", -err); else - printk(KERN_WARNING "arch_switch_tls_skas failed, errno = EINVAL\n"); + printk(KERN_WARNING "arch_switch_tls failed, errno = EINVAL\n"); } int is_syscall(unsigned long addr) diff --git a/arch/um/sys-i386/signal.c b/arch/um/sys-i386/signal.c index a9fe8d6f72c3..c64d48734e3a 100644 --- a/arch/um/sys-i386/signal.c +++ b/arch/um/sys-i386/signal.c @@ -14,30 +14,30 @@ #include "registers.h" #include "skas.h" -void copy_sc(union uml_pt_regs *regs, void *from) +void copy_sc(struct uml_pt_regs *regs, void *from) { struct sigcontext *sc = from; - REGS_GS(regs->skas.regs) = sc->gs; - REGS_FS(regs->skas.regs) = sc->fs; - REGS_ES(regs->skas.regs) = sc->es; - REGS_DS(regs->skas.regs) = sc->ds; - REGS_EDI(regs->skas.regs) = sc->edi; - REGS_ESI(regs->skas.regs) = sc->esi; - REGS_EBP(regs->skas.regs) = sc->ebp; - REGS_SP(regs->skas.regs) = sc->esp; - REGS_EBX(regs->skas.regs) = sc->ebx; - REGS_EDX(regs->skas.regs) = sc->edx; - REGS_ECX(regs->skas.regs) = sc->ecx; - REGS_EAX(regs->skas.regs) = sc->eax; - REGS_IP(regs->skas.regs) = sc->eip; - REGS_CS(regs->skas.regs) = sc->cs; - REGS_EFLAGS(regs->skas.regs) = sc->eflags; - REGS_SS(regs->skas.regs) = sc->ss; + REGS_GS(regs->regs) = sc->gs; + REGS_FS(regs->regs) = sc->fs; + REGS_ES(regs->regs) = sc->es; + REGS_DS(regs->regs) = sc->ds; + REGS_EDI(regs->regs) = sc->edi; + REGS_ESI(regs->regs) = sc->esi; + REGS_EBP(regs->regs) = sc->ebp; + REGS_SP(regs->regs) = sc->esp; + REGS_EBX(regs->regs) = sc->ebx; + REGS_EDX(regs->regs) = sc->edx; + REGS_ECX(regs->regs) = sc->ecx; + REGS_EAX(regs->regs) = sc->eax; + REGS_IP(regs->regs) = sc->eip; + REGS_CS(regs->regs) = sc->cs; + REGS_EFLAGS(regs->regs) = sc->eflags; + REGS_SS(regs->regs) = sc->ss; } -static int copy_sc_from_user_skas(struct pt_regs *regs, - struct sigcontext __user *from) +static int copy_sc_from_user(struct pt_regs *regs, + struct sigcontext __user *from) { struct sigcontext sc; unsigned long fpregs[HOST_FP_SIZE]; @@ -60,31 +60,32 @@ static int copy_sc_from_user_skas(struct pt_regs *regs, return 0; } -int copy_sc_to_user_skas(struct sigcontext __user *to, struct _fpstate __user *to_fp, - struct pt_regs *regs, unsigned long sp) +static int copy_sc_to_user(struct sigcontext __user *to, + struct _fpstate __user *to_fp, struct pt_regs *regs, + unsigned long sp) { struct sigcontext sc; unsigned long fpregs[HOST_FP_SIZE]; struct faultinfo * fi = ¤t->thread.arch.faultinfo; int err; - sc.gs = REGS_GS(regs->regs.skas.regs); - sc.fs = REGS_FS(regs->regs.skas.regs); - sc.es = REGS_ES(regs->regs.skas.regs); - sc.ds = REGS_DS(regs->regs.skas.regs); - sc.edi = REGS_EDI(regs->regs.skas.regs); - sc.esi = REGS_ESI(regs->regs.skas.regs); - sc.ebp = REGS_EBP(regs->regs.skas.regs); + sc.gs = REGS_GS(regs->regs.regs); + sc.fs = REGS_FS(regs->regs.regs); + sc.es = REGS_ES(regs->regs.regs); + sc.ds = REGS_DS(regs->regs.regs); + sc.edi = REGS_EDI(regs->regs.regs); + sc.esi = REGS_ESI(regs->regs.regs); + sc.ebp = REGS_EBP(regs->regs.regs); sc.esp = sp; - sc.ebx = REGS_EBX(regs->regs.skas.regs); - sc.edx = REGS_EDX(regs->regs.skas.regs); - sc.ecx = REGS_ECX(regs->regs.skas.regs); - sc.eax = REGS_EAX(regs->regs.skas.regs); - sc.eip = REGS_IP(regs->regs.skas.regs); - sc.cs = REGS_CS(regs->regs.skas.regs); - sc.eflags = REGS_EFLAGS(regs->regs.skas.regs); - sc.esp_at_signal = regs->regs.skas.regs[UESP]; - sc.ss = regs->regs.skas.regs[SS]; + sc.ebx = REGS_EBX(regs->regs.regs); + sc.edx = REGS_EDX(regs->regs.regs); + sc.ecx = REGS_ECX(regs->regs.regs); + sc.eax = REGS_EAX(regs->regs.regs); + sc.eip = REGS_IP(regs->regs.regs); + sc.cs = REGS_CS(regs->regs.regs); + sc.eflags = REGS_EFLAGS(regs->regs.regs); + sc.esp_at_signal = regs->regs.regs[UESP]; + sc.ss = regs->regs.regs[SS]; sc.cr2 = fi->cr2; sc.err = fi->error_code; sc.trapno = fi->trap_no; @@ -105,17 +106,6 @@ int copy_sc_to_user_skas(struct sigcontext __user *to, struct _fpstate __user *t copy_to_user(to_fp, fpregs, sizeof(fpregs)); } -static int copy_sc_from_user(struct pt_regs *to, void __user *from) -{ - return copy_sc_from_user_skas(to, from); -} - -static int copy_sc_to_user(struct sigcontext __user *to, struct _fpstate __user *fp, - struct pt_regs *from, unsigned long sp) -{ - return copy_sc_to_user_skas(to, fp, from, sp); -} - static int copy_ucontext_to_user(struct ucontext __user *uc, struct _fpstate __user *fp, sigset_t *set, unsigned long sp) { diff --git a/arch/um/sys-i386/tls.c b/arch/um/sys-i386/tls.c index bb4d0e23aa81..6cb7cbd137a0 100644 --- a/arch/um/sys-i386/tls.c +++ b/arch/um/sys-i386/tls.c @@ -14,9 +14,7 @@ #include "asm/desc.h" #include "kern.h" #include "kern_util.h" -#include "mode_kern.h" #include "os.h" -#include "mode.h" #include "skas.h" /* @@ -167,7 +165,7 @@ void clear_flushed_tls(struct task_struct *task) * And this will not need be used when (and if) we'll add support to the host * SKAS patch. */ -int arch_switch_tls_skas(struct task_struct *from, struct task_struct *to) +int arch_switch_tls(struct task_struct *from, struct task_struct *to) { if (!host_supports_tls) return 0; -- cgit v1.2.2