[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v2 1/5] x86/entry: Correct comparisons against boolean variables



On Tue, Feb 27, 2018 at 02:50:32PM +0000, Andrew Cooper wrote:
> The correct way to check a boolean is `cmpb $0` or `testb $0xff`, whereas a
> lot of our entry code uses `testb $1`.  This will work in principle for values
> which are really C _Bool types, but won't work for other integer types which
> are intended to have boolean properties.
> 
> cmp is the more logical way of thinking about the operation, so adjust all
> outstanding uses of `testb $1` against boolean values.  Changing test to cmp
> changes the logical mnemonic of the following condition from 'zero' to
> 'equal', but the actual encoding remains the same.
> 
> No functional change, as all uses are real C _Bool types, and confirmed by
> diffing the disassembly.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

Reviewed-by: Wei Liu <wei.liu2@xxxxxxxxxx>

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.