aboutsummaryrefslogtreecommitdiffstats
path: root/arch/i386/kernel
diff options
context:
space:
mode:
authorZachary Amsden <zach@vmware.com>2005-09-03 18:56:42 -0400
committerLinus Torvalds <torvalds@evo.osdl.org>2005-09-05 03:06:12 -0400
commitf2ab4461249df85b20930a7a57b54f39c5ae291a (patch)
tree17fbe46fdc6e95bf24faccb6001d89c989442f6f /arch/i386/kernel
parent4f0cb8d978ab4b6e3b40147f619f48316d9d7f63 (diff)
[PATCH] x86: more asm cleanups
Some more assembler cleanups I noticed along the way. Signed-off-by: Zachary Amsden <zach@vmware.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/i386/kernel')
-rw-r--r--arch/i386/kernel/cpu/intel.c9
-rw-r--r--arch/i386/kernel/crash.c2
-rw-r--r--arch/i386/kernel/machine_kexec.c10
-rw-r--r--arch/i386/kernel/msr.c31
-rw-r--r--arch/i386/kernel/process.c2
5 files changed, 13 insertions, 41 deletions
diff --git a/arch/i386/kernel/cpu/intel.c b/arch/i386/kernel/cpu/intel.c
index a2c33c1a46c5..43601de0f633 100644
--- a/arch/i386/kernel/cpu/intel.c
+++ b/arch/i386/kernel/cpu/intel.c
@@ -82,16 +82,13 @@ static void __devinit Intel_errata_workarounds(struct cpuinfo_x86 *c)
82 */ 82 */
83static int __devinit num_cpu_cores(struct cpuinfo_x86 *c) 83static int __devinit num_cpu_cores(struct cpuinfo_x86 *c)
84{ 84{
85 unsigned int eax; 85 unsigned int eax, ebx, ecx, edx;
86 86
87 if (c->cpuid_level < 4) 87 if (c->cpuid_level < 4)
88 return 1; 88 return 1;
89 89
90 __asm__("cpuid" 90 /* Intel has a non-standard dependency on %ecx for this CPUID level. */
91 : "=a" (eax) 91 cpuid_count(4, 0, &eax, &ebx, &ecx, &edx);
92 : "0" (4), "c" (0)
93 : "bx", "dx");
94
95 if (eax & 0x1f) 92 if (eax & 0x1f)
96 return ((eax >> 26) + 1); 93 return ((eax >> 26) + 1);
97 else 94 else
diff --git a/arch/i386/kernel/crash.c b/arch/i386/kernel/crash.c
index e5fab12f7926..913be77bb844 100644
--- a/arch/i386/kernel/crash.c
+++ b/arch/i386/kernel/crash.c
@@ -153,7 +153,7 @@ static int crash_nmi_callback(struct pt_regs *regs, int cpu)
153 disable_local_APIC(); 153 disable_local_APIC();
154 atomic_dec(&waiting_for_crash_ipi); 154 atomic_dec(&waiting_for_crash_ipi);
155 /* Assume hlt works */ 155 /* Assume hlt works */
156 __asm__("hlt"); 156 halt();
157 for(;;); 157 for(;;);
158 158
159 return 1; 159 return 1;
diff --git a/arch/i386/kernel/machine_kexec.c b/arch/i386/kernel/machine_kexec.c
index f19f6d34bcbf..a912fed48482 100644
--- a/arch/i386/kernel/machine_kexec.c
+++ b/arch/i386/kernel/machine_kexec.c
@@ -93,10 +93,7 @@ static void set_idt(void *newidt, __u16 limit)
93 curidt.size = limit; 93 curidt.size = limit;
94 curidt.address = (unsigned long)newidt; 94 curidt.address = (unsigned long)newidt;
95 95
96 __asm__ __volatile__ ( 96 load_idt(&curidt);
97 "lidtl %0\n"
98 : : "m" (curidt)
99 );
100}; 97};
101 98
102 99
@@ -108,10 +105,7 @@ static void set_gdt(void *newgdt, __u16 limit)
108 curgdt.size = limit; 105 curgdt.size = limit;
109 curgdt.address = (unsigned long)newgdt; 106 curgdt.address = (unsigned long)newgdt;
110 107
111 __asm__ __volatile__ ( 108 load_gdt(&curgdt);
112 "lgdtl %0\n"
113 : : "m" (curgdt)
114 );
115}; 109};
116 110
117static void load_segments(void) 111static void load_segments(void)
diff --git a/arch/i386/kernel/msr.c b/arch/i386/kernel/msr.c
index b2f03c39a6fe..03100d6fc5d6 100644
--- a/arch/i386/kernel/msr.c
+++ b/arch/i386/kernel/msr.c
@@ -46,23 +46,13 @@
46 46
47static struct class *msr_class; 47static struct class *msr_class;
48 48
49/* Note: "err" is handled in a funny way below. Otherwise one version
50 of gcc or another breaks. */
51
52static inline int wrmsr_eio(u32 reg, u32 eax, u32 edx) 49static inline int wrmsr_eio(u32 reg, u32 eax, u32 edx)
53{ 50{
54 int err; 51 int err;
55 52
56 asm volatile ("1: wrmsr\n" 53 err = wrmsr_safe(reg, eax, edx);
57 "2:\n" 54 if (err)
58 ".section .fixup,\"ax\"\n" 55 err = -EIO;
59 "3: movl %4,%0\n"
60 " jmp 2b\n"
61 ".previous\n"
62 ".section __ex_table,\"a\"\n"
63 " .align 4\n" " .long 1b,3b\n" ".previous":"=&bDS" (err)
64 :"a"(eax), "d"(edx), "c"(reg), "i"(-EIO), "0"(0));
65
66 return err; 56 return err;
67} 57}
68 58
@@ -70,18 +60,9 @@ static inline int rdmsr_eio(u32 reg, u32 *eax, u32 *edx)
70{ 60{
71 int err; 61 int err;
72 62
73 asm volatile ("1: rdmsr\n" 63 err = rdmsr_safe(reg, eax, edx);
74 "2:\n" 64 if (err)
75 ".section .fixup,\"ax\"\n" 65 err = -EIO;
76 "3: movl %4,%0\n"
77 " jmp 2b\n"
78 ".previous\n"
79 ".section __ex_table,\"a\"\n"
80 " .align 4\n"
81 " .long 1b,3b\n"
82 ".previous":"=&bDS" (err), "=a"(*eax), "=d"(*edx)
83 :"c"(reg), "i"(-EIO), "0"(0));
84
85 return err; 66 return err;
86} 67}
87 68
diff --git a/arch/i386/kernel/process.c b/arch/i386/kernel/process.c
index 9d94995e9672..660997800393 100644
--- a/arch/i386/kernel/process.c
+++ b/arch/i386/kernel/process.c
@@ -164,7 +164,7 @@ static inline void play_dead(void)
164 */ 164 */
165 local_irq_disable(); 165 local_irq_disable();
166 while (1) 166 while (1)
167 __asm__ __volatile__("hlt":::"memory"); 167 halt();
168} 168}
169#else 169#else
170static inline void play_dead(void) 170static inline void play_dead(void)