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

[Xen-devel] Re: [PATCH]enable PCI serial card usage

To: "Wei, Gang" <gang.wei@xxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] Re: [PATCH]enable PCI serial card usage
From: Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
Date: Wed, 31 Mar 2010 10:08:48 +0100
Cc:
Delivery-date: Wed, 31 Mar 2010 02:12:59 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <E6467867A6B05E4FA831B7DF29925F5C40E0FE60@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
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/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcrQe4R+tgvNgRsDTUyRtRb8R9HK+gANkFS7
Thread-topic: [PATCH]enable PCI serial card usage
User-agent: Microsoft-Entourage/12.24.0.100205
On 31/03/2010 03:40, "Wei, Gang" <gang.wei@xxxxxxxxx> wrote:

> +    int pb_bdf_enable:1;    /* if =1, pb-bdf effective, port behind bridge */
> +    int ps_bdf_enable:1;    /* if =1, ps_bdf effective, port on pci card */

Point of information for you: a signed integer N-bit bit field can take
values in the range -2^(N-1) to 2^(N-1)-1. In this case N=1 and the allowed
values are -1 and 0. Hence assigning value 1 to the above bit fields has
undefined behaviour and some versions of gcc will not 'set the flag' as you
expect! We've been bitten by it before. Generally your bit fields should be
*unsigned* unless you specifically want signed-integer semantics. Even
better here, we'll burn the extra bits and use xen_bool_t.

I will fix your patch in this case before applying.

 -- Keir



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

<Prev in Thread] Current Thread [Next in Thread>