WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH] x86 emulation: fix bswap

To: "Petersson, Mats" <Mats.Petersson@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] x86 emulation: fix bswap
From: Keir Fraser <keir@xxxxxxxxxxxxx>
Date: Thu, 15 Feb 2007 11:54:27 +0000
Delivery-date: Thu, 15 Feb 2007 03:53:57 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <907625E08839C4409CE5768403633E0B018E1988@xxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcdQ7LFF74/AALzfEdu/0gAX8io7RQACKPMwAACtewo=
Thread-topic: [Xen-devel] [PATCH] x86 emulation: fix bswap
User-agent: Microsoft-Entourage/11.2.5.060620


On 15/2/07 11:46, "Petersson, Mats" <Mats.Petersson@xxxxxxx> 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


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel