aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-x86/processor.h
diff options
context:
space:
mode:
authorGlauber de Oliveira Costa <gcosta@redhat.com>2008-01-30 07:31:27 -0500
committerIngo Molnar <mingo@elte.hu>2008-01-30 07:31:27 -0500
commit1b46cbe0ccaad25786526601bc54426f2e2abb20 (patch)
tree5dc174d2da7e66cb8bc3356356b4e2eced2e3981 /include/asm-x86/processor.h
parentc72dcf83ff8585c95739abffa3be7c87ca63d66b (diff)
x86: unify paravirt pieces of processor.h
This patch unifies the paravirt pieces of processor.h The functionality present in 32 bit, but not (yet) in 64-bit, like load_sp0 is _not_ done here, and let to a different patch. With this unification, we get paravirt for free in x86_64 processor.h Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'include/asm-x86/processor.h')
-rw-r--r--include/asm-x86/processor.h90
1 files changed, 89 insertions, 1 deletions
diff --git a/include/asm-x86/processor.h b/include/asm-x86/processor.h
index 36ee9881b74f..8d0af7bf090a 100644
--- a/include/asm-x86/processor.h
+++ b/include/asm-x86/processor.h
@@ -29,9 +29,97 @@ static inline void load_cr3(pgd_t *pgdir)
29# include "processor_64.h" 29# include "processor_64.h"
30#endif 30#endif
31 31
32static inline unsigned long native_get_debugreg(int regno)
33{
34 unsigned long val = 0; /* Damn you, gcc! */
35
36 switch (regno) {
37 case 0:
38 asm("mov %%db0, %0" :"=r" (val)); break;
39 case 1:
40 asm("mov %%db1, %0" :"=r" (val)); break;
41 case 2:
42 asm("mov %%db2, %0" :"=r" (val)); break;
43 case 3:
44 asm("mov %%db3, %0" :"=r" (val)); break;
45 case 6:
46 asm("mov %%db6, %0" :"=r" (val)); break;
47 case 7:
48 asm("mov %%db7, %0" :"=r" (val)); break;
49 default:
50 BUG();
51 }
52 return val;
53}
54
55static inline void native_set_debugreg(int regno, unsigned long value)
56{
57 switch (regno) {
58 case 0:
59 asm("mov %0,%%db0" : /* no output */ :"r" (value));
60 break;
61 case 1:
62 asm("mov %0,%%db1" : /* no output */ :"r" (value));
63 break;
64 case 2:
65 asm("mov %0,%%db2" : /* no output */ :"r" (value));
66 break;
67 case 3:
68 asm("mov %0,%%db3" : /* no output */ :"r" (value));
69 break;
70 case 6:
71 asm("mov %0,%%db6" : /* no output */ :"r" (value));
72 break;
73 case 7:
74 asm("mov %0,%%db7" : /* no output */ :"r" (value));
75 break;
76 default:
77 BUG();
78 }
79}
80
81
32#ifndef CONFIG_PARAVIRT 82#ifndef CONFIG_PARAVIRT
33#define __cpuid native_cpuid 83#define __cpuid native_cpuid
34#endif 84#define paravirt_enabled() 0
85
86/*
87 * These special macros can be used to get or set a debugging register
88 */
89#define get_debugreg(var, register) \
90 (var) = native_get_debugreg(register)
91#define set_debugreg(value, register) \
92 native_set_debugreg(register, value)
93
94#endif /* CONFIG_PARAVIRT */
95
96/*
97 * Save the cr4 feature set we're using (ie
98 * Pentium 4MB enable and PPro Global page
99 * enable), so that any CPU's that boot up
100 * after us can get the correct flags.
101 */
102extern unsigned long mmu_cr4_features;
103
104static inline void set_in_cr4(unsigned long mask)
105{
106 unsigned cr4;
107 mmu_cr4_features |= mask;
108 cr4 = read_cr4();
109 cr4 |= mask;
110 write_cr4(cr4);
111}
112
113static inline void clear_in_cr4(unsigned long mask)
114{
115 unsigned cr4;
116 mmu_cr4_features &= ~mask;
117 cr4 = read_cr4();
118 cr4 &= ~mask;
119 write_cr4(cr4);
120}
121
122
35 123
36/* 124/*
37 * Generic CPUID function 125 * Generic CPUID function