aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/process_32.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kernel/process_32.c')
-rw-r--r--arch/x86/kernel/process_32.c41
1 files changed, 26 insertions, 15 deletions
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index 43930e73f657..3903a8f2eb97 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -113,20 +113,13 @@ void default_idle(void)
113 113
114 local_irq_disable(); 114 local_irq_disable();
115 if (!need_resched()) { 115 if (!need_resched()) {
116 ktime_t t0, t1;
117 u64 t0n, t1n;
118
119 t0 = ktime_get();
120 t0n = ktime_to_ns(t0);
121 safe_halt(); /* enables interrupts racelessly */ 116 safe_halt(); /* enables interrupts racelessly */
122 local_irq_disable(); 117 local_irq_disable();
123 t1 = ktime_get();
124 t1n = ktime_to_ns(t1);
125 sched_clock_idle_wakeup_event(t1n - t0n);
126 } 118 }
127 local_irq_enable(); 119 local_irq_enable();
128 current_thread_info()->status |= TS_POLLING; 120 current_thread_info()->status |= TS_POLLING;
129 } else { 121 } else {
122 local_irq_enable();
130 /* loop is done by the caller */ 123 /* loop is done by the caller */
131 cpu_relax(); 124 cpu_relax();
132 } 125 }
@@ -142,6 +135,7 @@ EXPORT_SYMBOL(default_idle);
142 */ 135 */
143static void poll_idle(void) 136static void poll_idle(void)
144{ 137{
138 local_irq_enable();
145 cpu_relax(); 139 cpu_relax();
146} 140}
147 141
@@ -248,8 +242,11 @@ void mwait_idle_with_hints(unsigned long ax, unsigned long cx)
248 __monitor((void *)&current_thread_info()->flags, 0, 0); 242 __monitor((void *)&current_thread_info()->flags, 0, 0);
249 smp_mb(); 243 smp_mb();
250 if (!need_resched()) 244 if (!need_resched())
251 __mwait(ax, cx); 245 __sti_mwait(ax, cx);
252 } 246 else
247 local_irq_enable();
248 } else
249 local_irq_enable();
253} 250}
254 251
255/* Default MONITOR/MWAIT with no hints, used for default C1 state */ 252/* Default MONITOR/MWAIT with no hints, used for default C1 state */
@@ -332,7 +329,7 @@ void __show_registers(struct pt_regs *regs, int all)
332 init_utsname()->version); 329 init_utsname()->version);
333 330
334 printk("EIP: %04x:[<%08lx>] EFLAGS: %08lx CPU: %d\n", 331 printk("EIP: %04x:[<%08lx>] EFLAGS: %08lx CPU: %d\n",
335 0xffff & regs->cs, regs->ip, regs->flags, 332 (u16)regs->cs, regs->ip, regs->flags,
336 smp_processor_id()); 333 smp_processor_id());
337 print_symbol("EIP is at %s\n", regs->ip); 334 print_symbol("EIP is at %s\n", regs->ip);
338 335
@@ -341,8 +338,7 @@ void __show_registers(struct pt_regs *regs, int all)
341 printk("ESI: %08lx EDI: %08lx EBP: %08lx ESP: %08lx\n", 338 printk("ESI: %08lx EDI: %08lx EBP: %08lx ESP: %08lx\n",
342 regs->si, regs->di, regs->bp, sp); 339 regs->si, regs->di, regs->bp, sp);
343 printk(" DS: %04x ES: %04x FS: %04x GS: %04x SS: %04x\n", 340 printk(" DS: %04x ES: %04x FS: %04x GS: %04x SS: %04x\n",
344 regs->ds & 0xffff, regs->es & 0xffff, 341 (u16)regs->ds, (u16)regs->es, (u16)regs->fs, gs, ss);
345 regs->fs & 0xffff, gs, ss);
346 342
347 if (!all) 343 if (!all)
348 return; 344 return;
@@ -513,6 +509,21 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
513 return err; 509 return err;
514} 510}
515 511
512void
513start_thread(struct pt_regs *regs, unsigned long new_ip, unsigned long new_sp)
514{
515 __asm__("movl %0, %%gs" :: "r"(0));
516 regs->fs = 0;
517 set_fs(USER_DS);
518 regs->ds = __USER_DS;
519 regs->es = __USER_DS;
520 regs->ss = __USER_DS;
521 regs->cs = __USER_CS;
522 regs->ip = new_ip;
523 regs->sp = new_sp;
524}
525EXPORT_SYMBOL_GPL(start_thread);
526
516#ifdef CONFIG_SECCOMP 527#ifdef CONFIG_SECCOMP
517static void hard_disable_TSC(void) 528static void hard_disable_TSC(void)
518{ 529{
@@ -550,12 +561,12 @@ __switch_to_xtra(struct task_struct *prev_p, struct task_struct *next_p,
550 /* we clear debugctl to make sure DS 561 /* we clear debugctl to make sure DS
551 * is not in use when we change it */ 562 * is not in use when we change it */
552 debugctl = 0; 563 debugctl = 0;
553 wrmsrl(MSR_IA32_DEBUGCTLMSR, 0); 564 update_debugctlmsr(0);
554 wrmsr(MSR_IA32_DS_AREA, next->ds_area_msr, 0); 565 wrmsr(MSR_IA32_DS_AREA, next->ds_area_msr, 0);
555 } 566 }
556 567
557 if (next->debugctlmsr != debugctl) 568 if (next->debugctlmsr != debugctl)
558 wrmsr(MSR_IA32_DEBUGCTLMSR, next->debugctlmsr, 0); 569 update_debugctlmsr(next->debugctlmsr);
559 570
560 if (test_tsk_thread_flag(next_p, TIF_DEBUG)) { 571 if (test_tsk_thread_flag(next_p, TIF_DEBUG)) {
561 set_debugreg(next->debugreg0, 0); 572 set_debugreg(next->debugreg0, 0);