diff options
| -rw-r--r-- | arch/x86/kernel/process_64.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c index ad213494a22f..4a93c98a60a2 100644 --- a/arch/x86/kernel/process_64.c +++ b/arch/x86/kernel/process_64.c | |||
| @@ -500,7 +500,6 @@ static inline void __switch_to_xtra(struct task_struct *prev_p, | |||
| 500 | { | 500 | { |
| 501 | struct thread_struct *prev, *next; | 501 | struct thread_struct *prev, *next; |
| 502 | unsigned long debugctl; | 502 | unsigned long debugctl; |
| 503 | unsigned long ds_prev = 0, ds_next = 0; | ||
| 504 | 503 | ||
| 505 | prev = &prev_p->thread, | 504 | prev = &prev_p->thread, |
| 506 | next = &next_p->thread; | 505 | next = &next_p->thread; |
| @@ -508,17 +507,23 @@ static inline void __switch_to_xtra(struct task_struct *prev_p, | |||
| 508 | debugctl = prev->debugctlmsr; | 507 | debugctl = prev->debugctlmsr; |
| 509 | 508 | ||
| 510 | #ifdef CONFIG_X86_DS | 509 | #ifdef CONFIG_X86_DS |
| 511 | if (prev->ds_ctx) | 510 | { |
| 512 | ds_prev = (unsigned long)prev->ds_ctx->ds; | 511 | unsigned long ds_prev = 0, ds_next = 0; |
| 513 | if (next->ds_ctx) | 512 | |
| 514 | ds_next = (unsigned long)next->ds_ctx->ds; | 513 | if (prev->ds_ctx) |
| 515 | 514 | ds_prev = (unsigned long)prev->ds_ctx->ds; | |
| 516 | if (ds_next != ds_prev) { | 515 | if (next->ds_ctx) |
| 517 | /* we clear debugctl to make sure DS | 516 | ds_next = (unsigned long)next->ds_ctx->ds; |
| 518 | * is not in use when we change it */ | 517 | |
| 519 | debugctl = 0; | 518 | if (ds_next != ds_prev) { |
| 520 | update_debugctlmsr(0); | 519 | /* |
| 521 | wrmsrl(MSR_IA32_DS_AREA, ds_next); | 520 | * We clear debugctl to make sure DS |
| 521 | * is not in use when we change it: | ||
| 522 | */ | ||
| 523 | debugctl = 0; | ||
| 524 | update_debugctlmsr(0); | ||
| 525 | wrmsrl(MSR_IA32_DS_AREA, ds_next); | ||
| 526 | } | ||
| 522 | } | 527 | } |
| 523 | #endif /* CONFIG_X86_DS */ | 528 | #endif /* CONFIG_X86_DS */ |
| 524 | 529 | ||
