aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/asm-x86/processor.h73
1 files changed, 38 insertions, 35 deletions
diff --git a/include/asm-x86/processor.h b/include/asm-x86/processor.h
index b0dece41dbc4..6e26c7c717a2 100644
--- a/include/asm-x86/processor.h
+++ b/include/asm-x86/processor.h
@@ -175,12 +175,12 @@ static inline void native_cpuid(unsigned int *eax, unsigned int *ebx,
175 unsigned int *ecx, unsigned int *edx) 175 unsigned int *ecx, unsigned int *edx)
176{ 176{
177 /* ecx is often an input as well as an output. */ 177 /* ecx is often an input as well as an output. */
178 __asm__("cpuid" 178 asm("cpuid"
179 : "=a" (*eax), 179 : "=a" (*eax),
180 "=b" (*ebx), 180 "=b" (*ebx),
181 "=c" (*ecx), 181 "=c" (*ecx),
182 "=d" (*edx) 182 "=d" (*edx)
183 : "0" (*eax), "2" (*ecx)); 183 : "0" (*eax), "2" (*ecx));
184} 184}
185 185
186static inline void load_cr3(pgd_t *pgdir) 186static inline void load_cr3(pgd_t *pgdir)
@@ -427,17 +427,23 @@ static inline unsigned long native_get_debugreg(int regno)
427 427
428 switch (regno) { 428 switch (regno) {
429 case 0: 429 case 0:
430 asm("mov %%db0, %0" :"=r" (val)); break; 430 asm("mov %%db0, %0" :"=r" (val));
431 break;
431 case 1: 432 case 1:
432 asm("mov %%db1, %0" :"=r" (val)); break; 433 asm("mov %%db1, %0" :"=r" (val));
434 break;
433 case 2: 435 case 2:
434 asm("mov %%db2, %0" :"=r" (val)); break; 436 asm("mov %%db2, %0" :"=r" (val));
437 break;
435 case 3: 438 case 3:
436 asm("mov %%db3, %0" :"=r" (val)); break; 439 asm("mov %%db3, %0" :"=r" (val));
440 break;
437 case 6: 441 case 6:
438 asm("mov %%db6, %0" :"=r" (val)); break; 442 asm("mov %%db6, %0" :"=r" (val));
443 break;
439 case 7: 444 case 7:
440 asm("mov %%db7, %0" :"=r" (val)); break; 445 asm("mov %%db7, %0" :"=r" (val));
446 break;
441 default: 447 default:
442 BUG(); 448 BUG();
443 } 449 }
@@ -478,14 +484,14 @@ static inline void native_set_iopl_mask(unsigned mask)
478#ifdef CONFIG_X86_32 484#ifdef CONFIG_X86_32
479 unsigned int reg; 485 unsigned int reg;
480 486
481 __asm__ __volatile__ ("pushfl;" 487 asm volatile ("pushfl;"
482 "popl %0;" 488 "popl %0;"
483 "andl %1, %0;" 489 "andl %1, %0;"
484 "orl %2, %0;" 490 "orl %2, %0;"
485 "pushl %0;" 491 "pushl %0;"
486 "popfl" 492 "popfl"
487 : "=&r" (reg) 493 : "=&r" (reg)
488 : "i" (~X86_EFLAGS_IOPL), "r" (mask)); 494 : "i" (~X86_EFLAGS_IOPL), "r" (mask));
489#endif 495#endif
490} 496}
491 497
@@ -523,8 +529,8 @@ static inline void native_swapgs(void)
523#define set_debugreg(value, register) \ 529#define set_debugreg(value, register) \
524 native_set_debugreg(register, value) 530 native_set_debugreg(register, value)
525 531
526static inline void 532static inline void load_sp0(struct tss_struct *tss,
527load_sp0(struct tss_struct *tss, struct thread_struct *thread) 533 struct thread_struct *thread)
528{ 534{
529 native_load_sp0(tss, thread); 535 native_load_sp0(tss, thread);
530} 536}
@@ -680,7 +686,7 @@ static inline unsigned int cpuid_edx(unsigned int op)
680/* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */ 686/* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */
681static inline void rep_nop(void) 687static inline void rep_nop(void)
682{ 688{
683 __asm__ __volatile__("rep; nop" ::: "memory"); 689 asm volatile("rep; nop" ::: "memory");
684} 690}
685 691
686static inline void cpu_relax(void) 692static inline void cpu_relax(void)
@@ -694,32 +700,29 @@ static inline void sync_core(void)
694 int tmp; 700 int tmp;
695 701
696 asm volatile("cpuid" : "=a" (tmp) : "0" (1) 702 asm volatile("cpuid" : "=a" (tmp) : "0" (1)
697 : "ebx", "ecx", "edx", "memory"); 703 : "ebx", "ecx", "edx", "memory");
698} 704}
699 705
700static inline void 706static inline void __monitor(const void *eax, unsigned long ecx,
701__monitor(const void *eax, unsigned long ecx, unsigned long edx) 707 unsigned long edx)
702{ 708{
703 /* "monitor %eax, %ecx, %edx;" */ 709 /* "monitor %eax, %ecx, %edx;" */
704 asm volatile( 710 asm volatile(".byte 0x0f, 0x01, 0xc8;"
705 ".byte 0x0f, 0x01, 0xc8;" 711 :: "a" (eax), "c" (ecx), "d"(edx));
706 :: "a" (eax), "c" (ecx), "d"(edx));
707} 712}
708 713
709static inline void __mwait(unsigned long eax, unsigned long ecx) 714static inline void __mwait(unsigned long eax, unsigned long ecx)
710{ 715{
711 /* "mwait %eax, %ecx;" */ 716 /* "mwait %eax, %ecx;" */
712 asm volatile( 717 asm volatile(".byte 0x0f, 0x01, 0xc9;"
713 ".byte 0x0f, 0x01, 0xc9;" 718 :: "a" (eax), "c" (ecx));
714 :: "a" (eax), "c" (ecx));
715} 719}
716 720
717static inline void __sti_mwait(unsigned long eax, unsigned long ecx) 721static inline void __sti_mwait(unsigned long eax, unsigned long ecx)
718{ 722{
719 /* "mwait %eax, %ecx;" */ 723 /* "mwait %eax, %ecx;" */
720 asm volatile( 724 asm volatile("sti; .byte 0x0f, 0x01, 0xc9;"
721 "sti; .byte 0x0f, 0x01, 0xc9;" 725 :: "a" (eax), "c" (ecx));
722 :: "a" (eax), "c" (ecx));
723} 726}
724 727
725extern void mwait_idle_with_hints(unsigned long eax, unsigned long ecx); 728extern void mwait_idle_with_hints(unsigned long eax, unsigned long ecx);