From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: In-Reply-To: References: Mime-Version: 1.0 (Apple Message framework v752.2) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: From: Segher Boessenkool Subject: Re: [PATCH 6/15] bootwrapper: switch 64 bit cpus to 32 bit mode Date: Wed, 11 Jul 2007 00:57:07 +0200 To: Milton Miller Cc: linuxppc-dev@ozlabs.org, Paul Mackerras , David Gibson List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , > + /* Check if the processor is running in 32 bit mode, using > + * only 32 bit instructions which should be safe on 32 and > + * 64 bit processors. > + * > + * Subtract the bottom 32 bits of MSR from the full value > + * recording the result. Since MSR[SF] is in the high word, > + * the result will be not-equal iff in 32 bit mode (either > + * the processor is a 32 bit processor or MSR[SF] = 0). > + */ The other way around -- the processor is 64-bit and MSR[SF]=1. Great trick btw! :-) > + mfmsr r0 /* grab whole msr */ > + rlwinm r8,r0,0,0,31 /* extract bottom word */ > + subf. r8,r8,r0 /* subtract, same? */ > + beq 0f /* yes: we are 32 bit mode */ The code is fine though. Segher