aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/sys-i386/tls.c
diff options
context:
space:
mode:
authorPaolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>2006-03-31 05:30:24 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-31 15:18:52 -0500
commit54d8d3b5a0ce1cdbad1d3154c9ea9732d394e9c7 (patch)
tree129a29ab92fba7dc99229c87a38fe8df3ade7b15 /arch/um/sys-i386/tls.c
parentdd77aec07aec5cb81aed3b4ef79c1ff8bd0e2a68 (diff)
[PATCH] uml: add arch_switch_to for newly forked thread
Newly forked threads have no arch_switch_to_skas() called before their first run, because when schedule() switches to them they're resumed in the body of thread_wait() inside fork_handler() rather than in switch_threads() in switch_to_skas(). Compensate this missing call. Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> Acked-by: Jeff Dike <jdike@addtoit.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/um/sys-i386/tls.c')
-rw-r--r--arch/um/sys-i386/tls.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/arch/um/sys-i386/tls.c b/arch/um/sys-i386/tls.c
index e3c5bc593fae..2251654c6b45 100644
--- a/arch/um/sys-i386/tls.c
+++ b/arch/um/sys-i386/tls.c
@@ -70,8 +70,6 @@ static int get_free_idx(struct task_struct* task)
70 return -ESRCH; 70 return -ESRCH;
71} 71}
72 72
73#define O_FORCE 1
74
75static inline void clear_user_desc(struct user_desc* info) 73static inline void clear_user_desc(struct user_desc* info)
76{ 74{
77 /* Postcondition: LDT_empty(info) returns true. */ 75 /* Postcondition: LDT_empty(info) returns true. */
@@ -84,6 +82,8 @@ static inline void clear_user_desc(struct user_desc* info)
84 info->seg_not_present = 1; 82 info->seg_not_present = 1;
85} 83}
86 84
85#define O_FORCE 1
86
87static int load_TLS(int flags, struct task_struct *to) 87static int load_TLS(int flags, struct task_struct *to)
88{ 88{
89 int ret = 0; 89 int ret = 0;
@@ -162,7 +162,13 @@ void clear_flushed_tls(struct task_struct *task)
162 * SKAS patch. */ 162 * SKAS patch. */
163int arch_switch_tls_skas(struct task_struct *from, struct task_struct *to) 163int arch_switch_tls_skas(struct task_struct *from, struct task_struct *to)
164{ 164{
165 return load_TLS(O_FORCE, to); 165 /* We have no need whatsoever to switch TLS for kernel threads; beyond
166 * that, that would also result in us calling os_set_thread_area with
167 * userspace_pid[cpu] == 0, which gives an error. */
168 if (likely(to->mm))
169 return load_TLS(O_FORCE, to);
170
171 return 0;
166} 172}
167 173
168int arch_switch_tls_tt(struct task_struct *from, struct task_struct *to) 174int arch_switch_tls_tt(struct task_struct *from, struct task_struct *to)
@@ -324,3 +330,4 @@ int ptrace_get_thread_area(struct task_struct *child, int idx,
324out: 330out:
325 return ret; 331 return ret;
326} 332}
333