diff options
author | Andi Kleen <ak@suse.de> | 2007-05-02 13:27:11 -0400 |
---|---|---|
committer | Andi Kleen <andi@basil.nowhere.org> | 2007-05-02 13:27:11 -0400 |
commit | 5d02d7ae73ac9446f20bbf604b04a74637178b35 (patch) | |
tree | aa9567f82def28a452f7625e5a5cc6078148c9cd | |
parent | b92e9fac400d4ae5bc7a75c568e9844ec53ea329 (diff) |
[PATCH] x86-64: Use X86_EFLAGS_IF in x86-64/irqflags.h.
As per i386 patch: move X86_EFLAGS_IF et al out to a new header:
processor-flags.h, so we can include it from irqflags.h and use it in
raw_irqs_disabled_flags().
As a side-effect, we could now use these flags in .S files.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Andi Kleen <ak@suse.de>
-rw-r--r-- | include/asm-x86_64/irqflags.h | 9 | ||||
-rw-r--r-- | include/asm-x86_64/processor-flags.h | 26 | ||||
-rw-r--r-- | include/asm-x86_64/processor.h | 22 |
3 files changed, 32 insertions, 25 deletions
diff --git a/include/asm-x86_64/irqflags.h b/include/asm-x86_64/irqflags.h index cce6937e87c0..86e70fe23659 100644 --- a/include/asm-x86_64/irqflags.h +++ b/include/asm-x86_64/irqflags.h | |||
@@ -9,6 +9,7 @@ | |||
9 | */ | 9 | */ |
10 | #ifndef _ASM_IRQFLAGS_H | 10 | #ifndef _ASM_IRQFLAGS_H |
11 | #define _ASM_IRQFLAGS_H | 11 | #define _ASM_IRQFLAGS_H |
12 | #include <asm/processor-flags.h> | ||
12 | 13 | ||
13 | #ifndef __ASSEMBLY__ | 14 | #ifndef __ASSEMBLY__ |
14 | /* | 15 | /* |
@@ -53,19 +54,19 @@ static inline void raw_local_irq_disable(void) | |||
53 | { | 54 | { |
54 | unsigned long flags = __raw_local_save_flags(); | 55 | unsigned long flags = __raw_local_save_flags(); |
55 | 56 | ||
56 | raw_local_irq_restore((flags & ~(1 << 9)) | (1 << 18)); | 57 | raw_local_irq_restore((flags & ~X86_EFLAGS_IF) | X86_EFLAGS_AC); |
57 | } | 58 | } |
58 | 59 | ||
59 | static inline void raw_local_irq_enable(void) | 60 | static inline void raw_local_irq_enable(void) |
60 | { | 61 | { |
61 | unsigned long flags = __raw_local_save_flags(); | 62 | unsigned long flags = __raw_local_save_flags(); |
62 | 63 | ||
63 | raw_local_irq_restore((flags | (1 << 9)) & ~(1 << 18)); | 64 | raw_local_irq_restore((flags | X86_EFLAGS_IF) & (~X86_EFLAGS_AC)); |
64 | } | 65 | } |
65 | 66 | ||
66 | static inline int raw_irqs_disabled_flags(unsigned long flags) | 67 | static inline int raw_irqs_disabled_flags(unsigned long flags) |
67 | { | 68 | { |
68 | return !(flags & (1<<9)) || (flags & (1 << 18)); | 69 | return !(flags & X86_EFLAGS_IF) || (flags & X86_EFLAGS_AC); |
69 | } | 70 | } |
70 | 71 | ||
71 | #else /* CONFIG_X86_VSMP */ | 72 | #else /* CONFIG_X86_VSMP */ |
@@ -82,7 +83,7 @@ static inline void raw_local_irq_enable(void) | |||
82 | 83 | ||
83 | static inline int raw_irqs_disabled_flags(unsigned long flags) | 84 | static inline int raw_irqs_disabled_flags(unsigned long flags) |
84 | { | 85 | { |
85 | return !(flags & (1 << 9)); | 86 | return !(flags & X86_EFLAGS_IF); |
86 | } | 87 | } |
87 | 88 | ||
88 | #endif | 89 | #endif |
diff --git a/include/asm-x86_64/processor-flags.h b/include/asm-x86_64/processor-flags.h new file mode 100644 index 000000000000..806112fb7985 --- /dev/null +++ b/include/asm-x86_64/processor-flags.h | |||
@@ -0,0 +1,26 @@ | |||
1 | #ifndef __ASM_X86_64_PROCESSOR_FLAGS_H | ||
2 | #define __ASM_X86_64_PROCESSOR_FLAGS_H | ||
3 | /* Various flags defined: can be included from assembler. */ | ||
4 | |||
5 | /* | ||
6 | * EFLAGS bits | ||
7 | */ | ||
8 | #define X86_EFLAGS_CF 0x00000001 /* Carry Flag */ | ||
9 | #define X86_EFLAGS_PF 0x00000004 /* Parity Flag */ | ||
10 | #define X86_EFLAGS_AF 0x00000010 /* Auxillary carry Flag */ | ||
11 | #define X86_EFLAGS_ZF 0x00000040 /* Zero Flag */ | ||
12 | #define X86_EFLAGS_SF 0x00000080 /* Sign Flag */ | ||
13 | #define X86_EFLAGS_TF 0x00000100 /* Trap Flag */ | ||
14 | #define X86_EFLAGS_IF 0x00000200 /* Interrupt Flag */ | ||
15 | #define X86_EFLAGS_DF 0x00000400 /* Direction Flag */ | ||
16 | #define X86_EFLAGS_OF 0x00000800 /* Overflow Flag */ | ||
17 | #define X86_EFLAGS_IOPL 0x00003000 /* IOPL mask */ | ||
18 | #define X86_EFLAGS_NT 0x00004000 /* Nested Task */ | ||
19 | #define X86_EFLAGS_RF 0x00010000 /* Resume Flag */ | ||
20 | #define X86_EFLAGS_VM 0x00020000 /* Virtual Mode */ | ||
21 | #define X86_EFLAGS_AC 0x00040000 /* Alignment Check */ | ||
22 | #define X86_EFLAGS_VIF 0x00080000 /* Virtual Interrupt Flag */ | ||
23 | #define X86_EFLAGS_VIP 0x00100000 /* Virtual Interrupt Pending */ | ||
24 | #define X86_EFLAGS_ID 0x00200000 /* CPUID detection flag */ | ||
25 | |||
26 | #endif /* __ASM_X86_64_PROCESSOR_FLAGS_H */ | ||
diff --git a/include/asm-x86_64/processor.h b/include/asm-x86_64/processor.h index 76552d72804c..2c1497de0b09 100644 --- a/include/asm-x86_64/processor.h +++ b/include/asm-x86_64/processor.h | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <asm/percpu.h> | 20 | #include <asm/percpu.h> |
21 | #include <linux/personality.h> | 21 | #include <linux/personality.h> |
22 | #include <linux/cpumask.h> | 22 | #include <linux/cpumask.h> |
23 | #include <asm/processor-flags.h> | ||
23 | 24 | ||
24 | #define TF_MASK 0x00000100 | 25 | #define TF_MASK 0x00000100 |
25 | #define IF_MASK 0x00000200 | 26 | #define IF_MASK 0x00000200 |
@@ -103,27 +104,6 @@ extern unsigned int init_intel_cacheinfo(struct cpuinfo_x86 *c); | |||
103 | extern unsigned short num_cache_leaves; | 104 | extern unsigned short num_cache_leaves; |
104 | 105 | ||
105 | /* | 106 | /* |
106 | * EFLAGS bits | ||
107 | */ | ||
108 | #define X86_EFLAGS_CF 0x00000001 /* Carry Flag */ | ||
109 | #define X86_EFLAGS_PF 0x00000004 /* Parity Flag */ | ||
110 | #define X86_EFLAGS_AF 0x00000010 /* Auxillary carry Flag */ | ||
111 | #define X86_EFLAGS_ZF 0x00000040 /* Zero Flag */ | ||
112 | #define X86_EFLAGS_SF 0x00000080 /* Sign Flag */ | ||
113 | #define X86_EFLAGS_TF 0x00000100 /* Trap Flag */ | ||
114 | #define X86_EFLAGS_IF 0x00000200 /* Interrupt Flag */ | ||
115 | #define X86_EFLAGS_DF 0x00000400 /* Direction Flag */ | ||
116 | #define X86_EFLAGS_OF 0x00000800 /* Overflow Flag */ | ||
117 | #define X86_EFLAGS_IOPL 0x00003000 /* IOPL mask */ | ||
118 | #define X86_EFLAGS_NT 0x00004000 /* Nested Task */ | ||
119 | #define X86_EFLAGS_RF 0x00010000 /* Resume Flag */ | ||
120 | #define X86_EFLAGS_VM 0x00020000 /* Virtual Mode */ | ||
121 | #define X86_EFLAGS_AC 0x00040000 /* Alignment Check */ | ||
122 | #define X86_EFLAGS_VIF 0x00080000 /* Virtual Interrupt Flag */ | ||
123 | #define X86_EFLAGS_VIP 0x00100000 /* Virtual Interrupt Pending */ | ||
124 | #define X86_EFLAGS_ID 0x00200000 /* CPUID detection flag */ | ||
125 | |||
126 | /* | ||
127 | * Intel CPU features in CR4 | 107 | * Intel CPU features in CR4 |
128 | */ | 108 | */ |
129 | #define X86_CR4_VME 0x0001 /* enable vm86 extensions */ | 109 | #define X86_CR4_VME 0x0001 /* enable vm86 extensions */ |