Skip to content
Snippets Groups Projects
  1. Apr 09, 2018
  2. Apr 05, 2018
    • Alexandro Sanchez Bach's avatar
      target/i386: Fix andn instruction · 5cd10051
      Alexandro Sanchez Bach authored
      
      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: default avatarAlexandro Sanchez Bach <alexandro@phi.nz>
      Signed-off-by: default avatarAlexandro Sanchez Bach <alexandro@phi.nz>
      Cc: qemu-stable@nongnu.org
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      5cd10051
  3. Apr 03, 2018
  4. Mar 29, 2018
    • Michael Clark's avatar
      RISC-V: Workaround for critical mstatus.FS bug · b0240336
      Michael Clark authored
      
      This change is a workaround for a bug where mstatus.FS
      is not correctly reporting dirty after operations that
      modify floating point registers. This a critical bug
      or RISC-V in QEMU as it results in floating point
      register file corruption when running SMP Linux due to
      task migration and possibly uniprocessor Linux if
      more than one process is using the FPU.
      
      This workaround will return dirty if mstatus.FS is
      switched from off to initial or clean. According to
      the specification it is legal for an implementation
      to return only off, or dirty.
      
      Cc: Palmer Dabbelt <palmer@sifive.com>
      Cc: Sagar Karandikar <sagark@eecs.berkeley.edu>
      Cc: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
      Cc: Peter Maydell <peter.maydell@linaro.org>
      Cc: Alex Bennée <alex.bennee@linaro.org>
      Cc: Richard Henderson <richard.henderson@linaro.org>
      Cc: Philippe Mathieu-Daudé <f4bug@amsat.org>
      Tested-by: default avatarRichard W.M. Jones <rjones@redhat.com>
      Signed-off-by: default avatarMichael Clark <mjc@sifive.com>
      Reviewed-by: default avatarRichard Henderson <richard.henderson@linaro.org>
  5. Mar 28, 2018
  6. Mar 27, 2018
  7. Mar 26, 2018
  8. Mar 23, 2018
    • Peter Maydell's avatar
      target/arm: Always set FAR to a known unknown value for debug exceptions · 548f514c
      Peter Maydell authored
      
      For debug exceptions due to breakpoints or the BKPT instruction which
      are taken to AArch32, the Fault Address Register is architecturally
      UNKNOWN.  We were using that as license to simply not set
      env->exception.vaddress, but this isn't correct, because it will
      expose to the guest whatever old value was in that field when
      arm_cpu_do_interrupt_aarch32() writes it to the guest IFSR.  That old
      value might be a FAR for a previous guest EL2 or secure exception, in
      which case we shouldn't show it to an EL1 or non-secure exception
      handler. It might also be a non-deterministic value, which is bad
      for record-and-replay.
      
      Clear env->exception.vaddress before taking breakpoint debug
      exceptions, to avoid this minor information leak.
      
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Message-id: 20180320134114.30418-5-peter.maydell@linaro.org
      548f514c
    • Peter Maydell's avatar
      target/arm: Set FSR for BKPT, BRK when raising exception · 62b94f31
      Peter Maydell authored
      Now that we have a helper function specifically for the BRK and
      BKPT instructions, we can set the exception.fsr there rather
      than in arm_cpu_do_interrupt_aarch32(). This allows us to
      use our new arm_debug_exception_fsr() helper.
      
      In particular this fixes a bug where we were hardcoding the
      short-form IFSR value, which is wrong if the target exception
      level has LPAE enabled.
      
      Fixes: https://bugs.launchpad.net/qemu/+bug/1756927
      
      
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Message-id: 20180320134114.30418-4-peter.maydell@linaro.org
      62b94f31
    • Peter Maydell's avatar
      target/arm: Factor out code to calculate FSR for debug exceptions · 81621d9a
      Peter Maydell authored
      
      When a debug exception is taken to AArch32, it appears as a Prefetch
      Abort, and the Instruction Fault Status Register (IFSR) must be set.
      The IFSR has two possible formats, depending on whether LPAE is in
      use. Factor out the code in arm_debug_excp_handler() which picks
      an FSR value into its own utility function, update it to use
      arm_fi_to_lfsc() and arm_fi_to_sfsc() rather than hard-coded constants,
      and use the correct condition to select long or short format.
      
      In particular this fixes a bug where we could select the short
      format because we're at EL0 and the EL1 translation regime is
      not using LPAE, but then route the debug exception to EL2 because
      of MDCR_EL2.TDE and hand EL2 the wrong format FSR.
      
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Message-id: 20180320134114.30418-3-peter.maydell@linaro.org
      81621d9a
    • Peter Maydell's avatar
      target/arm: Honour MDCR_EL2.TDE when routing exceptions due to BKPT/BRK · c900a2e6
      Peter Maydell authored
      
      The MDCR_EL2.TDE bit allows the exception level targeted by debug
      exceptions to be set to EL2 for code executing at EL0.  We handle
      this in the arm_debug_target_el() function, but this is only used for
      hardware breakpoint and watchpoint exceptions, not for the exception
      generated when the guest executes an AArch32 BKPT or AArch64 BRK
      instruction.  We don't have enough information for a translate-time
      equivalent of arm_debug_target_el(), so instead make BKPT and BRK
      call a special purpose helper which can do the routing, rather than
      the generic exception_with_syndrome helper.
      
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Message-id: 20180320134114.30418-2-peter.maydell@linaro.org
      c900a2e6
    • Victor Kamensky's avatar
      arm/translate-a64: treat DISAS_UPDATE as variant of DISAS_EXIT · a75a52d6
      Victor Kamensky authored
      
      In OE project 4.15 linux kernel boot hang was observed under
      single cpu aarch64 qemu. Kernel code was in a loop waiting for
      vtimer arrival, spinning in TC generated blocks, while interrupt
      was pending unprocessed. This happened because when qemu tried to
      handle vtimer interrupt target had interrupts disabled, as
      result flag indicating TCG exit, cpu->icount_decr.u16.high,
      was cleared but arm_cpu_exec_interrupt function did not call
      arm_cpu_do_interrupt to process interrupt. Later when target
      reenabled interrupts, it happened without exit into main loop, so
      following code that waited for result of interrupt execution
      run in infinite loop.
      
      To solve the problem instructions that operate on CPU sys state
      (i.e enable/disable interrupt), and marked as DISAS_UPDATE,
      should be considered as DISAS_EXIT variant, and should be
      forced to exit back to main loop so qemu will have a chance
      processing pending CPU state updates, including pending
      interrupts.
      
      This change brings consistency with how DISAS_UPDATE is treated
      in aarch32 case.
      
      CC: Peter Maydell <peter.maydell@linaro.org>
      CC: Alex Bennée <alex.bennee@linaro.org>
      CC: qemu-stable@nongnu.org
      Suggested-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      Signed-off-by: default avatarVictor Kamensky <kamensky@cisco.com>
      Reviewed-by: default avatarRichard Henderson <richard.henderson@linaro.org>
      Message-id: 1521526368-1996-1-git-send-email-kamensky@cisco.com
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      a75a52d6
    • Christian Borntraeger's avatar
      s390x/cpumodel: fix feature groups and breakage of MSA8 · 06a97eda
      Christian Borntraeger authored
      
      Since commit 46a99c9f ("s390x/cpumodel: model PTFF subfunctions
      for Multiple-epoch facility") -cpu help no longer shows the MSA8
      feature group. Turns out that we forgot to add the new MEPOCH_PTFF
      group enum.
      
      Fixes: 46a99c9f ("s390x/cpumodel: model PTFF subfunctions for Multiple-epoch facility")
      Reviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
      Signed-off-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
      06a97eda
  9. Mar 20, 2018
  10. Mar 19, 2018
  11. Mar 18, 2018
  12. Mar 16, 2018
    • Max Filippov's avatar
      target/xtensa: add linux-user support · ba7651fb
      Max Filippov authored
      
      Import list of syscalls from the kernel source. Conditionalize code/data
      that is only used with softmmu. Implement exception handlers. Implement
      signal hander (only the core registers for now, no coprocessors or TIE).
      
      Cc: Riku Voipio <riku.voipio@iki.fi>
      Cc: Laurent Vivier <laurent@vivier.eu>
      Signed-off-by: default avatarMax Filippov <jcmvbkbc@gmail.com>
      ba7651fb
  13. Mar 13, 2018
Loading