diff options
| -rw-r--r-- | arch/x86/kernel/process_32.c | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c index 5cec8a75a4e8..496ea3110aa2 100644 --- a/arch/x86/kernel/process_32.c +++ b/arch/x86/kernel/process_32.c | |||
| @@ -484,20 +484,13 @@ int set_tsc_mode(unsigned int val) | |||
| 484 | return 0; | 484 | return 0; |
| 485 | } | 485 | } |
| 486 | 486 | ||
| 487 | static noinline void | 487 | #ifdef CONFIG_X86_DS |
| 488 | __switch_to_xtra(struct task_struct *prev_p, struct task_struct *next_p, | 488 | static int update_debugctl(struct thread_struct *prev, |
| 489 | struct tss_struct *tss) | 489 | struct thread_struct *next, unsigned long debugctl) |
| 490 | { | 490 | { |
| 491 | struct thread_struct *prev, *next; | 491 | unsigned long ds_prev = 0; |
| 492 | unsigned long debugctl; | 492 | unsigned long ds_next = 0; |
| 493 | unsigned long ds_prev = 0, ds_next = 0; | ||
| 494 | 493 | ||
| 495 | prev = &prev_p->thread; | ||
| 496 | next = &next_p->thread; | ||
| 497 | |||
| 498 | debugctl = prev->debugctlmsr; | ||
| 499 | |||
| 500 | #ifdef CONFIG_X86_DS | ||
| 501 | if (prev->ds_ctx) | 494 | if (prev->ds_ctx) |
| 502 | ds_prev = (unsigned long)prev->ds_ctx->ds; | 495 | ds_prev = (unsigned long)prev->ds_ctx->ds; |
| 503 | if (next->ds_ctx) | 496 | if (next->ds_ctx) |
| @@ -510,8 +503,28 @@ __switch_to_xtra(struct task_struct *prev_p, struct task_struct *next_p, | |||
| 510 | update_debugctlmsr(0); | 503 | update_debugctlmsr(0); |
| 511 | wrmsr(MSR_IA32_DS_AREA, ds_next, 0); | 504 | wrmsr(MSR_IA32_DS_AREA, ds_next, 0); |
| 512 | } | 505 | } |
| 506 | return debugctl; | ||
| 507 | } | ||
| 508 | #else | ||
| 509 | static int update_debugctl(struct thread_struct *prev, | ||
| 510 | struct thread_struct *next, unsigned long debugctl) | ||
| 511 | { | ||
| 512 | return debugctl; | ||
| 513 | } | ||
| 513 | #endif /* CONFIG_X86_DS */ | 514 | #endif /* CONFIG_X86_DS */ |
| 514 | 515 | ||
| 516 | static noinline void | ||
| 517 | __switch_to_xtra(struct task_struct *prev_p, struct task_struct *next_p, | ||
| 518 | struct tss_struct *tss) | ||
| 519 | { | ||
| 520 | struct thread_struct *prev, *next; | ||
| 521 | unsigned long debugctl; | ||
| 522 | |||
| 523 | prev = &prev_p->thread; | ||
| 524 | next = &next_p->thread; | ||
| 525 | |||
| 526 | debugctl = update_debugctl(prev, next, prev->debugctlmsr); | ||
| 527 | |||
| 515 | if (next->debugctlmsr != debugctl) | 528 | if (next->debugctlmsr != debugctl) |
| 516 | update_debugctlmsr(next->debugctlmsr); | 529 | update_debugctlmsr(next->debugctlmsr); |
| 517 | 530 | ||
