1. 03 10月, 2018 14 次提交
  2. 23 8月, 2018 1 次提交
    • P
      fix "Missing break in switch" coverity reports · edd7541b
      Paolo Bonzini 提交于
      Many of these are marked as "intentional/fix required" because they
      just need adding a fall through comment.  This is exactly what this
      patch does, except for target/mips/translate.c where it is easier to
      duplicate the code, and hw/audio/sb16.c where I consulted the DOSBox
      sources and decide to just remove the LOG_UNIMP before the fallthrough.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      edd7541b
  3. 29 6月, 2018 2 次提交
  4. 02 6月, 2018 1 次提交
  5. 20 5月, 2018 1 次提交
  6. 10 5月, 2018 1 次提交
  7. 09 4月, 2018 1 次提交
  8. 05 4月, 2018 1 次提交
    • A
      target/i386: Fix andn instruction · 5cd10051
      Alexandro Sanchez Bach 提交于
      In commit 7073fbad, the `andn` instruction
      was implemented via `tcg_gen_andc` but passes the operands in the wrong
      order:
      - X86 defines `andn dest,src1,src2` as: dest = ~src1 & src2
      - TCG defines `andc dest,src1,src2` as: dest = src1 & ~src2
      
      The following simple test shows the issue:
      
          #include <stdio.h>
          #include <stdint.h>
      
          int main(void) {
              uint32_t ret = 0;
              __asm (
                  "mov $0xFF00, %%ecx\n"
                  "mov $0x0F0F, %%eax\n"
                  "andn %%ecx, %%eax, %%ecx\n"
                  "mov %%ecx, %0\n"
                : "=r" (ret));
              printf("%08X\n", ret);
              return 0;
          }
      
      This patch fixes the problem by simply swapping the order of the two last
      arguments in `tcg_gen_andc_tl`.
      Reported-by: NAlexandro Sanchez Bach <alexandro@phi.nz>
      Signed-off-by: NAlexandro Sanchez Bach <alexandro@phi.nz>
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      5cd10051
  9. 30 12月, 2017 1 次提交
  10. 21 12月, 2017 2 次提交
    • P
      target/i386: Fix handling of VEX prefixes · cfcca361
      Peter Maydell 提交于
      In commit e3af7c78 we
      replaced direct calls to to cpu_ld*_code() with calls
      to the x86_ld*_code() wrappers which incorporate an
      advance of s->pc. Unfortunately we didn't notice that
      in one place the old code was deliberately not incrementing
      s->pc:
      
      @@ -4501,7 +4528,7 @@ static target_ulong disas_insn(DisasContext *s, CPUState *cpu)
                   static const int pp_prefix[4] = {
                       0, PREFIX_DATA, PREFIX_REPZ, PREFIX_REPNZ
                   };
      -            int vex3, vex2 = cpu_ldub_code(env, s->pc);
      +            int vex3, vex2 = x86_ldub_code(env, s);
      
                   if (!CODE64(s) && (vex2 & 0xc0) != 0xc0) {
                       /* 4.1.4.6: In 32-bit mode, bits [7:6] must be 11b,
      
      This meant we were mishandling this set of instructions.
      Remove the manual advance of s->pc for the "is VEX" case
      (which is now done by x86_ldub_code()) and instead rewind
      PC in the case where we decide that this isn't really VEX.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Cc: qemu-stable@nongnu.org
      Reported-by: NAlexandro Sanchez Bach <alexandro@phi.nz>
      Message-Id: <1513163959-17545-1-git-send-email-peter.maydell@linaro.org>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      cfcca361
    • S
      target/i386: Fix compiler warnings · a4926d99
      Stefan Weil 提交于
      These gcc warnings are fixed:
      
      target/i386/translate.c:4461:12: warning:
       variable 'prefixes' might be clobbered by 'longjmp' or 'vfork' [-Wclobbered]
      target/i386/translate.c:4466:9: warning:
       variable 'rex_w' might be clobbered by 'longjmp' or 'vfork' [-Wclobbered]
      target/i386/translate.c:4466:16: warning:
       variable 'rex_r' might be clobbered by 'longjmp' or 'vfork' [-Wclobbered]
      
      Tested with x86_64-w64-mingw32-gcc from Debian stretch.
      Signed-off-by: NStefan Weil <sw@weilnetz.de>
      Message-Id: <20171113064845.29142-1-sw@weilnetz.de>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      a4926d99
  11. 25 10月, 2017 8 次提交
  12. 17 10月, 2017 2 次提交
    • P
      target/i386: trap on instructions longer than >15 bytes · b066c537
      Paolo Bonzini 提交于
      Besides being more correct, arbitrarily long instruction allow the
      generation of a translation block that spans three pages.  This
      confuses the generator and even allows ring 3 code to poison the
      translation block cache and inject code into other processes that are
      in guest ring 3.
      
      This is an improved (and more invasive) fix for commit 30663fd2 ("tcg/i386:
      Check the size of instruction being translated", 2017-03-24).  In addition
      to being more precise (and generating the right exception, which is #GP
      rather than #UD), it distinguishes better between page faults and too long
      instructions, as shown by this test case:
      
          #include <sys/mman.h>
          #include <string.h>
          #include <stdio.h>
      
          int main()
          {
                  char *x = mmap(NULL, 8192, PROT_READ|PROT_WRITE|PROT_EXEC,
                                 MAP_PRIVATE|MAP_ANON, -1, 0);
                  memset(x, 0x66, 4096);
                  x[4096] = 0x90;
                  x[4097] = 0xc3;
                  char *i = x + 4096 - 15;
                  mprotect(x + 4096, 4096, PROT_READ|PROT_WRITE);
                  ((void(*)(void)) i) ();
          }
      
      ... which produces a #GP without the mprotect, and a #PF with it.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      b066c537
    • P
      target/i386: introduce x86_ld*_code · e3af7c78
      Paolo Bonzini 提交于
      These take care of advancing s->pc, and will provide a unified point
      where to check for the 15-byte instruction length limit.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      e3af7c78
  13. 10 10月, 2017 2 次提交
  14. 19 9月, 2017 1 次提交
    • J
      target/i386: set rip_offset for further SSE instructions · c6a82429
      Joseph Myers 提交于
      It turns out that my recent fix to set rip_offset when emulating some
      SSE4.1 instructions needs generalizing to cover a wider class of
      instructions.  Specifically, every instruction in the sse_op_table7
      table, coming from various instruction set extensions, has an 8-bit
      immediate operand that comes after any memory operand, and so needs
      rip_offset set for correctness if there is a memory operand that is
      rip-relative, and my patch only set it for a subset of those
      instructions.  This patch moves the rip_offset setting to cover the
      wider class of instructions, so fixing 9 further gcc testsuite
      failures in my GCC 6-based testing.  (I do not know whether there
      might be still further classes of instructions missing this setting.)
      Signed-off-by: NJoseph Myers <joseph@codesourcery.com>
      
      Message-Id: <alpine.DEB.2.20.1708082350340.23380@digraph.polyomino.org.uk>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      c6a82429
  15. 06 9月, 2017 2 次提交