x86/emul: Fix clang build following BMI1/BMI2/TBM instruction support
PATCH 1/1 x86/emul: Fix clang build following BMI1/BMI2/TBM instruction support
Travis reports that Clang objects to integer truncation during assignments to a bitfield:
./x86_emulate/x86_emulate.c:6150:19: error: implicit truncation from 'int' to bitfield changes value from -1 to 15 [-Werror,-Wbitfield-constant-conversion]
pxop->reg = ~0; /* rAX */
^ ~~Use 0xf instead.
---
CC: Jan Beulich <[email protected]>
--- xen/arch/x86/x86_emulate/x86_emulate.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
xen/arch/x86/x86_emulate/x86_emulate.c +3 -3
@@ -6015,7 +6015,7 @@ x86_emulate( *pvex = vex; pvex->b =1 ; pvex->r =1 ; - pvex->reg = ~0 ;/* rAX */ + pvex->reg =0xf ;/* rAX */ buf[3 ] = b; buf[4 ] =0x09 ;/* reg=rCX r/m=(%rCX) */ buf[5 ] =0xc3 ;
@@ -6049,7 +6049,7 @@ x86_emulate( *pvex = vex; pvex->b =1 ; pvex->r =1 ; - pvex->reg = ~0 ;/* rAX */ + pvex->reg =0xf ;/* rAX */ buf[3 ] = b; buf[4 ] = (modrm &0x38 ) |0x01 ;/* r/m=(%rCX) */ buf[5 ] =0xc3 ;
@@ -6147,7 +6147,7 @@ x86_emulate( *pxop = vex; pxop->b =1 ; pxop->r =1 ; - pxop->reg = ~0 ;/* rAX */ + pxop->reg =0xf ;/* rAX */ buf[3 ] = b; buf[4 ] = (modrm &0x38 ) |0x01 ;/* r/m=(%rCX) */ buf[5 ] =0xc3 ;
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 20.01.17 at 16:37, <[email protected]> wrote:
Travis reports that Clang objects to integer truncation during assignments to a bitfield:
./x86_emulate/x86_emulate.c:6150:19: error: implicit truncation from 'int' to bitfield changes value from -1 to 15
[-Werror,-Wbitfield-constant-conversion]
Quoted 6 lines
pxop->reg = ~0; /* rAX */ ^ ~~Use
0xfinstead.Signed-off-by Andrew Cooper <[email protected]>
Reluctantly
as I think the code was just fine before.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel