diff options
| -rw-r--r-- | arch/i386/kernel/asm-offsets.c | 2 | ||||
| -rw-r--r-- | arch/i386/kernel/cpu/common.c | 2 | ||||
| -rw-r--r-- | arch/i386/kernel/process.c | 1 | ||||
| -rw-r--r-- | include/asm-i386/current.h | 7 | ||||
| -rw-r--r-- | include/asm-i386/pda.h | 2 |
5 files changed, 11 insertions, 3 deletions
diff --git a/arch/i386/kernel/asm-offsets.c b/arch/i386/kernel/asm-offsets.c index 85f1b038e9c3..0666eb0ed7bc 100644 --- a/arch/i386/kernel/asm-offsets.c +++ b/arch/i386/kernel/asm-offsets.c | |||
| @@ -15,6 +15,7 @@ | |||
| 15 | #include <asm/processor.h> | 15 | #include <asm/processor.h> |
| 16 | #include <asm/thread_info.h> | 16 | #include <asm/thread_info.h> |
| 17 | #include <asm/elf.h> | 17 | #include <asm/elf.h> |
| 18 | #include <asm/pda.h> | ||
| 18 | 19 | ||
| 19 | #define DEFINE(sym, val) \ | 20 | #define DEFINE(sym, val) \ |
| 20 | asm volatile("\n->" #sym " %0 " #val : : "i" (val)) | 21 | asm volatile("\n->" #sym " %0 " #val : : "i" (val)) |
| @@ -99,4 +100,5 @@ void foo(void) | |||
| 99 | 100 | ||
| 100 | BLANK(); | 101 | BLANK(); |
| 101 | OFFSET(PDA_cpu, i386_pda, cpu_number); | 102 | OFFSET(PDA_cpu, i386_pda, cpu_number); |
| 103 | OFFSET(PDA_pcurrent, i386_pda, pcurrent); | ||
| 102 | } | 104 | } |
diff --git a/arch/i386/kernel/cpu/common.c b/arch/i386/kernel/cpu/common.c index e476202b887f..6958ae5e2fa5 100644 --- a/arch/i386/kernel/cpu/common.c +++ b/arch/i386/kernel/cpu/common.c | |||
| @@ -651,6 +651,7 @@ __cpuinit int alloc_gdt(int cpu) | |||
| 651 | struct i386_pda boot_pda = { | 651 | struct i386_pda boot_pda = { |
| 652 | ._pda = &boot_pda, | 652 | ._pda = &boot_pda, |
| 653 | .cpu_number = 0, | 653 | .cpu_number = 0, |
| 654 | .pcurrent = &init_task, | ||
| 654 | }; | 655 | }; |
| 655 | 656 | ||
| 656 | static inline void set_kernel_gs(void) | 657 | static inline void set_kernel_gs(void) |
| @@ -696,6 +697,7 @@ __cpuinit int init_gdt(int cpu, struct task_struct *idle) | |||
| 696 | memset(pda, 0, sizeof(*pda)); | 697 | memset(pda, 0, sizeof(*pda)); |
| 697 | pda->_pda = pda; | 698 | pda->_pda = pda; |
| 698 | pda->cpu_number = cpu; | 699 | pda->cpu_number = cpu; |
| 700 | pda->pcurrent = idle; | ||
| 699 | 701 | ||
| 700 | return 1; | 702 | return 1; |
| 701 | } | 703 | } |
diff --git a/arch/i386/kernel/process.c b/arch/i386/kernel/process.c index dc4272545179..8749b10d3805 100644 --- a/arch/i386/kernel/process.c +++ b/arch/i386/kernel/process.c | |||
| @@ -684,6 +684,7 @@ struct task_struct fastcall * __switch_to(struct task_struct *prev_p, struct tas | |||
| 684 | if (unlikely(prev->fs | next->fs)) | 684 | if (unlikely(prev->fs | next->fs)) |
| 685 | loadsegment(fs, next->fs); | 685 | loadsegment(fs, next->fs); |
| 686 | 686 | ||
| 687 | write_pda(pcurrent, next_p); | ||
| 687 | 688 | ||
| 688 | /* | 689 | /* |
| 689 | * Restore IOPL if needed. | 690 | * Restore IOPL if needed. |
diff --git a/include/asm-i386/current.h b/include/asm-i386/current.h index 3cbbecd79016..5252ee0f6d7a 100644 --- a/include/asm-i386/current.h +++ b/include/asm-i386/current.h | |||
| @@ -1,13 +1,14 @@ | |||
| 1 | #ifndef _I386_CURRENT_H | 1 | #ifndef _I386_CURRENT_H |
| 2 | #define _I386_CURRENT_H | 2 | #define _I386_CURRENT_H |
| 3 | 3 | ||
| 4 | #include <linux/thread_info.h> | 4 | #include <asm/pda.h> |
| 5 | #include <linux/compiler.h> | ||
| 5 | 6 | ||
| 6 | struct task_struct; | 7 | struct task_struct; |
| 7 | 8 | ||
| 8 | static __always_inline struct task_struct * get_current(void) | 9 | static __always_inline struct task_struct *get_current(void) |
| 9 | { | 10 | { |
| 10 | return current_thread_info()->task; | 11 | return read_pda(pcurrent); |
| 11 | } | 12 | } |
| 12 | 13 | ||
| 13 | #define current get_current() | 14 | #define current get_current() |
diff --git a/include/asm-i386/pda.h b/include/asm-i386/pda.h index f90fde22566d..08a35c478af2 100644 --- a/include/asm-i386/pda.h +++ b/include/asm-i386/pda.h | |||
| @@ -7,12 +7,14 @@ | |||
| 7 | #define _I386_PDA_H | 7 | #define _I386_PDA_H |
| 8 | 8 | ||
| 9 | #include <linux/stddef.h> | 9 | #include <linux/stddef.h> |
| 10 | #include <linux/types.h> | ||
| 10 | 11 | ||
| 11 | struct i386_pda | 12 | struct i386_pda |
| 12 | { | 13 | { |
| 13 | struct i386_pda *_pda; /* pointer to self */ | 14 | struct i386_pda *_pda; /* pointer to self */ |
| 14 | 15 | ||
| 15 | int cpu_number; | 16 | int cpu_number; |
| 17 | struct task_struct *pcurrent; /* current process */ | ||
| 16 | }; | 18 | }; |
| 17 | 19 | ||
| 18 | extern struct i386_pda *_cpu_pda[]; | 20 | extern struct i386_pda *_cpu_pda[]; |
