From mboxrd@z Thu Jan 1 00:00:00 1970 From: Keir Fraser Subject: Re: [PATCH] x86 emulation: fix bswap Date: Thu, 15 Feb 2007 11:54:27 +0000 Message-ID: References: <907625E08839C4409CE5768403633E0B018E1988@sefsexmb1.amd.com> Mime-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <907625E08839C4409CE5768403633E0B018E1988@sefsexmb1.amd.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "Petersson, Mats" , Jan Beulich , xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org On 15/2/07 11:46, "Petersson, Mats" wrote: > I just wrote a little bit of code to test it: > int x = 0x12345678; > __asm__(".byte 0x66; bswap %0": "=r"(x): "0"(x)) > printf("x=%x", x); > > Prints 12340000, so the data is "zerod". (and it looks like the code > generated by gcc is correct!). Same behaviour as on an Intel CPU. I am quite inclined to do that directly in the emulator, with a comment explaining why, rather than do an undefined operation. That just seems unnecessarily scary. Direct 32- and 64-bit BSWAP is okay though and does reduce the code size. -- Keir