|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v4 02/16] x86emul: support AVX10 forms of SM4 insns
Simply clone the VEX-encoded handling to cover the EVEX forms.
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
SDE: -dmr / -future
---
v4: Address v3 TODO. Move ahead in series, switching feature dependency to
plain AVX10. Add call to avx512_vlen_check().
v3: New.
--- a/tools/tests/x86_emulator/evex-disp8.c
+++ b/tools/tests/x86_emulator/evex-disp8.c
@@ -727,6 +727,11 @@ static const struct test movrs_all[] = {
INSN(movrsw, f2, map5, 6f, vl, w, vl),
};
+static const struct test sm4_all[] = {
+ INSN(sm4key4, f3, 0f38, da, vl, d_nb, vl),
+ INSN(sm4rnds4, f2, 0f38, da, vl, d_nb, vl),
+};
+
static const unsigned char vl_all[] = { VL_512, VL_128, VL_256 };
static const unsigned char vl_128[] = { VL_128 };
static const unsigned char vl_no128[] = { VL_512, VL_256 };
@@ -1124,5 +1129,6 @@ void evex_disp8_test(void *instr, struct
if ( cpu_has_avx10 )
{
run(ctxt->addr_size == 64 && cpu_has_movrs, movrs, all);
+ run(cpu_has_sm4, sm4, all);
}
}
--- a/tools/tests/x86_emulator/predicates.c
+++ b/tools/tests/x86_emulator/predicates.c
@@ -2025,6 +2025,8 @@ static const struct evex {
{ { 0xcc }, 2, T, R, pfx_66, Wn, L2 }, /* vrsqrt28p{s,d} */
{ { 0xcd }, 2, T, R, pfx_66, Wn, LIG }, /* vrsqrt28s{s,d} */
{ { 0xcf }, 2, T, R, pfx_66, W0, Ln }, /* vgf2p8mulb */
+ { { 0xda }, 2, T, R, pfx_f3, W0, Ln }, /* vsm4key4 */
+ { { 0xda }, 2, T, R, pfx_f2, W0, Ln }, /* vsm4rnds4 */
{ { 0xdc }, 2, T, R, pfx_66, WIG, Ln }, /* vaesenc */
{ { 0xdd }, 2, T, R, pfx_66, WIG, Ln }, /* vaesenclast */
{ { 0xde }, 2, T, R, pfx_66, WIG, Ln }, /* vaesdec */
--- a/xen/arch/x86/x86_emulate/decode.c
+++ b/xen/arch/x86/x86_emulate/decode.c
@@ -438,7 +438,7 @@ static const struct ext0f38_table {
[0xd3] = { .simd_size = simd_other },
[0xd6] = { .simd_size = simd_other, .d8s = d8s_vl },
[0xd7] = { .simd_size = simd_scalar_vexw, .d8s = d8s_dq },
- [0xda] = { .simd_size = simd_other },
+ [0xda] = { .simd_size = simd_other, .d8s = d8s_vl },
[0xdb] = { .simd_size = simd_packed_int, .two_op = 1 },
[0xdc ... 0xdf] = { .simd_size = simd_packed_int, .d8s = d8s_vl },
[0xe0 ... 0xef] = { .to_mem = 1 },
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -6819,6 +6819,15 @@ x86_emulate(
op_bytes = 16 << vex.l;
goto simd_0f_ymm;
+ case X86EMUL_OPC_EVEX_F3(0x0f38, 0xda): /* vsm4key4
[xyz]mm/mem,[xyz]mm,[xyz]mm */
+ case X86EMUL_OPC_EVEX_F2(0x0f38, 0xda): /* vsm4rnds4
[xyz]mm/mem,[xyz]mm,[xyz]mm */
+ vcpu_must_have(avx10);
+ vcpu_must_have(sm4);
+ generate_exception_if(evex.w || evex.brs || evex.opmsk, X86_EXC_UD);
+ avx512_vlen_check(false);
+ op_bytes = 16 << evex.lr;
+ goto simd_zmm;
+
case X86EMUL_OPC_VEX_66(0x0f38, 0xdc): /* vaesenc
{x,y}mm/mem,{x,y}mm,{x,y}mm */
case X86EMUL_OPC_VEX_66(0x0f38, 0xdd): /* vaesenclast
{x,y}mm/mem,{x,y}mm,{x,y}mm */
case X86EMUL_OPC_VEX_66(0x0f38, 0xde): /* vaesdec
{x,y}mm/mem,{x,y}mm,{x,y}mm */
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |