diff options
author | Jeff Dike <jdike@addtoit.com> | 2007-10-16 04:26:58 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-16 12:43:05 -0400 |
commit | 77bf4400319db9d2a8af6b00c2be6faa0f3d07cb (patch) | |
tree | ddc8fd48349b8d4dd2c0b26bce7f52f79b4e4077 /arch/um/sys-i386 | |
parent | ae2587e41254e48e670346aefa332d7469d86352 (diff) |
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 <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/sys-i386')
-rw-r--r-- | arch/um/sys-i386/bugs.c | 2 | ||||
-rw-r--r-- | arch/um/sys-i386/fault.c | 2 | ||||
-rw-r--r-- | arch/um/sys-i386/ldt.c | 7 | ||||
-rw-r--r-- | arch/um/sys-i386/ptrace.c | 10 | ||||
-rw-r--r-- | arch/um/sys-i386/signal.c | 86 | ||||
-rw-r--r-- | arch/um/sys-i386/tls.c | 4 |
6 files changed, 50 insertions, 61 deletions
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) | |||
162 | host_has_xmm = have_it; | 162 | host_has_xmm = have_it; |
163 | } | 163 | } |
164 | 164 | ||
165 | int arch_handle_signal(int sig, union uml_pt_regs *regs) | 165 | int arch_handle_signal(int sig, struct uml_pt_regs *regs) |
166 | { | 166 | { |
167 | unsigned char tmp[2]; | 167 | unsigned char tmp[2]; |
168 | 168 | ||
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 | |||
15 | const struct exception_table_entry *search_exception_tables(unsigned long add); | 15 | const struct exception_table_entry *search_exception_tables(unsigned long add); |
16 | 16 | ||
17 | /* Compare this to arch/i386/mm/extable.c:fixup_exception() */ | 17 | /* Compare this to arch/i386/mm/extable.c:fixup_exception() */ |
18 | int arch_fixup(unsigned long address, union uml_pt_regs *regs) | 18 | int arch_fixup(unsigned long address, struct uml_pt_regs *regs) |
19 | { | 19 | { |
20 | const struct exception_table_entry *fixup; | 20 | const struct exception_table_entry *fixup; |
21 | 21 | ||
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 @@ | |||
13 | #include "asm/ldt.h" | 13 | #include "asm/ldt.h" |
14 | #include "asm/unistd.h" | 14 | #include "asm/unistd.h" |
15 | #include "kern.h" | 15 | #include "kern.h" |
16 | #include "mode_kern.h" | ||
17 | #include "os.h" | 16 | #include "os.h" |
18 | 17 | ||
19 | extern int modify_ldt(int func, void *ptr, unsigned long bytecount); | 18 | 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, | |||
33 | * modify isn't current->active_mm. | 32 | * modify isn't current->active_mm. |
34 | * If this is called directly by modify_ldt, | 33 | * If this is called directly by modify_ldt, |
35 | * (current->active_mm->context.skas.u == mm_idp) | 34 | * (current->active_mm->context.skas.u == mm_idp) |
36 | * will be true. So no call to switch_mm_skas(mm_idp) is done. | 35 | * will be true. So no call to __switch_mm(mm_idp) is done. |
37 | * If this is called in case of init_new_ldt or PTRACE_LDT, | 36 | * If this is called in case of init_new_ldt or PTRACE_LDT, |
38 | * mm_idp won't belong to current->active_mm, but child->mm. | 37 | * mm_idp won't belong to current->active_mm, but child->mm. |
39 | * So we need to switch child's mm into our userspace, then | 38 | * 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, | |||
43 | */ | 42 | */ |
44 | if(!current->active_mm || current->active_mm == &init_mm || | 43 | if(!current->active_mm || current->active_mm == &init_mm || |
45 | mm_idp != ¤t->active_mm->context.skas.id) | 44 | mm_idp != ¤t->active_mm->context.skas.id) |
46 | switch_mm_skas(mm_idp); | 45 | __switch_mm(mm_idp); |
47 | } | 46 | } |
48 | 47 | ||
49 | if(ptrace_ldt) { | 48 | if(ptrace_ldt) { |
@@ -88,7 +87,7 @@ long write_ldt_entry(struct mm_id * mm_idp, int func, struct user_desc * desc, | |||
88 | */ | 87 | */ |
89 | if(current->active_mm && current->active_mm != &init_mm && | 88 | if(current->active_mm && current->active_mm != &init_mm && |
90 | mm_idp != ¤t->active_mm->context.skas.id) | 89 | mm_idp != ¤t->active_mm->context.skas.id) |
91 | switch_mm_skas(¤t->active_mm->context.skas.id); | 90 | __switch_mm(¤t->active_mm->context.skas.id); |
92 | } | 91 | } |
93 | 92 | ||
94 | return res; | 93 | 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 @@ | |||
14 | #include "sysdep/sigcontext.h" | 14 | #include "sysdep/sigcontext.h" |
15 | #include "sysdep/sc.h" | 15 | #include "sysdep/sc.h" |
16 | 16 | ||
17 | void arch_switch_to_skas(struct task_struct *from, struct task_struct *to) | 17 | extern int arch_switch_tls(struct task_struct *from, struct task_struct *to); |
18 | |||
19 | void arch_switch_to(struct task_struct *from, struct task_struct *to) | ||
18 | { | 20 | { |
19 | int err = arch_switch_tls_skas(from, to); | 21 | int err = arch_switch_tls(from, to); |
20 | if (!err) | 22 | if (!err) |
21 | return; | 23 | return; |
22 | 24 | ||
23 | if (err != -EINVAL) | 25 | if (err != -EINVAL) |
24 | printk(KERN_WARNING "arch_switch_tls_skas failed, errno %d, not EINVAL\n", -err); | 26 | printk(KERN_WARNING "arch_switch_tls failed, errno %d, not EINVAL\n", -err); |
25 | else | 27 | else |
26 | printk(KERN_WARNING "arch_switch_tls_skas failed, errno = EINVAL\n"); | 28 | printk(KERN_WARNING "arch_switch_tls failed, errno = EINVAL\n"); |
27 | } | 29 | } |
28 | 30 | ||
29 | int is_syscall(unsigned long addr) | 31 | 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 @@ | |||
14 | #include "registers.h" | 14 | #include "registers.h" |
15 | #include "skas.h" | 15 | #include "skas.h" |
16 | 16 | ||
17 | void copy_sc(union uml_pt_regs *regs, void *from) | 17 | void copy_sc(struct uml_pt_regs *regs, void *from) |
18 | { | 18 | { |
19 | struct sigcontext *sc = from; | 19 | struct sigcontext *sc = from; |
20 | 20 | ||
21 | REGS_GS(regs->skas.regs) = sc->gs; | 21 | REGS_GS(regs->regs) = sc->gs; |
22 | REGS_FS(regs->skas.regs) = sc->fs; | 22 | REGS_FS(regs->regs) = sc->fs; |
23 | REGS_ES(regs->skas.regs) = sc->es; | 23 | REGS_ES(regs->regs) = sc->es; |
24 | REGS_DS(regs->skas.regs) = sc->ds; | 24 | REGS_DS(regs->regs) = sc->ds; |
25 | REGS_EDI(regs->skas.regs) = sc->edi; | 25 | REGS_EDI(regs->regs) = sc->edi; |
26 | REGS_ESI(regs->skas.regs) = sc->esi; | 26 | REGS_ESI(regs->regs) = sc->esi; |
27 | REGS_EBP(regs->skas.regs) = sc->ebp; | 27 | REGS_EBP(regs->regs) = sc->ebp; |
28 | REGS_SP(regs->skas.regs) = sc->esp; | 28 | REGS_SP(regs->regs) = sc->esp; |
29 | REGS_EBX(regs->skas.regs) = sc->ebx; | 29 | REGS_EBX(regs->regs) = sc->ebx; |
30 | REGS_EDX(regs->skas.regs) = sc->edx; | 30 | REGS_EDX(regs->regs) = sc->edx; |
31 | REGS_ECX(regs->skas.regs) = sc->ecx; | 31 | REGS_ECX(regs->regs) = sc->ecx; |
32 | REGS_EAX(regs->skas.regs) = sc->eax; | 32 | REGS_EAX(regs->regs) = sc->eax; |
33 | REGS_IP(regs->skas.regs) = sc->eip; | 33 | REGS_IP(regs->regs) = sc->eip; |
34 | REGS_CS(regs->skas.regs) = sc->cs; | 34 | REGS_CS(regs->regs) = sc->cs; |
35 | REGS_EFLAGS(regs->skas.regs) = sc->eflags; | 35 | REGS_EFLAGS(regs->regs) = sc->eflags; |
36 | REGS_SS(regs->skas.regs) = sc->ss; | 36 | REGS_SS(regs->regs) = sc->ss; |
37 | } | 37 | } |
38 | 38 | ||
39 | static int copy_sc_from_user_skas(struct pt_regs *regs, | 39 | static int copy_sc_from_user(struct pt_regs *regs, |
40 | struct sigcontext __user *from) | 40 | struct sigcontext __user *from) |
41 | { | 41 | { |
42 | struct sigcontext sc; | 42 | struct sigcontext sc; |
43 | unsigned long fpregs[HOST_FP_SIZE]; | 43 | unsigned long fpregs[HOST_FP_SIZE]; |
@@ -60,31 +60,32 @@ static int copy_sc_from_user_skas(struct pt_regs *regs, | |||
60 | return 0; | 60 | return 0; |
61 | } | 61 | } |
62 | 62 | ||
63 | int copy_sc_to_user_skas(struct sigcontext __user *to, struct _fpstate __user *to_fp, | 63 | static int copy_sc_to_user(struct sigcontext __user *to, |
64 | struct pt_regs *regs, unsigned long sp) | 64 | struct _fpstate __user *to_fp, struct pt_regs *regs, |
65 | unsigned long sp) | ||
65 | { | 66 | { |
66 | struct sigcontext sc; | 67 | struct sigcontext sc; |
67 | unsigned long fpregs[HOST_FP_SIZE]; | 68 | unsigned long fpregs[HOST_FP_SIZE]; |
68 | struct faultinfo * fi = ¤t->thread.arch.faultinfo; | 69 | struct faultinfo * fi = ¤t->thread.arch.faultinfo; |
69 | int err; | 70 | int err; |
70 | 71 | ||
71 | sc.gs = REGS_GS(regs->regs.skas.regs); | 72 | sc.gs = REGS_GS(regs->regs.regs); |
72 | sc.fs = REGS_FS(regs->regs.skas.regs); | 73 | sc.fs = REGS_FS(regs->regs.regs); |
73 | sc.es = REGS_ES(regs->regs.skas.regs); | 74 | sc.es = REGS_ES(regs->regs.regs); |
74 | sc.ds = REGS_DS(regs->regs.skas.regs); | 75 | sc.ds = REGS_DS(regs->regs.regs); |
75 | sc.edi = REGS_EDI(regs->regs.skas.regs); | 76 | sc.edi = REGS_EDI(regs->regs.regs); |
76 | sc.esi = REGS_ESI(regs->regs.skas.regs); | 77 | sc.esi = REGS_ESI(regs->regs.regs); |
77 | sc.ebp = REGS_EBP(regs->regs.skas.regs); | 78 | sc.ebp = REGS_EBP(regs->regs.regs); |
78 | sc.esp = sp; | 79 | sc.esp = sp; |
79 | sc.ebx = REGS_EBX(regs->regs.skas.regs); | 80 | sc.ebx = REGS_EBX(regs->regs.regs); |
80 | sc.edx = REGS_EDX(regs->regs.skas.regs); | 81 | sc.edx = REGS_EDX(regs->regs.regs); |
81 | sc.ecx = REGS_ECX(regs->regs.skas.regs); | 82 | sc.ecx = REGS_ECX(regs->regs.regs); |
82 | sc.eax = REGS_EAX(regs->regs.skas.regs); | 83 | sc.eax = REGS_EAX(regs->regs.regs); |
83 | sc.eip = REGS_IP(regs->regs.skas.regs); | 84 | sc.eip = REGS_IP(regs->regs.regs); |
84 | sc.cs = REGS_CS(regs->regs.skas.regs); | 85 | sc.cs = REGS_CS(regs->regs.regs); |
85 | sc.eflags = REGS_EFLAGS(regs->regs.skas.regs); | 86 | sc.eflags = REGS_EFLAGS(regs->regs.regs); |
86 | sc.esp_at_signal = regs->regs.skas.regs[UESP]; | 87 | sc.esp_at_signal = regs->regs.regs[UESP]; |
87 | sc.ss = regs->regs.skas.regs[SS]; | 88 | sc.ss = regs->regs.regs[SS]; |
88 | sc.cr2 = fi->cr2; | 89 | sc.cr2 = fi->cr2; |
89 | sc.err = fi->error_code; | 90 | sc.err = fi->error_code; |
90 | sc.trapno = fi->trap_no; | 91 | sc.trapno = fi->trap_no; |
@@ -105,17 +106,6 @@ int copy_sc_to_user_skas(struct sigcontext __user *to, struct _fpstate __user *t | |||
105 | copy_to_user(to_fp, fpregs, sizeof(fpregs)); | 106 | copy_to_user(to_fp, fpregs, sizeof(fpregs)); |
106 | } | 107 | } |
107 | 108 | ||
108 | static int copy_sc_from_user(struct pt_regs *to, void __user *from) | ||
109 | { | ||
110 | return copy_sc_from_user_skas(to, from); | ||
111 | } | ||
112 | |||
113 | static int copy_sc_to_user(struct sigcontext __user *to, struct _fpstate __user *fp, | ||
114 | struct pt_regs *from, unsigned long sp) | ||
115 | { | ||
116 | return copy_sc_to_user_skas(to, fp, from, sp); | ||
117 | } | ||
118 | |||
119 | static int copy_ucontext_to_user(struct ucontext __user *uc, struct _fpstate __user *fp, | 109 | static int copy_ucontext_to_user(struct ucontext __user *uc, struct _fpstate __user *fp, |
120 | sigset_t *set, unsigned long sp) | 110 | sigset_t *set, unsigned long sp) |
121 | { | 111 | { |
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 @@ | |||
14 | #include "asm/desc.h" | 14 | #include "asm/desc.h" |
15 | #include "kern.h" | 15 | #include "kern.h" |
16 | #include "kern_util.h" | 16 | #include "kern_util.h" |
17 | #include "mode_kern.h" | ||
18 | #include "os.h" | 17 | #include "os.h" |
19 | #include "mode.h" | ||
20 | #include "skas.h" | 18 | #include "skas.h" |
21 | 19 | ||
22 | /* | 20 | /* |
@@ -167,7 +165,7 @@ void clear_flushed_tls(struct task_struct *task) | |||
167 | * And this will not need be used when (and if) we'll add support to the host | 165 | * And this will not need be used when (and if) we'll add support to the host |
168 | * SKAS patch. */ | 166 | * SKAS patch. */ |
169 | 167 | ||
170 | int arch_switch_tls_skas(struct task_struct *from, struct task_struct *to) | 168 | int arch_switch_tls(struct task_struct *from, struct task_struct *to) |
171 | { | 169 | { |
172 | if (!host_supports_tls) | 170 | if (!host_supports_tls) |
173 | return 0; | 171 | return 0; |