diff options
author | Tejun Heo <tj@kernel.org> | 2009-02-09 08:17:40 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-02-09 18:41:58 -0500 |
commit | d9a89a26e02ef9ed03f74a755a8b4d8f3a066622 (patch) | |
tree | 35f3713bca4e6b815f6b9db92dc9d812ec7213ff /arch/x86/kernel/process_32.c | |
parent | f0d96110f9fd98a1a22e03b8adba69508843d910 (diff) |
x86: add %gs accessors for x86_32
Impact: cleanup
On x86_32, %gs is handled lazily. It's not saved and restored on
kernel entry/exit but only when necessary which usually is during task
switch but there are few other places. Currently, it's done by
calling savesegment() and loadsegment() explicitly. Define
get_user_gs(), set_user_gs() and task_user_gs() and use them instead.
While at it, clean up register access macros in signal.c.
This cleans up code a bit and will help future changes.
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/process_32.c')
-rw-r--r-- | arch/x86/kernel/process_32.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c index 1a1ae8edc40c..d58a340e1be3 100644 --- a/arch/x86/kernel/process_32.c +++ b/arch/x86/kernel/process_32.c | |||
@@ -131,7 +131,7 @@ void __show_regs(struct pt_regs *regs, int all) | |||
131 | if (user_mode_vm(regs)) { | 131 | if (user_mode_vm(regs)) { |
132 | sp = regs->sp; | 132 | sp = regs->sp; |
133 | ss = regs->ss & 0xffff; | 133 | ss = regs->ss & 0xffff; |
134 | savesegment(gs, gs); | 134 | gs = get_user_gs(regs); |
135 | } else { | 135 | } else { |
136 | sp = (unsigned long) (®s->sp); | 136 | sp = (unsigned long) (®s->sp); |
137 | savesegment(ss, ss); | 137 | savesegment(ss, ss); |
@@ -304,7 +304,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp, | |||
304 | 304 | ||
305 | p->thread.ip = (unsigned long) ret_from_fork; | 305 | p->thread.ip = (unsigned long) ret_from_fork; |
306 | 306 | ||
307 | savesegment(gs, p->thread.gs); | 307 | task_user_gs(p) = get_user_gs(regs); |
308 | 308 | ||
309 | tsk = current; | 309 | tsk = current; |
310 | if (unlikely(test_tsk_thread_flag(tsk, TIF_IO_BITMAP))) { | 310 | if (unlikely(test_tsk_thread_flag(tsk, TIF_IO_BITMAP))) { |
@@ -342,7 +342,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp, | |||
342 | void | 342 | void |
343 | start_thread(struct pt_regs *regs, unsigned long new_ip, unsigned long new_sp) | 343 | start_thread(struct pt_regs *regs, unsigned long new_ip, unsigned long new_sp) |
344 | { | 344 | { |
345 | __asm__("movl %0, %%gs" : : "r"(0)); | 345 | set_user_gs(regs, 0); |
346 | regs->fs = 0; | 346 | regs->fs = 0; |
347 | set_fs(USER_DS); | 347 | set_fs(USER_DS); |
348 | regs->ds = __USER_DS; | 348 | regs->ds = __USER_DS; |