diff options
Diffstat (limited to 'arch/x86/kernel/process_64.c')
-rw-r--r-- | arch/x86/kernel/process_64.c | 176 |
1 files changed, 100 insertions, 76 deletions
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c index 87d7dfdcf46c..2a8ccb9238b4 100644 --- a/arch/x86/kernel/process_64.c +++ b/arch/x86/kernel/process_64.c | |||
@@ -37,11 +37,11 @@ | |||
37 | #include <linux/kdebug.h> | 37 | #include <linux/kdebug.h> |
38 | #include <linux/tick.h> | 38 | #include <linux/tick.h> |
39 | #include <linux/prctl.h> | 39 | #include <linux/prctl.h> |
40 | #include <linux/uaccess.h> | ||
41 | #include <linux/io.h> | ||
40 | 42 | ||
41 | #include <asm/uaccess.h> | ||
42 | #include <asm/pgtable.h> | 43 | #include <asm/pgtable.h> |
43 | #include <asm/system.h> | 44 | #include <asm/system.h> |
44 | #include <asm/io.h> | ||
45 | #include <asm/processor.h> | 45 | #include <asm/processor.h> |
46 | #include <asm/i387.h> | 46 | #include <asm/i387.h> |
47 | #include <asm/mmu_context.h> | 47 | #include <asm/mmu_context.h> |
@@ -89,19 +89,20 @@ void exit_idle(void) | |||
89 | #ifdef CONFIG_HOTPLUG_CPU | 89 | #ifdef CONFIG_HOTPLUG_CPU |
90 | DECLARE_PER_CPU(int, cpu_state); | 90 | DECLARE_PER_CPU(int, cpu_state); |
91 | 91 | ||
92 | #include <asm/nmi.h> | 92 | #include <linux/nmi.h> |
93 | /* We halt the CPU with physical CPU hotplug */ | 93 | /* We halt the CPU with physical CPU hotplug */ |
94 | static inline void play_dead(void) | 94 | static inline void play_dead(void) |
95 | { | 95 | { |
96 | idle_task_exit(); | 96 | idle_task_exit(); |
97 | wbinvd(); | 97 | c1e_remove_cpu(raw_smp_processor_id()); |
98 | |||
98 | mb(); | 99 | mb(); |
99 | /* Ack it */ | 100 | /* Ack it */ |
100 | __get_cpu_var(cpu_state) = CPU_DEAD; | 101 | __get_cpu_var(cpu_state) = CPU_DEAD; |
101 | 102 | ||
102 | local_irq_disable(); | 103 | local_irq_disable(); |
103 | while (1) | 104 | /* mask all interrupts, flush any and all caches, and halt */ |
104 | halt(); | 105 | wbinvd_halt(); |
105 | } | 106 | } |
106 | #else | 107 | #else |
107 | static inline void play_dead(void) | 108 | static inline void play_dead(void) |
@@ -153,7 +154,7 @@ void cpu_idle(void) | |||
153 | } | 154 | } |
154 | 155 | ||
155 | /* Prints also some state that isn't saved in the pt_regs */ | 156 | /* Prints also some state that isn't saved in the pt_regs */ |
156 | void __show_regs(struct pt_regs * regs) | 157 | void __show_regs(struct pt_regs *regs) |
157 | { | 158 | { |
158 | unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L, fs, gs, shadowgs; | 159 | unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L, fs, gs, shadowgs; |
159 | unsigned long d0, d1, d2, d3, d6, d7; | 160 | unsigned long d0, d1, d2, d3, d6, d7; |
@@ -162,59 +163,61 @@ void __show_regs(struct pt_regs * regs) | |||
162 | 163 | ||
163 | printk("\n"); | 164 | printk("\n"); |
164 | print_modules(); | 165 | print_modules(); |
165 | printk("Pid: %d, comm: %.20s %s %s %.*s\n", | 166 | printk(KERN_INFO "Pid: %d, comm: %.20s %s %s %.*s\n", |
166 | current->pid, current->comm, print_tainted(), | 167 | current->pid, current->comm, print_tainted(), |
167 | init_utsname()->release, | 168 | init_utsname()->release, |
168 | (int)strcspn(init_utsname()->version, " "), | 169 | (int)strcspn(init_utsname()->version, " "), |
169 | init_utsname()->version); | 170 | init_utsname()->version); |
170 | printk("RIP: %04lx:[<%016lx>] ", regs->cs & 0xffff, regs->ip); | 171 | printk(KERN_INFO "RIP: %04lx:[<%016lx>] ", regs->cs & 0xffff, regs->ip); |
171 | printk_address(regs->ip, 1); | 172 | printk_address(regs->ip, 1); |
172 | printk("RSP: %04lx:%016lx EFLAGS: %08lx\n", regs->ss, regs->sp, | 173 | printk(KERN_INFO "RSP: %04lx:%016lx EFLAGS: %08lx\n", regs->ss, |
173 | regs->flags); | 174 | regs->sp, regs->flags); |
174 | printk("RAX: %016lx RBX: %016lx RCX: %016lx\n", | 175 | printk(KERN_INFO "RAX: %016lx RBX: %016lx RCX: %016lx\n", |
175 | regs->ax, regs->bx, regs->cx); | 176 | regs->ax, regs->bx, regs->cx); |
176 | printk("RDX: %016lx RSI: %016lx RDI: %016lx\n", | 177 | printk(KERN_INFO "RDX: %016lx RSI: %016lx RDI: %016lx\n", |
177 | regs->dx, regs->si, regs->di); | 178 | regs->dx, regs->si, regs->di); |
178 | printk("RBP: %016lx R08: %016lx R09: %016lx\n", | 179 | printk(KERN_INFO "RBP: %016lx R08: %016lx R09: %016lx\n", |
179 | regs->bp, regs->r8, regs->r9); | 180 | regs->bp, regs->r8, regs->r9); |
180 | printk("R10: %016lx R11: %016lx R12: %016lx\n", | 181 | printk(KERN_INFO "R10: %016lx R11: %016lx R12: %016lx\n", |
181 | regs->r10, regs->r11, regs->r12); | 182 | regs->r10, regs->r11, regs->r12); |
182 | printk("R13: %016lx R14: %016lx R15: %016lx\n", | 183 | printk(KERN_INFO "R13: %016lx R14: %016lx R15: %016lx\n", |
183 | regs->r13, regs->r14, regs->r15); | 184 | regs->r13, regs->r14, regs->r15); |
184 | 185 | ||
185 | asm("movl %%ds,%0" : "=r" (ds)); | 186 | asm("movl %%ds,%0" : "=r" (ds)); |
186 | asm("movl %%cs,%0" : "=r" (cs)); | 187 | asm("movl %%cs,%0" : "=r" (cs)); |
187 | asm("movl %%es,%0" : "=r" (es)); | 188 | asm("movl %%es,%0" : "=r" (es)); |
188 | asm("movl %%fs,%0" : "=r" (fsindex)); | 189 | asm("movl %%fs,%0" : "=r" (fsindex)); |
189 | asm("movl %%gs,%0" : "=r" (gsindex)); | 190 | asm("movl %%gs,%0" : "=r" (gsindex)); |
190 | 191 | ||
191 | rdmsrl(MSR_FS_BASE, fs); | 192 | rdmsrl(MSR_FS_BASE, fs); |
192 | rdmsrl(MSR_GS_BASE, gs); | 193 | rdmsrl(MSR_GS_BASE, gs); |
193 | rdmsrl(MSR_KERNEL_GS_BASE, shadowgs); | 194 | rdmsrl(MSR_KERNEL_GS_BASE, shadowgs); |
194 | 195 | ||
195 | cr0 = read_cr0(); | 196 | cr0 = read_cr0(); |
196 | cr2 = read_cr2(); | 197 | cr2 = read_cr2(); |
197 | cr3 = read_cr3(); | 198 | cr3 = read_cr3(); |
198 | cr4 = read_cr4(); | 199 | cr4 = read_cr4(); |
199 | 200 | ||
200 | printk("FS: %016lx(%04x) GS:%016lx(%04x) knlGS:%016lx\n", | 201 | printk(KERN_INFO "FS: %016lx(%04x) GS:%016lx(%04x) knlGS:%016lx\n", |
201 | fs,fsindex,gs,gsindex,shadowgs); | 202 | fs, fsindex, gs, gsindex, shadowgs); |
202 | printk("CS: %04x DS: %04x ES: %04x CR0: %016lx\n", cs, ds, es, cr0); | 203 | printk(KERN_INFO "CS: %04x DS: %04x ES: %04x CR0: %016lx\n", cs, ds, |
203 | printk("CR2: %016lx CR3: %016lx CR4: %016lx\n", cr2, cr3, cr4); | 204 | es, cr0); |
205 | printk(KERN_INFO "CR2: %016lx CR3: %016lx CR4: %016lx\n", cr2, cr3, | ||
206 | cr4); | ||
204 | 207 | ||
205 | get_debugreg(d0, 0); | 208 | get_debugreg(d0, 0); |
206 | get_debugreg(d1, 1); | 209 | get_debugreg(d1, 1); |
207 | get_debugreg(d2, 2); | 210 | get_debugreg(d2, 2); |
208 | printk("DR0: %016lx DR1: %016lx DR2: %016lx\n", d0, d1, d2); | 211 | printk(KERN_INFO "DR0: %016lx DR1: %016lx DR2: %016lx\n", d0, d1, d2); |
209 | get_debugreg(d3, 3); | 212 | get_debugreg(d3, 3); |
210 | get_debugreg(d6, 6); | 213 | get_debugreg(d6, 6); |
211 | get_debugreg(d7, 7); | 214 | get_debugreg(d7, 7); |
212 | printk("DR3: %016lx DR6: %016lx DR7: %016lx\n", d3, d6, d7); | 215 | printk(KERN_INFO "DR3: %016lx DR6: %016lx DR7: %016lx\n", d3, d6, d7); |
213 | } | 216 | } |
214 | 217 | ||
215 | void show_regs(struct pt_regs *regs) | 218 | void show_regs(struct pt_regs *regs) |
216 | { | 219 | { |
217 | printk("CPU %d:", smp_processor_id()); | 220 | printk(KERN_INFO "CPU %d:", smp_processor_id()); |
218 | __show_regs(regs); | 221 | __show_regs(regs); |
219 | show_trace(NULL, regs, (void *)(regs + 1), regs->bp); | 222 | show_trace(NULL, regs, (void *)(regs + 1), regs->bp); |
220 | } | 223 | } |
@@ -240,6 +243,14 @@ void exit_thread(void) | |||
240 | t->io_bitmap_max = 0; | 243 | t->io_bitmap_max = 0; |
241 | put_cpu(); | 244 | put_cpu(); |
242 | } | 245 | } |
246 | #ifdef CONFIG_X86_DS | ||
247 | /* Free any DS contexts that have not been properly released. */ | ||
248 | if (unlikely(t->ds_ctx)) { | ||
249 | /* we clear debugctl to make sure DS is not used. */ | ||
250 | update_debugctlmsr(0); | ||
251 | ds_free(t->ds_ctx); | ||
252 | } | ||
253 | #endif /* CONFIG_X86_DS */ | ||
243 | } | 254 | } |
244 | 255 | ||
245 | void flush_thread(void) | 256 | void flush_thread(void) |
@@ -315,10 +326,10 @@ void prepare_to_copy(struct task_struct *tsk) | |||
315 | 326 | ||
316 | int copy_thread(int nr, unsigned long clone_flags, unsigned long sp, | 327 | int copy_thread(int nr, unsigned long clone_flags, unsigned long sp, |
317 | unsigned long unused, | 328 | unsigned long unused, |
318 | struct task_struct * p, struct pt_regs * regs) | 329 | struct task_struct *p, struct pt_regs *regs) |
319 | { | 330 | { |
320 | int err; | 331 | int err; |
321 | struct pt_regs * childregs; | 332 | struct pt_regs *childregs; |
322 | struct task_struct *me = current; | 333 | struct task_struct *me = current; |
323 | 334 | ||
324 | childregs = ((struct pt_regs *) | 335 | childregs = ((struct pt_regs *) |
@@ -363,10 +374,10 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp, | |||
363 | if (test_thread_flag(TIF_IA32)) | 374 | if (test_thread_flag(TIF_IA32)) |
364 | err = do_set_thread_area(p, -1, | 375 | err = do_set_thread_area(p, -1, |
365 | (struct user_desc __user *)childregs->si, 0); | 376 | (struct user_desc __user *)childregs->si, 0); |
366 | else | 377 | else |
367 | #endif | 378 | #endif |
368 | err = do_arch_prctl(p, ARCH_SET_FS, childregs->r8); | 379 | err = do_arch_prctl(p, ARCH_SET_FS, childregs->r8); |
369 | if (err) | 380 | if (err) |
370 | goto out; | 381 | goto out; |
371 | } | 382 | } |
372 | err = 0; | 383 | err = 0; |
@@ -473,13 +484,27 @@ static inline void __switch_to_xtra(struct task_struct *prev_p, | |||
473 | next = &next_p->thread; | 484 | next = &next_p->thread; |
474 | 485 | ||
475 | debugctl = prev->debugctlmsr; | 486 | debugctl = prev->debugctlmsr; |
476 | if (next->ds_area_msr != prev->ds_area_msr) { | 487 | |
477 | /* we clear debugctl to make sure DS | 488 | #ifdef CONFIG_X86_DS |
478 | * is not in use when we change it */ | 489 | { |
479 | debugctl = 0; | 490 | unsigned long ds_prev = 0, ds_next = 0; |
480 | update_debugctlmsr(0); | 491 | |
481 | wrmsrl(MSR_IA32_DS_AREA, next->ds_area_msr); | 492 | if (prev->ds_ctx) |
493 | ds_prev = (unsigned long)prev->ds_ctx->ds; | ||
494 | if (next->ds_ctx) | ||
495 | ds_next = (unsigned long)next->ds_ctx->ds; | ||
496 | |||
497 | if (ds_next != ds_prev) { | ||
498 | /* | ||
499 | * We clear debugctl to make sure DS | ||
500 | * is not in use when we change it: | ||
501 | */ | ||
502 | debugctl = 0; | ||
503 | update_debugctlmsr(0); | ||
504 | wrmsrl(MSR_IA32_DS_AREA, ds_next); | ||
505 | } | ||
482 | } | 506 | } |
507 | #endif /* CONFIG_X86_DS */ | ||
483 | 508 | ||
484 | if (next->debugctlmsr != debugctl) | 509 | if (next->debugctlmsr != debugctl) |
485 | update_debugctlmsr(next->debugctlmsr); | 510 | update_debugctlmsr(next->debugctlmsr); |
@@ -517,13 +542,13 @@ static inline void __switch_to_xtra(struct task_struct *prev_p, | |||
517 | memset(tss->io_bitmap, 0xff, prev->io_bitmap_max); | 542 | memset(tss->io_bitmap, 0xff, prev->io_bitmap_max); |
518 | } | 543 | } |
519 | 544 | ||
520 | #ifdef X86_BTS | 545 | #ifdef CONFIG_X86_PTRACE_BTS |
521 | if (test_tsk_thread_flag(prev_p, TIF_BTS_TRACE_TS)) | 546 | if (test_tsk_thread_flag(prev_p, TIF_BTS_TRACE_TS)) |
522 | ptrace_bts_take_timestamp(prev_p, BTS_TASK_DEPARTS); | 547 | ptrace_bts_take_timestamp(prev_p, BTS_TASK_DEPARTS); |
523 | 548 | ||
524 | if (test_tsk_thread_flag(next_p, TIF_BTS_TRACE_TS)) | 549 | if (test_tsk_thread_flag(next_p, TIF_BTS_TRACE_TS)) |
525 | ptrace_bts_take_timestamp(next_p, BTS_TASK_ARRIVES); | 550 | ptrace_bts_take_timestamp(next_p, BTS_TASK_ARRIVES); |
526 | #endif | 551 | #endif /* CONFIG_X86_PTRACE_BTS */ |
527 | } | 552 | } |
528 | 553 | ||
529 | /* | 554 | /* |
@@ -545,7 +570,7 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) | |||
545 | unsigned fsindex, gsindex; | 570 | unsigned fsindex, gsindex; |
546 | 571 | ||
547 | /* we're going to use this soon, after a few expensive things */ | 572 | /* we're going to use this soon, after a few expensive things */ |
548 | if (next_p->fpu_counter>5) | 573 | if (next_p->fpu_counter > 5) |
549 | prefetch(next->xstate); | 574 | prefetch(next->xstate); |
550 | 575 | ||
551 | /* | 576 | /* |
@@ -553,13 +578,13 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) | |||
553 | */ | 578 | */ |
554 | load_sp0(tss, next); | 579 | load_sp0(tss, next); |
555 | 580 | ||
556 | /* | 581 | /* |
557 | * Switch DS and ES. | 582 | * Switch DS and ES. |
558 | * This won't pick up thread selector changes, but I guess that is ok. | 583 | * This won't pick up thread selector changes, but I guess that is ok. |
559 | */ | 584 | */ |
560 | savesegment(es, prev->es); | 585 | savesegment(es, prev->es); |
561 | if (unlikely(next->es | prev->es)) | 586 | if (unlikely(next->es | prev->es)) |
562 | loadsegment(es, next->es); | 587 | loadsegment(es, next->es); |
563 | 588 | ||
564 | savesegment(ds, prev->ds); | 589 | savesegment(ds, prev->ds); |
565 | if (unlikely(next->ds | prev->ds)) | 590 | if (unlikely(next->ds | prev->ds)) |
@@ -585,7 +610,7 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) | |||
585 | */ | 610 | */ |
586 | arch_leave_lazy_cpu_mode(); | 611 | arch_leave_lazy_cpu_mode(); |
587 | 612 | ||
588 | /* | 613 | /* |
589 | * Switch FS and GS. | 614 | * Switch FS and GS. |
590 | * | 615 | * |
591 | * Segment register != 0 always requires a reload. Also | 616 | * Segment register != 0 always requires a reload. Also |
@@ -594,13 +619,13 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) | |||
594 | */ | 619 | */ |
595 | if (unlikely(fsindex | next->fsindex | prev->fs)) { | 620 | if (unlikely(fsindex | next->fsindex | prev->fs)) { |
596 | loadsegment(fs, next->fsindex); | 621 | loadsegment(fs, next->fsindex); |
597 | /* | 622 | /* |
598 | * Check if the user used a selector != 0; if yes | 623 | * Check if the user used a selector != 0; if yes |
599 | * clear 64bit base, since overloaded base is always | 624 | * clear 64bit base, since overloaded base is always |
600 | * mapped to the Null selector | 625 | * mapped to the Null selector |
601 | */ | 626 | */ |
602 | if (fsindex) | 627 | if (fsindex) |
603 | prev->fs = 0; | 628 | prev->fs = 0; |
604 | } | 629 | } |
605 | /* when next process has a 64bit base use it */ | 630 | /* when next process has a 64bit base use it */ |
606 | if (next->fs) | 631 | if (next->fs) |
@@ -610,7 +635,7 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) | |||
610 | if (unlikely(gsindex | next->gsindex | prev->gs)) { | 635 | if (unlikely(gsindex | next->gsindex | prev->gs)) { |
611 | load_gs_index(next->gsindex); | 636 | load_gs_index(next->gsindex); |
612 | if (gsindex) | 637 | if (gsindex) |
613 | prev->gs = 0; | 638 | prev->gs = 0; |
614 | } | 639 | } |
615 | if (next->gs) | 640 | if (next->gs) |
616 | wrmsrl(MSR_KERNEL_GS_BASE, next->gs); | 641 | wrmsrl(MSR_KERNEL_GS_BASE, next->gs); |
@@ -619,12 +644,12 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) | |||
619 | /* Must be after DS reload */ | 644 | /* Must be after DS reload */ |
620 | unlazy_fpu(prev_p); | 645 | unlazy_fpu(prev_p); |
621 | 646 | ||
622 | /* | 647 | /* |
623 | * Switch the PDA and FPU contexts. | 648 | * Switch the PDA and FPU contexts. |
624 | */ | 649 | */ |
625 | prev->usersp = read_pda(oldrsp); | 650 | prev->usersp = read_pda(oldrsp); |
626 | write_pda(oldrsp, next->usersp); | 651 | write_pda(oldrsp, next->usersp); |
627 | write_pda(pcurrent, next_p); | 652 | write_pda(pcurrent, next_p); |
628 | 653 | ||
629 | write_pda(kernelstack, | 654 | write_pda(kernelstack, |
630 | (unsigned long)task_stack_page(next_p) + | 655 | (unsigned long)task_stack_page(next_p) + |
@@ -665,7 +690,7 @@ long sys_execve(char __user *name, char __user * __user *argv, | |||
665 | char __user * __user *envp, struct pt_regs *regs) | 690 | char __user * __user *envp, struct pt_regs *regs) |
666 | { | 691 | { |
667 | long error; | 692 | long error; |
668 | char * filename; | 693 | char *filename; |
669 | 694 | ||
670 | filename = getname(name); | 695 | filename = getname(name); |
671 | error = PTR_ERR(filename); | 696 | error = PTR_ERR(filename); |
@@ -723,55 +748,55 @@ asmlinkage long sys_vfork(struct pt_regs *regs) | |||
723 | unsigned long get_wchan(struct task_struct *p) | 748 | unsigned long get_wchan(struct task_struct *p) |
724 | { | 749 | { |
725 | unsigned long stack; | 750 | unsigned long stack; |
726 | u64 fp,ip; | 751 | u64 fp, ip; |
727 | int count = 0; | 752 | int count = 0; |
728 | 753 | ||
729 | if (!p || p == current || p->state==TASK_RUNNING) | 754 | if (!p || p == current || p->state == TASK_RUNNING) |
730 | return 0; | 755 | return 0; |
731 | stack = (unsigned long)task_stack_page(p); | 756 | stack = (unsigned long)task_stack_page(p); |
732 | if (p->thread.sp < stack || p->thread.sp > stack+THREAD_SIZE) | 757 | if (p->thread.sp < stack || p->thread.sp > stack+THREAD_SIZE) |
733 | return 0; | 758 | return 0; |
734 | fp = *(u64 *)(p->thread.sp); | 759 | fp = *(u64 *)(p->thread.sp); |
735 | do { | 760 | do { |
736 | if (fp < (unsigned long)stack || | 761 | if (fp < (unsigned long)stack || |
737 | fp > (unsigned long)stack+THREAD_SIZE) | 762 | fp > (unsigned long)stack+THREAD_SIZE) |
738 | return 0; | 763 | return 0; |
739 | ip = *(u64 *)(fp+8); | 764 | ip = *(u64 *)(fp+8); |
740 | if (!in_sched_functions(ip)) | 765 | if (!in_sched_functions(ip)) |
741 | return ip; | 766 | return ip; |
742 | fp = *(u64 *)fp; | 767 | fp = *(u64 *)fp; |
743 | } while (count++ < 16); | 768 | } while (count++ < 16); |
744 | return 0; | 769 | return 0; |
745 | } | 770 | } |
746 | 771 | ||
747 | long do_arch_prctl(struct task_struct *task, int code, unsigned long addr) | 772 | long do_arch_prctl(struct task_struct *task, int code, unsigned long addr) |
748 | { | 773 | { |
749 | int ret = 0; | 774 | int ret = 0; |
750 | int doit = task == current; | 775 | int doit = task == current; |
751 | int cpu; | 776 | int cpu; |
752 | 777 | ||
753 | switch (code) { | 778 | switch (code) { |
754 | case ARCH_SET_GS: | 779 | case ARCH_SET_GS: |
755 | if (addr >= TASK_SIZE_OF(task)) | 780 | if (addr >= TASK_SIZE_OF(task)) |
756 | return -EPERM; | 781 | return -EPERM; |
757 | cpu = get_cpu(); | 782 | cpu = get_cpu(); |
758 | /* handle small bases via the GDT because that's faster to | 783 | /* handle small bases via the GDT because that's faster to |
759 | switch. */ | 784 | switch. */ |
760 | if (addr <= 0xffffffff) { | 785 | if (addr <= 0xffffffff) { |
761 | set_32bit_tls(task, GS_TLS, addr); | 786 | set_32bit_tls(task, GS_TLS, addr); |
762 | if (doit) { | 787 | if (doit) { |
763 | load_TLS(&task->thread, cpu); | 788 | load_TLS(&task->thread, cpu); |
764 | load_gs_index(GS_TLS_SEL); | 789 | load_gs_index(GS_TLS_SEL); |
765 | } | 790 | } |
766 | task->thread.gsindex = GS_TLS_SEL; | 791 | task->thread.gsindex = GS_TLS_SEL; |
767 | task->thread.gs = 0; | 792 | task->thread.gs = 0; |
768 | } else { | 793 | } else { |
769 | task->thread.gsindex = 0; | 794 | task->thread.gsindex = 0; |
770 | task->thread.gs = addr; | 795 | task->thread.gs = addr; |
771 | if (doit) { | 796 | if (doit) { |
772 | load_gs_index(0); | 797 | load_gs_index(0); |
773 | ret = checking_wrmsrl(MSR_KERNEL_GS_BASE, addr); | 798 | ret = checking_wrmsrl(MSR_KERNEL_GS_BASE, addr); |
774 | } | 799 | } |
775 | } | 800 | } |
776 | put_cpu(); | 801 | put_cpu(); |
777 | break; | 802 | break; |
@@ -825,8 +850,7 @@ long do_arch_prctl(struct task_struct *task, int code, unsigned long addr) | |||
825 | rdmsrl(MSR_KERNEL_GS_BASE, base); | 850 | rdmsrl(MSR_KERNEL_GS_BASE, base); |
826 | else | 851 | else |
827 | base = task->thread.gs; | 852 | base = task->thread.gs; |
828 | } | 853 | } else |
829 | else | ||
830 | base = task->thread.gs; | 854 | base = task->thread.gs; |
831 | ret = put_user(base, (unsigned long __user *)addr); | 855 | ret = put_user(base, (unsigned long __user *)addr); |
832 | break; | 856 | break; |