diff options
author | Avi Kivity <avi@redhat.com> | 2011-04-24 04:11:51 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2011-04-24 07:20:36 -0400 |
commit | 15d6aba24d88231415f4e7e091c0f1e60c3e6fd5 (patch) | |
tree | d676b9dabda1764d1f4d769b6401b0870af4c69d /arch/x86/include/asm/system.h | |
parent | 0f1d9f78ce41a8874d30271ef8480e6f8f7f1fce (diff) |
x86: Demacro CONFIG_PARAVIRT cpu accessors
Recently, we had a build failure on !CONFIG_PARAVIRT due to a
callback ->wbinvd() clashing with a macro wbinvd().
While we worked around the issue, avoid it in the future by
changing the macro (and a few surrounding ones) to an inline
function.
Signed-off-by: Avi Kivity <avi@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Link: http://lkml.kernel.org/r/1303632711-21662-1-git-send-email-avi@redhat.com
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/include/asm/system.h')
-rw-r--r-- | arch/x86/include/asm/system.h | 85 |
1 files changed, 71 insertions, 14 deletions
diff --git a/arch/x86/include/asm/system.h b/arch/x86/include/asm/system.h index 12569e691ce3..c2ff2a1d845e 100644 --- a/arch/x86/include/asm/system.h +++ b/arch/x86/include/asm/system.h | |||
@@ -303,24 +303,81 @@ static inline void native_wbinvd(void) | |||
303 | #ifdef CONFIG_PARAVIRT | 303 | #ifdef CONFIG_PARAVIRT |
304 | #include <asm/paravirt.h> | 304 | #include <asm/paravirt.h> |
305 | #else | 305 | #else |
306 | #define read_cr0() (native_read_cr0()) | 306 | |
307 | #define write_cr0(x) (native_write_cr0(x)) | 307 | static inline unsigned long read_cr0(void) |
308 | #define read_cr2() (native_read_cr2()) | 308 | { |
309 | #define write_cr2(x) (native_write_cr2(x)) | 309 | return native_read_cr0(); |
310 | #define read_cr3() (native_read_cr3()) | 310 | } |
311 | #define write_cr3(x) (native_write_cr3(x)) | 311 | |
312 | #define read_cr4() (native_read_cr4()) | 312 | static inline void write_cr0(unsigned long x) |
313 | #define read_cr4_safe() (native_read_cr4_safe()) | 313 | { |
314 | #define write_cr4(x) (native_write_cr4(x)) | 314 | native_write_cr0(x); |
315 | #define wbinvd() (native_wbinvd()) | 315 | } |
316 | |||
317 | static inline unsigned long read_cr2(void) | ||
318 | { | ||
319 | return native_read_cr2(); | ||
320 | } | ||
321 | |||
322 | static inline void write_cr2(unsigned long x) | ||
323 | { | ||
324 | native_write_cr2(x); | ||
325 | } | ||
326 | |||
327 | static inline unsigned long read_cr3(void) | ||
328 | { | ||
329 | return native_read_cr3(); | ||
330 | } | ||
331 | |||
332 | static inline void write_cr3(unsigned long x) | ||
333 | { | ||
334 | native_write_cr3(x); | ||
335 | } | ||
336 | |||
337 | static inline unsigned long read_cr4(void) | ||
338 | { | ||
339 | return native_read_cr4(); | ||
340 | } | ||
341 | |||
342 | static inline unsigned long read_cr4_safe(void) | ||
343 | { | ||
344 | return native_read_cr4_safe(); | ||
345 | } | ||
346 | |||
347 | static inline void write_cr4(unsigned long x) | ||
348 | { | ||
349 | native_write_cr4(x); | ||
350 | } | ||
351 | |||
352 | static inline void wbinvd(void) | ||
353 | { | ||
354 | native_wbinvd(); | ||
355 | } | ||
356 | |||
316 | #ifdef CONFIG_X86_64 | 357 | #ifdef CONFIG_X86_64 |
317 | #define read_cr8() (native_read_cr8()) | 358 | |
318 | #define write_cr8(x) (native_write_cr8(x)) | 359 | static inline unsigned long read_cr8(void) |
319 | #define load_gs_index native_load_gs_index | 360 | { |
361 | return native_read_cr8(); | ||
362 | } | ||
363 | |||
364 | static inline void write_cr8(unsigned long x) | ||
365 | { | ||
366 | native_write_cr8(x); | ||
367 | } | ||
368 | |||
369 | static inline void load_gs_index(unsigned selector) | ||
370 | { | ||
371 | native_load_gs_index(selector); | ||
372 | } | ||
373 | |||
320 | #endif | 374 | #endif |
321 | 375 | ||
322 | /* Clear the 'TS' bit */ | 376 | /* Clear the 'TS' bit */ |
323 | #define clts() (native_clts()) | 377 | static inline void clts(void) |
378 | { | ||
379 | native_clts(); | ||
380 | } | ||
324 | 381 | ||
325 | #endif/* CONFIG_PARAVIRT */ | 382 | #endif/* CONFIG_PARAVIRT */ |
326 | 383 | ||