• Vasily Gorbik's avatar
    x86/insn: Fix vector instruction decoding on big endian cross-compiles · 5ed934e5
    Vasily Gorbik authored
    Running instruction decoder posttest on an s390 host with an x86 target
    with allyesconfig shows errors. Instructions used in a couple of kernel
    objects could not be correctly decoded on big endian system.
    
      insn_decoder_test: warning: objdump says 6 bytes, but insn_get_length() says 5
      insn_decoder_test: warning: Found an x86 instruction decoder bug, please report this.
      insn_decoder_test: warning: ffffffff831eb4e1:    62 d1 fd 48 7f 04 24    vmovdqa64 %zmm0,(%r12)
      insn_decoder_test: warning: objdump says 7 bytes, but insn_get_length() says 6
      insn_decoder_test: warning: Found an x86 instruction decoder bug, please report this.
      insn_decoder_test: warning: ffffffff831eb4e8:    62 51 fd 48 7f 44 24 01         vmovdqa64 %zmm8,0x40(%r12)
      insn_decoder_test: warning: objdump says 8 bytes, but insn_get_length() says 6
    
    This is because in a few places instruction field bytes are set directly
    with further usage of "value". To address that introduce and use a
    insn_set_byte() helper, which correctly updates "value" on big endian
    systems.
    Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
    Acked-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
    Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
    5ed934e5
insn.h 7.8 KB