diff options
Diffstat (limited to 'include/asm-x86/pda.h')
-rw-r--r-- | include/asm-x86/pda.h | 81 |
1 files changed, 42 insertions, 39 deletions
diff --git a/include/asm-x86/pda.h b/include/asm-x86/pda.h index c0305bff0f19..101fb9e11954 100644 --- a/include/asm-x86/pda.h +++ b/include/asm-x86/pda.h | |||
@@ -22,7 +22,6 @@ struct x8664_pda { | |||
22 | offset 40!!! */ | 22 | offset 40!!! */ |
23 | #endif | 23 | #endif |
24 | char *irqstackptr; | 24 | char *irqstackptr; |
25 | unsigned int nodenumber; /* number of current node */ | ||
26 | unsigned int __softirq_pending; | 25 | unsigned int __softirq_pending; |
27 | unsigned int __nmi_count; /* number of NMI on this CPUs */ | 26 | unsigned int __nmi_count; /* number of NMI on this CPUs */ |
28 | short mmu_state; | 27 | short mmu_state; |
@@ -58,34 +57,36 @@ extern struct x8664_pda _proxy_pda; | |||
58 | 57 | ||
59 | #define pda_offset(field) offsetof(struct x8664_pda, field) | 58 | #define pda_offset(field) offsetof(struct x8664_pda, field) |
60 | 59 | ||
61 | #define pda_to_op(op, field, val) do { \ | 60 | #define pda_to_op(op, field, val) \ |
62 | typedef typeof(_proxy_pda.field) T__; \ | 61 | do { \ |
63 | if (0) { T__ tmp__; tmp__ = (val); } /* type checking */ \ | 62 | typedef typeof(_proxy_pda.field) T__; \ |
64 | switch (sizeof(_proxy_pda.field)) { \ | 63 | if (0) { T__ tmp__; tmp__ = (val); } /* type checking */ \ |
65 | case 2: \ | 64 | switch (sizeof(_proxy_pda.field)) { \ |
66 | asm(op "w %1,%%gs:%c2" : \ | 65 | case 2: \ |
67 | "+m" (_proxy_pda.field) : \ | 66 | asm(op "w %1,%%gs:%c2" : \ |
68 | "ri" ((T__)val), \ | 67 | "+m" (_proxy_pda.field) : \ |
69 | "i"(pda_offset(field))); \ | 68 | "ri" ((T__)val), \ |
70 | break; \ | 69 | "i"(pda_offset(field))); \ |
71 | case 4: \ | 70 | break; \ |
72 | asm(op "l %1,%%gs:%c2" : \ | 71 | case 4: \ |
73 | "+m" (_proxy_pda.field) : \ | 72 | asm(op "l %1,%%gs:%c2" : \ |
74 | "ri" ((T__)val), \ | 73 | "+m" (_proxy_pda.field) : \ |
75 | "i" (pda_offset(field))); \ | 74 | "ri" ((T__)val), \ |
76 | break; \ | 75 | "i" (pda_offset(field))); \ |
77 | case 8: \ | 76 | break; \ |
78 | asm(op "q %1,%%gs:%c2": \ | 77 | case 8: \ |
79 | "+m" (_proxy_pda.field) : \ | 78 | asm(op "q %1,%%gs:%c2": \ |
80 | "ri" ((T__)val), \ | 79 | "+m" (_proxy_pda.field) : \ |
81 | "i"(pda_offset(field))); \ | 80 | "ri" ((T__)val), \ |
82 | break; \ | 81 | "i"(pda_offset(field))); \ |
83 | default: \ | 82 | break; \ |
84 | __bad_pda_field(); \ | 83 | default: \ |
85 | } \ | 84 | __bad_pda_field(); \ |
86 | } while (0) | 85 | } \ |
86 | } while (0) | ||
87 | 87 | ||
88 | #define pda_from_op(op,field) ({ \ | 88 | #define pda_from_op(op, field) \ |
89 | ({ \ | ||
89 | typeof(_proxy_pda.field) ret__; \ | 90 | typeof(_proxy_pda.field) ret__; \ |
90 | switch (sizeof(_proxy_pda.field)) { \ | 91 | switch (sizeof(_proxy_pda.field)) { \ |
91 | case 2: \ | 92 | case 2: \ |
@@ -93,23 +94,24 @@ extern struct x8664_pda _proxy_pda; | |||
93 | "=r" (ret__) : \ | 94 | "=r" (ret__) : \ |
94 | "i" (pda_offset(field)), \ | 95 | "i" (pda_offset(field)), \ |
95 | "m" (_proxy_pda.field)); \ | 96 | "m" (_proxy_pda.field)); \ |
96 | break; \ | 97 | break; \ |
97 | case 4: \ | 98 | case 4: \ |
98 | asm(op "l %%gs:%c1,%0": \ | 99 | asm(op "l %%gs:%c1,%0": \ |
99 | "=r" (ret__): \ | 100 | "=r" (ret__): \ |
100 | "i" (pda_offset(field)), \ | 101 | "i" (pda_offset(field)), \ |
101 | "m" (_proxy_pda.field)); \ | 102 | "m" (_proxy_pda.field)); \ |
102 | break; \ | 103 | break; \ |
103 | case 8: \ | 104 | case 8: \ |
104 | asm(op "q %%gs:%c1,%0": \ | 105 | asm(op "q %%gs:%c1,%0": \ |
105 | "=r" (ret__) : \ | 106 | "=r" (ret__) : \ |
106 | "i" (pda_offset(field)), \ | 107 | "i" (pda_offset(field)), \ |
107 | "m" (_proxy_pda.field)); \ | 108 | "m" (_proxy_pda.field)); \ |
108 | break; \ | 109 | break; \ |
109 | default: \ | 110 | default: \ |
110 | __bad_pda_field(); \ | 111 | __bad_pda_field(); \ |
111 | } \ | 112 | } \ |
112 | ret__; }) | 113 | ret__; \ |
114 | }) | ||
113 | 115 | ||
114 | #define read_pda(field) pda_from_op("mov", field) | 116 | #define read_pda(field) pda_from_op("mov", field) |
115 | #define write_pda(field, val) pda_to_op("mov", field, val) | 117 | #define write_pda(field, val) pda_to_op("mov", field, val) |
@@ -118,12 +120,13 @@ extern struct x8664_pda _proxy_pda; | |||
118 | #define or_pda(field, val) pda_to_op("or", field, val) | 120 | #define or_pda(field, val) pda_to_op("or", field, val) |
119 | 121 | ||
120 | /* This is not atomic against other CPUs -- CPU preemption needs to be off */ | 122 | /* This is not atomic against other CPUs -- CPU preemption needs to be off */ |
121 | #define test_and_clear_bit_pda(bit, field) ({ \ | 123 | #define test_and_clear_bit_pda(bit, field) \ |
122 | int old__; \ | 124 | ({ \ |
123 | asm volatile("btr %2,%%gs:%c3\n\tsbbl %0,%0" \ | 125 | int old__; \ |
124 | : "=r" (old__), "+m" (_proxy_pda.field) \ | 126 | asm volatile("btr %2,%%gs:%c3\n\tsbbl %0,%0" \ |
125 | : "dIr" (bit), "i" (pda_offset(field)) : "memory"); \ | 127 | : "=r" (old__), "+m" (_proxy_pda.field) \ |
126 | old__; \ | 128 | : "dIr" (bit), "i" (pda_offset(field)) : "memory");\ |
129 | old__; \ | ||
127 | }) | 130 | }) |
128 | 131 | ||
129 | #endif | 132 | #endif |