From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S261535AbVHDAo2 (ORCPT ); Wed, 3 Aug 2005 20:44:28 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S261597AbVHDAo1 (ORCPT ); Wed, 3 Aug 2005 20:44:27 -0400 Received: from mailout1.vmware.com ([65.113.40.130]:20499 "EHLO mailout1.vmware.com") by vger.kernel.org with ESMTP id S261535AbVHDAo0 (ORCPT ); Wed, 3 Aug 2005 20:44:26 -0400 Date: Wed, 3 Aug 2005 17:43:04 -0700 From: zach@vmware.com Message-Id: <200508040043.j740h4wB004166@zach-dev.vmware.com> To: akpm@osdl.org, chrisl@vmware.com, davej@codemonkey.org.uk, hpa@zytor.com, linux-kernel@vger.kernel.org, pratap@vmware.com, Riley@Williams.Name, zach@vmware.com Subject: [PATCH] 1/5 more-asm-cleanup X-OriginalArrivalTime: 04 Aug 2005 00:43:09.0000 (UTC) FILETIME=[7C1CCC80:01C5988D] Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org 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"); - + cpuid(4, &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))