aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-i386/processor.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-i386/processor.h')
-rw-r--r--include/asm-i386/processor.h198
1 files changed, 99 insertions, 99 deletions
diff --git a/include/asm-i386/processor.h b/include/asm-i386/processor.h
index 6c2c4457be0a..5f0418d0078c 100644
--- a/include/asm-i386/processor.h
+++ b/include/asm-i386/processor.h
@@ -156,59 +156,6 @@ static inline fastcall void native_cpuid(unsigned int *eax, unsigned int *ebx,
156 : "0" (*eax), "2" (*ecx)); 156 : "0" (*eax), "2" (*ecx));
157} 157}
158 158
159/*
160 * Generic CPUID function
161 * clear %ecx since some cpus (Cyrix MII) do not set or clear %ecx
162 * resulting in stale register contents being returned.
163 */
164static inline void cpuid(unsigned int op, unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx)
165{
166 *eax = op;
167 *ecx = 0;
168 __cpuid(eax, ebx, ecx, edx);
169}
170
171/* Some CPUID calls want 'count' to be placed in ecx */
172static inline void cpuid_count(int op, int count, int *eax, int *ebx, int *ecx,
173 int *edx)
174{
175 *eax = op;
176 *ecx = count;
177 __cpuid(eax, ebx, ecx, edx);
178}
179
180/*
181 * CPUID functions returning a single datum
182 */
183static inline unsigned int cpuid_eax(unsigned int op)
184{
185 unsigned int eax, ebx, ecx, edx;
186
187 cpuid(op, &eax, &ebx, &ecx, &edx);
188 return eax;
189}
190static inline unsigned int cpuid_ebx(unsigned int op)
191{
192 unsigned int eax, ebx, ecx, edx;
193
194 cpuid(op, &eax, &ebx, &ecx, &edx);
195 return ebx;
196}
197static inline unsigned int cpuid_ecx(unsigned int op)
198{
199 unsigned int eax, ebx, ecx, edx;
200
201 cpuid(op, &eax, &ebx, &ecx, &edx);
202 return ecx;
203}
204static inline unsigned int cpuid_edx(unsigned int op)
205{
206 unsigned int eax, ebx, ecx, edx;
207
208 cpuid(op, &eax, &ebx, &ecx, &edx);
209 return edx;
210}
211
212#define load_cr3(pgdir) write_cr3(__pa(pgdir)) 159#define load_cr3(pgdir) write_cr3(__pa(pgdir))
213 160
214/* 161/*
@@ -491,22 +438,6 @@ struct thread_struct {
491 .io_bitmap = { [ 0 ... IO_BITMAP_LONGS] = ~0 }, \ 438 .io_bitmap = { [ 0 ... IO_BITMAP_LONGS] = ~0 }, \
492} 439}
493 440
494#ifdef CONFIG_PARAVIRT
495#include <asm/paravirt.h>
496#else
497#define paravirt_enabled() 0
498#define __cpuid native_cpuid
499
500static inline void load_esp0(struct tss_struct *tss, struct thread_struct *thread)
501{
502 tss->esp0 = thread->esp0;
503 /* This can only happen when SEP is enabled, no need to test "SEP"arately */
504 if (unlikely(tss->ss1 != thread->sysenter_cs)) {
505 tss->ss1 = thread->sysenter_cs;
506 wrmsr(MSR_IA32_SYSENTER_CS, thread->sysenter_cs, 0);
507 }
508}
509
510#define start_thread(regs, new_eip, new_esp) do { \ 441#define start_thread(regs, new_eip, new_esp) do { \
511 __asm__("movl %0,%%fs": :"r" (0)); \ 442 __asm__("movl %0,%%fs": :"r" (0)); \
512 regs->xgs = 0; \ 443 regs->xgs = 0; \
@@ -519,36 +450,6 @@ static inline void load_esp0(struct tss_struct *tss, struct thread_struct *threa
519 regs->esp = new_esp; \ 450 regs->esp = new_esp; \
520} while (0) 451} while (0)
521 452
522/*
523 * These special macros can be used to get or set a debugging register
524 */
525#define get_debugreg(var, register) \
526 __asm__("movl %%db" #register ", %0" \
527 :"=r" (var))
528#define set_debugreg(value, register) \
529 __asm__("movl %0,%%db" #register \
530 : /* no output */ \
531 :"r" (value))
532
533#define set_iopl_mask native_set_iopl_mask
534#endif /* CONFIG_PARAVIRT */
535
536/*
537 * Set IOPL bits in EFLAGS from given mask
538 */
539static fastcall inline void native_set_iopl_mask(unsigned mask)
540{
541 unsigned int reg;
542 __asm__ __volatile__ ("pushfl;"
543 "popl %0;"
544 "andl %1, %0;"
545 "orl %2, %0;"
546 "pushl %0;"
547 "popfl"
548 : "=&r" (reg)
549 : "i" (~X86_EFLAGS_IOPL), "r" (mask));
550}
551
552/* Forward declaration, a strange C thing */ 453/* Forward declaration, a strange C thing */
553struct task_struct; 454struct task_struct;
554struct mm_struct; 455struct mm_struct;
@@ -640,6 +541,105 @@ static inline void rep_nop(void)
640 541
641#define cpu_relax() rep_nop() 542#define cpu_relax() rep_nop()
642 543
544#ifdef CONFIG_PARAVIRT
545#include <asm/paravirt.h>
546#else
547#define paravirt_enabled() 0
548#define __cpuid native_cpuid
549
550static inline void load_esp0(struct tss_struct *tss, struct thread_struct *thread)
551{
552 tss->esp0 = thread->esp0;
553 /* This can only happen when SEP is enabled, no need to test "SEP"arately */
554 if (unlikely(tss->ss1 != thread->sysenter_cs)) {
555 tss->ss1 = thread->sysenter_cs;
556 wrmsr(MSR_IA32_SYSENTER_CS, thread->sysenter_cs, 0);
557 }
558}
559
560/*
561 * These special macros can be used to get or set a debugging register
562 */
563#define get_debugreg(var, register) \
564 __asm__("movl %%db" #register ", %0" \
565 :"=r" (var))
566#define set_debugreg(value, register) \
567 __asm__("movl %0,%%db" #register \
568 : /* no output */ \
569 :"r" (value))
570
571#define set_iopl_mask native_set_iopl_mask
572#endif /* CONFIG_PARAVIRT */
573
574/*
575 * Set IOPL bits in EFLAGS from given mask
576 */
577static fastcall inline void native_set_iopl_mask(unsigned mask)
578{
579 unsigned int reg;
580 __asm__ __volatile__ ("pushfl;"
581 "popl %0;"
582 "andl %1, %0;"
583 "orl %2, %0;"
584 "pushl %0;"
585 "popfl"
586 : "=&r" (reg)
587 : "i" (~X86_EFLAGS_IOPL), "r" (mask));
588}
589
590/*
591 * Generic CPUID function
592 * clear %ecx since some cpus (Cyrix MII) do not set or clear %ecx
593 * resulting in stale register contents being returned.
594 */
595static inline void cpuid(unsigned int op, unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx)
596{
597 *eax = op;
598 *ecx = 0;
599 __cpuid(eax, ebx, ecx, edx);
600}
601
602/* Some CPUID calls want 'count' to be placed in ecx */
603static inline void cpuid_count(int op, int count, int *eax, int *ebx, int *ecx,
604 int *edx)
605{
606 *eax = op;
607 *ecx = count;
608 __cpuid(eax, ebx, ecx, edx);
609}
610
611/*
612 * CPUID functions returning a single datum
613 */
614static inline unsigned int cpuid_eax(unsigned int op)
615{
616 unsigned int eax, ebx, ecx, edx;
617
618 cpuid(op, &eax, &ebx, &ecx, &edx);
619 return eax;
620}
621static inline unsigned int cpuid_ebx(unsigned int op)
622{
623 unsigned int eax, ebx, ecx, edx;
624
625 cpuid(op, &eax, &ebx, &ecx, &edx);
626 return ebx;
627}
628static inline unsigned int cpuid_ecx(unsigned int op)
629{
630 unsigned int eax, ebx, ecx, edx;
631
632 cpuid(op, &eax, &ebx, &ecx, &edx);
633 return ecx;
634}
635static inline unsigned int cpuid_edx(unsigned int op)
636{
637 unsigned int eax, ebx, ecx, edx;
638
639 cpuid(op, &eax, &ebx, &ecx, &edx);
640 return edx;
641}
642
643/* generic versions from gas */ 643/* generic versions from gas */
644#define GENERIC_NOP1 ".byte 0x90\n" 644#define GENERIC_NOP1 ".byte 0x90\n"
645#define GENERIC_NOP2 ".byte 0x89,0xf6\n" 645#define GENERIC_NOP2 ".byte 0x89,0xf6\n"