aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2008-02-05 01:30:54 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-05 12:44:28 -0500
commita5a678c80beac4d163babda243a27eeb9c89bd89 (patch)
treeabf94fe11f82a642727fcbddceee647c7effc5f2
parent009ec2a915ba52f6b647c4076f4a2e259cba85aa (diff)
uml: current.h cleanup
Tidy current-related stuff. There was a comment in current.h saying that current_thread was obsolete, so this patch turns all instances of current_thread into current_thread_info(). There's some simplifying of the result in arch/um/sys-i386/signal.c. current.h and thread_info also get style cleanups. 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>
-rw-r--r--arch/um/kernel/process.c8
-rw-r--r--arch/um/sys-i386/signal.c18
-rw-r--r--arch/um/sys-x86_64/signal.c4
-rw-r--r--include/asm-um/current.h23
-rw-r--r--include/asm-um/thread_info.h8
5 files changed, 20 insertions, 41 deletions
diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c
index 570471218086..ae1942eeb994 100644
--- a/arch/um/kernel/process.c
+++ b/arch/um/kernel/process.c
@@ -251,7 +251,7 @@ void default_idle(void)
251 251
252void cpu_idle(void) 252void cpu_idle(void)
253{ 253{
254 cpu_tasks[current_thread->cpu].pid = os_getpid(); 254 cpu_tasks[current_thread_info()->cpu].pid = os_getpid();
255 default_idle(); 255 default_idle();
256} 256}
257 257
@@ -269,7 +269,7 @@ int user_context(unsigned long sp)
269 unsigned long stack; 269 unsigned long stack;
270 270
271 stack = sp & (PAGE_MASK << CONFIG_KERNEL_STACK_ORDER); 271 stack = sp & (PAGE_MASK << CONFIG_KERNEL_STACK_ORDER);
272 return stack != (unsigned long) current_thread; 272 return stack != (unsigned long) current_thread_info();
273} 273}
274 274
275extern exitcall_t __uml_exitcall_begin, __uml_exitcall_end; 275extern exitcall_t __uml_exitcall_begin, __uml_exitcall_end;
@@ -311,7 +311,7 @@ int strlen_user_proc(char __user *str)
311int smp_sigio_handler(void) 311int smp_sigio_handler(void)
312{ 312{
313#ifdef CONFIG_SMP 313#ifdef CONFIG_SMP
314 int cpu = current_thread->cpu; 314 int cpu = current_thread_info()->cpu;
315 IPI_handler(cpu); 315 IPI_handler(cpu);
316 if (cpu != 0) 316 if (cpu != 0)
317 return 1; 317 return 1;
@@ -321,7 +321,7 @@ int smp_sigio_handler(void)
321 321
322int cpu(void) 322int cpu(void)
323{ 323{
324 return current_thread->cpu; 324 return current_thread_info()->cpu;
325} 325}
326 326
327static atomic_t using_sysemu = ATOMIC_INIT(0); 327static atomic_t using_sysemu = ATOMIC_INIT(0);
diff --git a/arch/um/sys-i386/signal.c b/arch/um/sys-i386/signal.c
index 19053d46cb60..fd0c25ad6af3 100644
--- a/arch/um/sys-i386/signal.c
+++ b/arch/um/sys-i386/signal.c
@@ -168,12 +168,13 @@ static int copy_sc_from_user(struct pt_regs *regs,
168 struct sigcontext __user *from) 168 struct sigcontext __user *from)
169{ 169{
170 struct sigcontext sc; 170 struct sigcontext sc;
171 int err; 171 int err, pid;
172 172
173 err = copy_from_user(&sc, from, sizeof(sc)); 173 err = copy_from_user(&sc, from, sizeof(sc));
174 if (err) 174 if (err)
175 return err; 175 return err;
176 176
177 pid = userspace_pid[current_thread_info()->cpu];
177 copy_sc(&regs->regs, &sc); 178 copy_sc(&regs->regs, &sc);
178 if (have_fpx_regs) { 179 if (have_fpx_regs) {
179 struct user_fxsr_struct fpx; 180 struct user_fxsr_struct fpx;
@@ -187,8 +188,7 @@ static int copy_sc_from_user(struct pt_regs *regs,
187 if (err) 188 if (err)
188 return 1; 189 return 1;
189 190
190 err = restore_fpx_registers(userspace_pid[current_thread->cpu], 191 err = restore_fpx_registers(pid, (unsigned long *) &fpx);
191 (unsigned long *) &fpx);
192 if (err < 0) { 192 if (err < 0) {
193 printk(KERN_ERR "copy_sc_from_user - " 193 printk(KERN_ERR "copy_sc_from_user - "
194 "restore_fpx_registers failed, errno = %d\n", 194 "restore_fpx_registers failed, errno = %d\n",
@@ -204,8 +204,7 @@ static int copy_sc_from_user(struct pt_regs *regs,
204 if (err) 204 if (err)
205 return 1; 205 return 1;
206 206
207 err = restore_fp_registers(userspace_pid[current_thread->cpu], 207 err = restore_fp_registers(pid, (unsigned long *) &fp);
208 (unsigned long *) &fp);
209 if (err < 0) { 208 if (err < 0) {
210 printk(KERN_ERR "copy_sc_from_user - " 209 printk(KERN_ERR "copy_sc_from_user - "
211 "restore_fp_registers failed, errno = %d\n", 210 "restore_fp_registers failed, errno = %d\n",
@@ -223,7 +222,7 @@ static int copy_sc_to_user(struct sigcontext __user *to,
223{ 222{
224 struct sigcontext sc; 223 struct sigcontext sc;
225 struct faultinfo * fi = &current->thread.arch.faultinfo; 224 struct faultinfo * fi = &current->thread.arch.faultinfo;
226 int err; 225 int err, pid;
227 226
228 sc.gs = REGS_GS(regs->regs.gp); 227 sc.gs = REGS_GS(regs->regs.gp);
229 sc.fs = REGS_FS(regs->regs.gp); 228 sc.fs = REGS_FS(regs->regs.gp);
@@ -249,11 +248,11 @@ static int copy_sc_to_user(struct sigcontext __user *to,
249 to_fp = (to_fp ? to_fp : (struct _fpstate __user *) (to + 1)); 248 to_fp = (to_fp ? to_fp : (struct _fpstate __user *) (to + 1));
250 sc.fpstate = to_fp; 249 sc.fpstate = to_fp;
251 250
251 pid = userspace_pid[current_thread_info()->cpu];
252 if (have_fpx_regs) { 252 if (have_fpx_regs) {
253 struct user_fxsr_struct fpx; 253 struct user_fxsr_struct fpx;
254 254
255 err = save_fpx_registers(userspace_pid[current_thread->cpu], 255 err = save_fpx_registers(pid, (unsigned long *) &fpx);
256 (unsigned long *) &fpx);
257 if (err < 0){ 256 if (err < 0){
258 printk(KERN_ERR "copy_sc_to_user - save_fpx_registers " 257 printk(KERN_ERR "copy_sc_to_user - save_fpx_registers "
259 "failed, errno = %d\n", err); 258 "failed, errno = %d\n", err);
@@ -276,8 +275,7 @@ static int copy_sc_to_user(struct sigcontext __user *to,
276 else { 275 else {
277 struct user_i387_struct fp; 276 struct user_i387_struct fp;
278 277
279 err = save_fp_registers(userspace_pid[current_thread->cpu], 278 err = save_fp_registers(pid, (unsigned long *) &fp);
280 (unsigned long *) &fp);
281 if (copy_to_user(to_fp, &fp, sizeof(struct user_i387_struct))) 279 if (copy_to_user(to_fp, &fp, sizeof(struct user_i387_struct)))
282 return 1; 280 return 1;
283 } 281 }
diff --git a/arch/um/sys-x86_64/signal.c b/arch/um/sys-x86_64/signal.c
index 14070181407b..1a899a7ed7a6 100644
--- a/arch/um/sys-x86_64/signal.c
+++ b/arch/um/sys-x86_64/signal.c
@@ -81,7 +81,7 @@ static int copy_sc_from_user(struct pt_regs *regs,
81 if (err) 81 if (err)
82 return 1; 82 return 1;
83 83
84 err = restore_fp_registers(userspace_pid[current_thread->cpu], 84 err = restore_fp_registers(userspace_pid[current_thread_info()->cpu],
85 (unsigned long *) &fp); 85 (unsigned long *) &fp);
86 if (err < 0) { 86 if (err < 0) {
87 printk(KERN_ERR "copy_sc_from_user - " 87 printk(KERN_ERR "copy_sc_from_user - "
@@ -143,7 +143,7 @@ static int copy_sc_to_user(struct sigcontext __user *to,
143 if (err) 143 if (err)
144 return 1; 144 return 1;
145 145
146 err = save_fp_registers(userspace_pid[current_thread->cpu], 146 err = save_fp_registers(userspace_pid[current_thread_info()->cpu],
147 (unsigned long *) &fp); 147 (unsigned long *) &fp);
148 if (err < 0) { 148 if (err < 0) {
149 printk(KERN_ERR "copy_sc_from_user - restore_fp_registers " 149 printk(KERN_ERR "copy_sc_from_user - restore_fp_registers "
diff --git a/include/asm-um/current.h b/include/asm-um/current.h
index 8fd72f69ce65..c2191d9aa03d 100644
--- a/include/asm-um/current.h
+++ b/include/asm-um/current.h
@@ -1,32 +1,13 @@
1/* 1/*
2 * Copyright (C) 2000 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#ifndef __UM_CURRENT_H 6#ifndef __UM_CURRENT_H
7#define __UM_CURRENT_H 7#define __UM_CURRENT_H
8 8
9#ifndef __ASSEMBLY__
10
11#include "asm/page.h"
12#include "linux/thread_info.h" 9#include "linux/thread_info.h"
13 10
14#define current (current_thread_info()->task) 11#define current (current_thread_info()->task)
15 12
16/*Backward compatibility - it's used inside arch/um.*/
17#define current_thread current_thread_info()
18
19#endif /* __ASSEMBLY__ */
20
21#endif 13#endif
22
23/*
24 * Overrides for Emacs so that we follow Linus's tabbing style.
25 * Emacs will notice this stuff at the end of the file and automatically
26 * adjust the settings for this buffer only. This must remain at the end
27 * of the file.
28 * ---------------------------------------------------------------------------
29 * Local variables:
30 * c-file-style: "linux"
31 * End:
32 */
diff --git a/include/asm-um/thread_info.h b/include/asm-um/thread_info.h
index cdfc91cb77a8..356b83e2c22e 100644
--- a/include/asm-um/thread_info.h
+++ b/include/asm-um/thread_info.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
@@ -76,8 +76,8 @@ static inline struct thread_info *current_thread_info(void)
76#define TIF_SYSCALL_TRACE 0 /* syscall trace active */ 76#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
77#define TIF_SIGPENDING 1 /* signal pending */ 77#define TIF_SIGPENDING 1 /* signal pending */
78#define TIF_NEED_RESCHED 2 /* rescheduling necessary */ 78#define TIF_NEED_RESCHED 2 /* rescheduling necessary */
79#define TIF_POLLING_NRFLAG 3 /* true if poll_idle() is polling 79#define TIF_POLLING_NRFLAG 3 /* true if poll_idle() is polling
80 * TIF_NEED_RESCHED 80 * TIF_NEED_RESCHED
81 */ 81 */
82#define TIF_RESTART_BLOCK 4 82#define TIF_RESTART_BLOCK 4
83#define TIF_MEMDIE 5 83#define TIF_MEMDIE 5