[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] x86emul: add EVEX decoding
commit e3b002f842c0de957bc685bc00331c2cb34204de Author: Jan Beulich <jbeulich@xxxxxxxx> AuthorDate: Thu Sep 29 12:04:33 2016 +0200 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Thu Sep 29 12:04:33 2016 +0200 x86emul: add EVEX decoding This way we can at least size (and e.g. skip) them if needed, and we also won't raise the wrong fault due to not having read all relevant bytes. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> --- xen/arch/x86/x86_emulate/x86_emulate.c | 36 ++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c index 1053d2d..53cf2dd 100644 --- a/xen/arch/x86/x86_emulate/x86_emulate.c +++ b/xen/arch/x86/x86_emulate/x86_emulate.c @@ -336,6 +336,27 @@ union vex { ptr[1] = rex | REX_PREFIX; \ } while (0) +union evex { + uint8_t raw[3]; + struct { + uint8_t opcx:2; + uint8_t :2; + uint8_t R:1; + uint8_t b:1; + uint8_t x:1; + uint8_t r:1; + uint8_t pfx:2; + uint8_t evex:1; + uint8_t reg:4; + uint8_t w:1; + uint8_t opmsk:3; + uint8_t RX:1; + uint8_t bcst:1; + uint8_t lr:2; + uint8_t z:1; + }; +}; + #define rep_prefix() (vex.pfx >= vex_f3) #define repe_prefix() (vex.pfx == vex_f3) #define repne_prefix() (vex.pfx == vex_f2) @@ -1611,6 +1632,7 @@ struct x86_emulate_state { bool lock_prefix; opcode_desc_t desc; union vex vex; + union evex evex; int override_seg; /* @@ -1638,6 +1660,7 @@ struct x86_emulate_state { #define rex_prefix (state->rex_prefix) #define lock_prefix (state->lock_prefix) #define vex (state->vex) +#define evex (state->evex) #define override_seg (state->override_seg) #define ea (state->ea) @@ -1826,7 +1849,8 @@ x86_decode( modrm = insn_fetch_type(uint8_t); modrm_mod = (modrm & 0xc0) >> 6; - if ( !ext && ((b & ~1) == 0xc4 || (b == 0x8f && (modrm & 0x18))) ) + if ( !ext && ((b & ~1) == 0xc4 || (b == 0x8f && (modrm & 0x18)) || + b == 0x62) ) switch ( def_ad_bytes ) { default: @@ -1840,7 +1864,7 @@ x86_decode( break; /* fall through */ case 8: - /* VEX / XOP */ + /* VEX / XOP / EVEX */ generate_exception_if(rex_prefix || vex.pfx, EXC_UD, -1); vex.raw[0] = modrm; @@ -1867,6 +1891,14 @@ x86_decode( op_bytes = 8; } } + if ( b == 0x62 ) + { + evex.raw[0] = vex.raw[0]; + evex.raw[1] = vex.raw[1]; + evex.raw[2] = insn_fetch_type(uint8_t); + + vex.opcx = evex.opcx; + } } if ( mode_64bit() && !vex.r ) rex_prefix |= REX_R; -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |