x86emul: ADCX/ADOX/MOVDIRI don't permit 16-bit operand size
PATCH 1/1 x86emul: ADCX/ADOX/MOVDIRI don't permit 16-bit operand size
They use NP encodings, which means the 0x66 prefix doesn't affect operand size.
xen/arch/x86/x86_emulate/decode.c +7 -3
@@ -920,9 +920,6 @@ decode_0f38(struct x86_emulate_state *s, case 0xf7 ... 0xf8: case 0xfa ... 0xff: s->op_bytes =0 ; -/* fall through */ -case 0xf6 :/* adcx / adox */ -case 0xf9 :/* movdiri */ ctxt->opcode |=MASK_INSR (s->vex.pfx,X86EMUL_OPC_PFX_MASK );break ;
@@ -957,6 +954,13 @@ decode_0f38(struct x86_emulate_state *s, ctxt->opcode |=MASK_INSR (s->vex.pfx,X86EMUL_OPC_PFX_MASK );break ; +case 0xf6 :/* adcx / adox */ +case 0xf9 :/* movdiri */ +if ( s->op_bytes ==2 ) + s->op_bytes =4 ; + ctxt->opcode |=MASK_INSR (s->vex.pfx,X86EMUL_OPC_PFX_MASK ); +break ; + case X86EMUL_OPC_VEX_66(0, 0xe0) ...X86EMUL_OPC_VEX_66 (0 ,0xef ):/* cmp<cc>xadd */ case X86EMUL_OPC_VEX (0 ,0xf2 ):/* andn */
Quoted 7 lines · Jan Beulich
They use NP encodings, which means the
0x66prefix doesn't affect operand size.Fixes 5ad98e3c7fa9 ("x86emul: support ADCX/ADOX")Fixes a9ecb9e780e2 ("x86emul: support MOVDIR{I,64B} insns")Reported-by Roger Pau Monné <[email protected]>Signed-off-by Jan Beulich <[email protected]>
Quoted 17 lines
xen/arch/x86/x86_emulate/decode.c +0
-3@@ -920,9 +920,6 @@ decode_0f38(struct x86_emulate_state *s, case 0xf7 ... 0xf8: case 0xfa ... 0xff: s->op_bytes =0 ; -/* fall through */ -case 0xf6 :/* adcx / adox */ -case 0xf9 :/* movdiri */ ctxt->opcode |=MASK_INSR (s->vex.pfx,X86EMUL_OPC_PFX_MASK );break ;@@ -957,6 +954,13 @@ decode_0f38(struct x86_emulate_state *s, ctxt->opcode |=MASK_INSR (s->vex.pfx,X86EMUL_OPC_PFX_MASK );break ;
xen/arch/x86/x86_emulate/decode.c decode_0f38(struct x86_emulate_state *s, · line 966
Quoted 10 lines
xen/arch/x86/x86_emulate/decode.c +7
-0+case 0xf6 :/* adcx / adox */ +case 0xf9 :/* movdiri */ +if ( s->op_bytes ==2 ) + s->op_bytes =4 ; + ctxt->opcode |=MASK_INSR (s->vex.pfx,X86EMUL_OPC_PFX_MASK ); +break ; + case X86EMUL_OPC_VEX_66(0, 0xe0) ...X86EMUL_OPC_VEX_66 (0 ,0xef ):/* cmp<cc>xadd */ case X86EMUL_OPC_VEX (0 ,0xf2 ):/* andn */
I fear we might want a more structured solution to this problem. Simply reverting the op_bytes value feels fragile.
~Andrew
Quoted 10 lines · Andrew Cooper
Quoted 7 lines · Jan Beulich
They use NP encodings, which means the
0x66prefix doesn't affect operand size.Fixes 5ad98e3c7fa9 ("x86emul: support ADCX/ADOX")Fixes a9ecb9e780e2 ("x86emul: support MOVDIR{I,64B} insns")Reported-by Roger Pau Monné <[email protected]>Signed-off-by Jan Beulich <[email protected]>Acked-by Andrew Cooper <[email protected]>
Thanks.
Quoted 16 lines
Quoted 16 lines
xen/arch/x86/x86_emulate/decode.c +0
-3@@ -920,9 +920,6 @@ decode_0f38(struct x86_emulate_state *s, case 0xf7 ... 0xf8: case 0xfa ... 0xff: s->op_bytes =0 ; -/* fall through */ -case 0xf6 :/* adcx / adox */ -case 0xf9 :/* movdiri */ ctxt->opcode |=MASK_INSR (s->vex.pfx,X86EMUL_OPC_PFX_MASK );break ;@@ -957,6 +954,13 @@ decode_0f38(struct x86_emulate_state *s, ctxt->opcode |=MASK_INSR (s->vex.pfx,X86EMUL_OPC_PFX_MASK );break ;
Quoted 13 lines
xen/arch/x86/x86_emulate/decode.c decode_0f38(struct x86_emulate_state *s, · line 966
Quoted 10 lines
xen/arch/x86/x86_emulate/decode.c +7
-0+case 0xf6 :/* adcx / adox */ +case 0xf9 :/* movdiri */ +if ( s->op_bytes ==2 ) + s->op_bytes =4 ; + ctxt->opcode |=MASK_INSR (s->vex.pfx,X86EMUL_OPC_PFX_MASK ); +break ; + case X86EMUL_OPC_VEX_66(0, 0xe0) ...X86EMUL_OPC_VEX_66 (0 ,0xef ):/* cmp<cc>xadd */ case X86EMUL_OPC_VEX (0 ,0xf2 ):/* andn */ I fear we might want a more structured solution to this problem. Simply reverting the
op_bytesvalue feels fragile.
Right, just need to think of how such could look like.
Jan