Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753494Ab0KINsT (ORCPT ); Tue, 9 Nov 2010 08:48:19 -0500 Received: from one.firstfloor.org ([213.235.205.2]:36705 "EHLO one.firstfloor.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751165Ab0KINsS (ORCPT ); Tue, 9 Nov 2010 08:48:18 -0500 Date: Tue, 9 Nov 2010 14:48:16 +0100 From: Andi Kleen To: Michael Matz Cc: Dave Korn , Andi Kleen , Richard Guenther , Andreas Schwab , Jim , Linux Kernel Mailing List , gcc@gcc.gnu.org Subject: Re: gcc 4.5.1 / as 2.20.51.0.11 miscompiling drivers/char/i8k.c ? Message-ID: <20101109134816.GB29433@basil.fritz.box> References: <4CD538CA.8010901@xs4all.nl> <87wroostw3.fsf@basil.nowhere.org> <87k4kospnd.fsf@basil.nowhere.org> <877hgorrj1.fsf@basil.nowhere.org> <4CD843DC.10106@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1357 Lines: 43 > My speculation is, that the asm is not removed but rather that regs.eax > isn't reloaded after the asm because the memory clobber doesn't clobber > automatic variables. Yes that makes sense. I wasn't able to verify it so far though. Maybe the original poster could try the obvious patch instead of the volatile change. i8k: tell gcc that regs gets clobbered Signed-off-by: Andi Kleen diff --git a/drivers/char/i8k.c b/drivers/char/i8k.c index 3bc0eef..f3bbf73 100644 --- a/drivers/char/i8k.c +++ b/drivers/char/i8k.c @@ -142,7 +142,7 @@ static int i8k_smm(struct smm_regs *regs) "lahf\n\t" "shrl $8,%%eax\n\t" "andl $1,%%eax\n" - :"=a"(rc) + :"=a"(rc), "=m" (*regs) : "a"(regs) : "%ebx", "%ecx", "%edx", "%esi", "%edi", "memory"); #else @@ -167,7 +167,7 @@ static int i8k_smm(struct smm_regs *regs) "movl %%edx,0(%%eax)\n\t" "lahf\n\t" "shrl $8,%%eax\n\t" - "andl $1,%%eax\n":"=a"(rc) + "andl $1,%%eax\n":"=a"(rc), "=m" (*regs) : "a"(regs) : "%ebx", "%ecx", "%edx", "%esi", "%edi", "memory"); #endif -Andi -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/