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:42:00 -0500 |
commit | ccbeed3a05908d201b47b6c3dd1a373138bba566 (patch) | |
tree | e834d548c70426aa3885dd2169be1a79be4a617b /arch/x86/kernel/process_32.c | |
parent | d9a89a26e02ef9ed03f74a755a8b4d8f3a066622 (diff) |
x86: make lazy %gs optional on x86_32
Impact: pt_regs changed, lazy gs handling made optional, add slight
overhead to SAVE_ALL, simplifies error_code path a bit
On x86_32, %gs hasn't been used by kernel and handled lazily. pt_regs
doesn't have place for it and gs is saved/loaded only when necessary.
In preparation for stack protector support, this patch makes lazy %gs
handling optional by doing the followings.
* Add CONFIG_X86_32_LAZY_GS and place for gs in pt_regs.
* Save and restore %gs along with other registers in entry_32.S unless
LAZY_GS. Note that this unfortunately adds "pushl $0" on SAVE_ALL
even when LAZY_GS. However, it adds no overhead to common exit path
and simplifies entry path with error code.
* Define different user_gs accessors depending on LAZY_GS and add
lazy_save_gs() and lazy_load_gs() which are noop if !LAZY_GS. The
lazy_*_gs() ops are used to save, load and clear %gs lazily.
* Define ELF_CORE_COPY_KERNEL_REGS() which always read %gs directly.
xen and lguest changes need to be verified.
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Jeremy Fitzhardinge <jeremy@xensource.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
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 | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c index d58a340e1be3..86122fa2a1ba 100644 --- a/arch/x86/kernel/process_32.c +++ b/arch/x86/kernel/process_32.c | |||
@@ -539,7 +539,7 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) | |||
539 | * used %fs or %gs (it does not today), or if the kernel is | 539 | * used %fs or %gs (it does not today), or if the kernel is |
540 | * running inside of a hypervisor layer. | 540 | * running inside of a hypervisor layer. |
541 | */ | 541 | */ |
542 | savesegment(gs, prev->gs); | 542 | lazy_save_gs(prev->gs); |
543 | 543 | ||
544 | /* | 544 | /* |
545 | * Load the per-thread Thread-Local Storage descriptor. | 545 | * Load the per-thread Thread-Local Storage descriptor. |
@@ -585,7 +585,7 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) | |||
585 | * Restore %gs if needed (which is common) | 585 | * Restore %gs if needed (which is common) |
586 | */ | 586 | */ |
587 | if (prev->gs | next->gs) | 587 | if (prev->gs | next->gs) |
588 | loadsegment(gs, next->gs); | 588 | lazy_load_gs(next->gs); |
589 | 589 | ||
590 | percpu_write(current_task, next_p); | 590 | percpu_write(current_task, next_p); |
591 | 591 | ||