Some more assembler cleanups I noticed along the way. Diffs against: 2.6.13-rc4-mm1 Signed-off-by: Zachary Amsden cpuid_level < 4) return 1; - __asm__("cpuid" - : "=a" (eax) - : "0" (4), "c" (0) - : "bx", "dx"); - + /* Intel has a non-standard dependency on %ecx for this CPUID level. */ + cpuid_count(4, 0, &eax, &ebx, &ecx, &edx); if (eax & 0x1f) return ((eax >> 26) + 1); else Index: linux-2.6.13/arch/i386/mach-voyager/voyager_basic.c =================================================================== --- linux-2.6.13.orig/arch/i386/mach-voyager/voyager_basic.c 2005-08-03 15:18:18.000000000 -0700 +++ linux-2.6.13/arch/i386/mach-voyager/voyager_basic.c 2005-08-03 15:19:39.000000000 -0700 @@ -234,10 +234,9 @@ #endif } /* and wait for it to happen */ - for(;;) { - __asm("cli"); - __asm("hlt"); - } + local_irq_disable(); + for(;;) + halt(); } /* copied from process.c */ @@ -272,10 +271,9 @@ outb(basebd | 0x08, VOYAGER_MC_SETUP); outb(0x02, catbase + 0x21); } - for(;;) { - asm("cli"); - asm("hlt"); - } + local_irq_disable(); + for(;;) + halt(); } void Index: linux-2.6.13/arch/i386/mach-voyager/voyager_smp.c =================================================================== --- linux-2.6.13.orig/arch/i386/mach-voyager/voyager_smp.c 2005-08-03 15:18:18.000000000 -0700 +++ linux-2.6.13/arch/i386/mach-voyager/voyager_smp.c 2005-08-03 15:19:39.000000000 -0700 @@ -1015,7 +1015,7 @@ cpu_clear(smp_processor_id(), cpu_online_map); local_irq_disable(); for(;;) - __asm__("hlt"); + halt(); } static DEFINE_SPINLOCK(call_lock); Index: linux-2.6.13/include/asm-i386/msr.h =================================================================== --- linux-2.6.13.orig/include/asm-i386/msr.h 2005-08-03 15:18:18.000000000 -0700 +++ linux-2.6.13/include/asm-i386/msr.h 2005-08-03 17:16:07.000000000 -0700 @@ -47,6 +47,21 @@ : "c" (msr), "0" (a), "d" (b), "i" (-EFAULT));\ ret__; }) +/* rdmsr with exception handling */ +#define rdmsr_safe(msr,a,b) ({ int ret__; \ + asm volatile("2: rdmsr ; xorl %0,%0\n" \ + "1:\n\t" \ + ".section .fixup,\"ax\"\n\t" \ + "3: movl %4,%0 ; jmp 1b\n\t" \ + ".previous\n\t" \ + ".section __ex_table,\"a\"\n" \ + " .align 4\n\t" \ + " .long 2b,3b\n\t" \ + ".previous" \ + : "=r" (ret__), "=a" (*(a)), "=d" (*(b)) \ + : "c" (msr), "i" (-EFAULT));\ + ret__; }) + #define rdtsc(low,high) \ __asm__ __volatile__("rdtsc" : "=a" (low), "=d" (high))