diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-01-18 12:37:14 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-01-18 12:37:14 -0500 |
commit | b2b062b8163391c42b3219d466ca1ac9742b9c7b (patch) | |
tree | f3f920c09b8de694b1bc1d4b878cfd2b0b98c913 /arch/x86/kernel/process_64.c | |
parent | a9de18eb761f7c1c860964b2e5addc1a35c7e861 (diff) | |
parent | 99937d6455cea95405ac681c86a857d0fcd530bd (diff) |
Merge branch 'core/percpu' into stackprotector
Conflicts:
arch/x86/include/asm/pda.h
arch/x86/include/asm/system.h
Also, moved include/asm-x86/stackprotector.h to arch/x86/include/asm.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/process_64.c')
-rw-r--r-- | arch/x86/kernel/process_64.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c index efb0396e19bf..aa89eabf09e0 100644 --- a/arch/x86/kernel/process_64.c +++ b/arch/x86/kernel/process_64.c | |||
@@ -58,6 +58,12 @@ | |||
58 | 58 | ||
59 | asmlinkage extern void ret_from_fork(void); | 59 | asmlinkage extern void ret_from_fork(void); |
60 | 60 | ||
61 | DEFINE_PER_CPU(struct task_struct *, current_task) = &init_task; | ||
62 | EXPORT_PER_CPU_SYMBOL(current_task); | ||
63 | |||
64 | DEFINE_PER_CPU(unsigned long, old_rsp); | ||
65 | static DEFINE_PER_CPU(unsigned char, is_idle); | ||
66 | |||
61 | unsigned long kernel_thread_flags = CLONE_VM | CLONE_UNTRACED; | 67 | unsigned long kernel_thread_flags = CLONE_VM | CLONE_UNTRACED; |
62 | 68 | ||
63 | static ATOMIC_NOTIFIER_HEAD(idle_notifier); | 69 | static ATOMIC_NOTIFIER_HEAD(idle_notifier); |
@@ -76,13 +82,13 @@ EXPORT_SYMBOL_GPL(idle_notifier_unregister); | |||
76 | 82 | ||
77 | void enter_idle(void) | 83 | void enter_idle(void) |
78 | { | 84 | { |
79 | write_pda(isidle, 1); | 85 | percpu_write(is_idle, 1); |
80 | atomic_notifier_call_chain(&idle_notifier, IDLE_START, NULL); | 86 | atomic_notifier_call_chain(&idle_notifier, IDLE_START, NULL); |
81 | } | 87 | } |
82 | 88 | ||
83 | static void __exit_idle(void) | 89 | static void __exit_idle(void) |
84 | { | 90 | { |
85 | if (test_and_clear_bit_pda(0, isidle) == 0) | 91 | if (x86_test_and_clear_bit_percpu(0, is_idle) == 0) |
86 | return; | 92 | return; |
87 | atomic_notifier_call_chain(&idle_notifier, IDLE_END, NULL); | 93 | atomic_notifier_call_chain(&idle_notifier, IDLE_END, NULL); |
88 | } | 94 | } |
@@ -404,7 +410,7 @@ start_thread(struct pt_regs *regs, unsigned long new_ip, unsigned long new_sp) | |||
404 | load_gs_index(0); | 410 | load_gs_index(0); |
405 | regs->ip = new_ip; | 411 | regs->ip = new_ip; |
406 | regs->sp = new_sp; | 412 | regs->sp = new_sp; |
407 | write_pda(oldrsp, new_sp); | 413 | percpu_write(old_rsp, new_sp); |
408 | regs->cs = __USER_CS; | 414 | regs->cs = __USER_CS; |
409 | regs->ss = __USER_DS; | 415 | regs->ss = __USER_DS; |
410 | regs->flags = 0x200; | 416 | regs->flags = 0x200; |
@@ -625,13 +631,13 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) | |||
625 | /* | 631 | /* |
626 | * Switch the PDA and FPU contexts. | 632 | * Switch the PDA and FPU contexts. |
627 | */ | 633 | */ |
628 | prev->usersp = read_pda(oldrsp); | 634 | prev->usersp = percpu_read(old_rsp); |
629 | write_pda(oldrsp, next->usersp); | 635 | percpu_write(old_rsp, next->usersp); |
630 | write_pda(pcurrent, next_p); | 636 | percpu_write(current_task, next_p); |
631 | 637 | ||
632 | write_pda(kernelstack, | 638 | percpu_write(kernel_stack, |
633 | (unsigned long)task_stack_page(next_p) + | 639 | (unsigned long)task_stack_page(next_p) + |
634 | THREAD_SIZE - PDA_STACKOFFSET); | 640 | THREAD_SIZE - KERNEL_STACK_OFFSET); |
635 | #ifdef CONFIG_CC_STACKPROTECTOR | 641 | #ifdef CONFIG_CC_STACKPROTECTOR |
636 | /* | 642 | /* |
637 | * Build time only check to make sure the stack_canary is at | 643 | * Build time only check to make sure the stack_canary is at |