diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2007-05-02 13:27:10 -0400 |
---|---|---|
committer | Andi Kleen <andi@basil.nowhere.org> | 2007-05-02 13:27:10 -0400 |
commit | 90a0a06aa81692028864c21f981905fda46b1208 (patch) | |
tree | 516528b328d5288ee057d1eff5491e2ba1b49af1 /include/asm-i386/irqflags.h | |
parent | 52de74dd3994e165ef1b35c33d54655a6400e30c (diff) |
[PATCH] i386: rationalize paravirt wrappers
paravirt.c used to implement native versions of all low-level
functions. Far cleaner is to have the native versions exposed in the
headers and as inline native_XXX, and if !CONFIG_PARAVIRT, then simply
#define XXX native_XXX.
There are several nice side effects:
1) write_dt_entry() now takes the correct "struct Xgt_desc_struct *"
not "void *".
2) load_TLS is reintroduced to the for loop, not manually unrolled
with a #error in case the bounds ever change.
3) Macros become inlines, with type checking.
4) Access to the native versions is trivial for KVM, lguest, Xen and
others who might want it.
Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Andi Kleen <ak@suse.de>
Cc: Andi Kleen <ak@muc.de>
Cc: Avi Kivity <avi@qumranet.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'include/asm-i386/irqflags.h')
-rw-r--r-- | include/asm-i386/irqflags.h | 61 |
1 files changed, 42 insertions, 19 deletions
diff --git a/include/asm-i386/irqflags.h b/include/asm-i386/irqflags.h index 17b18cf4fe9d..c1cdd094938e 100644 --- a/include/asm-i386/irqflags.h +++ b/include/asm-i386/irqflags.h | |||
@@ -10,6 +10,42 @@ | |||
10 | #ifndef _ASM_IRQFLAGS_H | 10 | #ifndef _ASM_IRQFLAGS_H |
11 | #define _ASM_IRQFLAGS_H | 11 | #define _ASM_IRQFLAGS_H |
12 | 12 | ||
13 | #ifndef __ASSEMBLY__ | ||
14 | static inline unsigned long native_save_fl(void) | ||
15 | { | ||
16 | unsigned long f; | ||
17 | asm volatile("pushfl ; popl %0":"=g" (f): /* no input */); | ||
18 | return f; | ||
19 | } | ||
20 | |||
21 | static inline void native_restore_fl(unsigned long f) | ||
22 | { | ||
23 | asm volatile("pushl %0 ; popfl": /* no output */ | ||
24 | :"g" (f) | ||
25 | :"memory", "cc"); | ||
26 | } | ||
27 | |||
28 | static inline void native_irq_disable(void) | ||
29 | { | ||
30 | asm volatile("cli": : :"memory"); | ||
31 | } | ||
32 | |||
33 | static inline void native_irq_enable(void) | ||
34 | { | ||
35 | asm volatile("sti": : :"memory"); | ||
36 | } | ||
37 | |||
38 | static inline void native_safe_halt(void) | ||
39 | { | ||
40 | asm volatile("sti; hlt": : :"memory"); | ||
41 | } | ||
42 | |||
43 | static inline void native_halt(void) | ||
44 | { | ||
45 | asm volatile("hlt": : :"memory"); | ||
46 | } | ||
47 | #endif /* __ASSEMBLY__ */ | ||
48 | |||
13 | #ifdef CONFIG_PARAVIRT | 49 | #ifdef CONFIG_PARAVIRT |
14 | #include <asm/paravirt.h> | 50 | #include <asm/paravirt.h> |
15 | #else | 51 | #else |
@@ -17,35 +53,22 @@ | |||
17 | 53 | ||
18 | static inline unsigned long __raw_local_save_flags(void) | 54 | static inline unsigned long __raw_local_save_flags(void) |
19 | { | 55 | { |
20 | unsigned long flags; | 56 | return native_save_fl(); |
21 | |||
22 | __asm__ __volatile__( | ||
23 | "pushfl ; popl %0" | ||
24 | : "=g" (flags) | ||
25 | : /* no input */ | ||
26 | ); | ||
27 | |||
28 | return flags; | ||
29 | } | 57 | } |
30 | 58 | ||
31 | static inline void raw_local_irq_restore(unsigned long flags) | 59 | static inline void raw_local_irq_restore(unsigned long flags) |
32 | { | 60 | { |
33 | __asm__ __volatile__( | 61 | native_restore_fl(flags); |
34 | "pushl %0 ; popfl" | ||
35 | : /* no output */ | ||
36 | :"g" (flags) | ||
37 | :"memory", "cc" | ||
38 | ); | ||
39 | } | 62 | } |
40 | 63 | ||
41 | static inline void raw_local_irq_disable(void) | 64 | static inline void raw_local_irq_disable(void) |
42 | { | 65 | { |
43 | __asm__ __volatile__("cli" : : : "memory"); | 66 | native_irq_disable(); |
44 | } | 67 | } |
45 | 68 | ||
46 | static inline void raw_local_irq_enable(void) | 69 | static inline void raw_local_irq_enable(void) |
47 | { | 70 | { |
48 | __asm__ __volatile__("sti" : : : "memory"); | 71 | native_irq_enable(); |
49 | } | 72 | } |
50 | 73 | ||
51 | /* | 74 | /* |
@@ -54,7 +77,7 @@ static inline void raw_local_irq_enable(void) | |||
54 | */ | 77 | */ |
55 | static inline void raw_safe_halt(void) | 78 | static inline void raw_safe_halt(void) |
56 | { | 79 | { |
57 | __asm__ __volatile__("sti; hlt" : : : "memory"); | 80 | native_safe_halt(); |
58 | } | 81 | } |
59 | 82 | ||
60 | /* | 83 | /* |
@@ -63,7 +86,7 @@ static inline void raw_safe_halt(void) | |||
63 | */ | 86 | */ |
64 | static inline void halt(void) | 87 | static inline void halt(void) |
65 | { | 88 | { |
66 | __asm__ __volatile__("hlt": : :"memory"); | 89 | native_halt(); |
67 | } | 90 | } |
68 | 91 | ||
69 | /* | 92 | /* |