1. 21 4月, 2017 2 次提交
  2. 20 3月, 2017 4 次提交
    • P
      arm: Fix APSR writes via M profile MSR · b28b3377
      Peter Maydell 提交于
      Our implementation of writes to the APSR for M-profile via the MSR
      instruction was badly broken.
      
      First and worst, we had the sense wrong on the test of bit 2 of the
      SYSm field -- this is supposed to request an APSR write if bit 2 is 0
      but we were doing it if bit 2 was 1.  This bug was introduced in
      commit 58117c9b, so hasn't been in a QEMU release.
      
      Secondly, the choice of exactly which parts of APSR should be written
      is defined by bits in the 'mask' field.  We were not passing these
      through from instruction decode, making it impossible to check them
      in the helper.
      
      Pass the mask bits through from the instruction decode to the helper
      function and process them appropriately; fix the wrong sense of the
      SYSm bit 2 check.
      
      Invalid mask values and invalid combinations of mask and register
      number are UNPREDICTABLE; we choose to treat them as if the mask
      values were valid.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Message-id: 1487616072-9226-5-git-send-email-peter.maydell@linaro.org
      Reviewed-by: NAlex Bennée <alex.bennee@linaro.org>
      b28b3377
    • P
      arm: Enforce should-be-1 bits in MRS decoding · 3d54026f
      Peter Maydell 提交于
      The MRS instruction requires that bits [19..16] are all 1s, and for
      A/R profile also that bits [7..0] are all 0s.  At this point in the
      decode tree we have checked all of the rest of the instruction but
      were allowing these to be any value.  If these bits are not set then
      the result is architecturally UNPREDICTABLE, but choosing to UNDEF is
      more helpful to the user and avoids unexpected odd behaviour if the
      encodings are used for some purpose in future architecture versions.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NAlex Bennée <alex.bennee@linaro.org>
      Message-id: 1487616072-9226-4-git-send-email-peter.maydell@linaro.org
      3d54026f
    • P
      arm: Don't decode MRS(banked) or MSR(banked) for M profile · 43ac6574
      Peter Maydell 提交于
      M profile doesn't have the MSR(banked) and MRS(banked) instructions
      and uses the encodings for different kinds of M-profile MRS/MSR.
      Guard the relevant bits of the decode logic to make sure we don't
      accidentally fall into them by accident on M-profile.
      
      (The bit being checked for this (bit 5) is part of the SYSm field on
      M-profile, but since no currently allocated system registers have
      encodings with bit 5 of SYSm set, this hasn't been a problem in
      practice.)
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NAlex Bennée <alex.bennee@linaro.org>
      Message-id: 1487616072-9226-3-git-send-email-peter.maydell@linaro.org
      43ac6574
    • P
      arm: HVC and SMC encodings don't exist for M profile · 001b3cab
      Peter Maydell 提交于
      M profile doesn't have the HVC or SMC encodings, so make them always
      UNDEF rather than generating calls to helper functions that assume
      A/R profile.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NAlex Bennée <alex.bennee@linaro.org>
      Message-id: 1487616072-9226-2-git-send-email-peter.maydell@linaro.org
      001b3cab
  3. 28 2月, 2017 1 次提交
  4. 24 2月, 2017 1 次提交
  5. 08 2月, 2017 2 次提交
  6. 27 1月, 2017 2 次提交
    • P
      armv7m: Report no-coprocessor faults correctly · 7517748e
      Peter Maydell 提交于
      For v7M attempts to access a nonexistent coprocessor are reported
      differently from plain undefined instructions (as UsageFaults of type
      NOCP rather than type UNDEFINSTR).  Split them out into a new
      EXCP_NOCP so we can report the FSR value correctly.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NAlex Bennée <alex.bennee@linaro.org>
      Message-id: 1485285380-10565-8-git-send-email-peter.maydell@linaro.org
      7517748e
    • M
      armv7m: Replace armv7m.hack with unassigned_access handler · 542b3478
      Michael Davidsaver 提交于
      For v7m we need to catch attempts to execute from special
      addresses at 0xfffffff0 and above. Previously we did this
      with the aid of a hacky special purpose lump of memory
      in the address space and a check in translate.c for whether
      we were translating code at those addresses.
      
      We can implement this more cleanly using a CPU
      unassigned access handler which throws the exception
      if the unassigned access is for one of the special addresses.
      Signed-off-by: NMichael Davidsaver <mdavidsaver@gmail.com>
      Reviewed-by: NAlex Bennée <alex.bennee@linaro.org>
      Message-id: 1484937883-1068-3-git-send-email-peter.maydell@linaro.org
      [PMM:
       * drop the deletion of the "don't interrupt if PC is magic"
         code in arm_v7m_cpu_exec_interrupt() -- this is still
         required
       * don't generate an exception for unassigned accesses
         which aren't to the magic address -- although doing
         this is in theory correct in practice it will break
         currently working guests which rely on the RAZ/WI
         behaviour when they touch devices which we haven't
         modelled.
       * trigger EXCP_EXCEPTION_EXIT on is_exec, not !is_write
      ]
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      542b3478
  7. 11 1月, 2017 2 次提交
  8. 21 12月, 2016 1 次提交
    • T
      Move target-* CPU file into a target/ folder · fcf5ef2a
      Thomas Huth 提交于
      We've currently got 18 architectures in QEMU, and thus 18 target-xxx
      folders in the root folder of the QEMU source tree. More architectures
      (e.g. RISC-V, AVR) are likely to be included soon, too, so the main
      folder of the QEMU sources slowly gets quite overcrowded with the
      target-xxx folders.
      To disburden the main folder a little bit, let's move the target-xxx
      folders into a dedicated target/ folder, so that target-xxx/ simply
      becomes target/xxx/ instead.
      
      Acked-by: Laurent Vivier <laurent@vivier.eu> [m68k part]
      Acked-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de> [tricore part]
      Acked-by: Michael Walle <michael@walle.cc> [lm32 part]
      Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com> [s390x part]
      Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com> [s390x part]
      Acked-by: Eduardo Habkost <ehabkost@redhat.com> [i386 part]
      Acked-by: Artyom Tarasenko <atar4qemu@gmail.com> [sparc part]
      Acked-by: Richard Henderson <rth@twiddle.net> [alpha part]
      Acked-by: Max Filippov <jcmvbkbc@gmail.com> [xtensa part]
      Reviewed-by: David Gibson <david@gibson.dropbear.id.au> [ppc part]
      Acked-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> [cris&microblaze part]
      Acked-by: Guan Xuetao <gxt@mprc.pku.edu.cn> [unicore32 part]
      Signed-off-by: NThomas Huth <thuth@redhat.com>
      fcf5ef2a
  9. 02 11月, 2016 1 次提交
    • R
      log: Add locking to large logging blocks · 1ee73216
      Richard Henderson 提交于
      Reuse the existing locking provided by stdio to keep in_asm, cpu,
      op, op_opt, op_ind, and out_asm as contiguous blocks.
      
      While it isn't possible to interleave e.g. in_asm or op_opt logs
      because of the TB lock protecting all code generation, it is
      possible to interleave cpu logs, or to interleave a cpu dump with
      an out_asm dump.
      
      For mingw32, we appear to have no viable solution for this.  The locking
      functions are not properly exported from the system runtime library.
      Reviewed-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NRichard Henderson <rth@twiddle.net>
      1ee73216
  10. 26 10月, 2016 4 次提交
    • E
      target-arm: remove EXCP_STREX + cpu_exclusive_{test, info} · 05188cc7
      Emilio G. Cota 提交于
      The exception is not emitted anymore; remove it and the associated
      TCG variables.
      Reviewed-by: NAlex Bennée <alex.bennee@linaro.org>
      Signed-off-by: NEmilio G. Cota <cota@braap.org>
      Signed-off-by: NRichard Henderson <rth@twiddle.net>
      Message-Id: <1467054136-10430-31-git-send-email-cota@braap.org>
      05188cc7
    • E
      target-arm: emulate SWP with atomic_xchg helper · cf12bce0
      Emilio G. Cota 提交于
      Signed-off-by: NEmilio G. Cota <cota@braap.org>
      Message-Id: <1467054136-10430-25-git-send-email-cota@braap.org>
      Signed-off-by: NRichard Henderson <rth@twiddle.net>
      cf12bce0
    • E
      target-arm: emulate LL/SC using cmpxchg helpers · 354161b3
      Emilio G. Cota 提交于
      Emulating LL/SC with cmpxchg is not correct, since it can
      suffer from the ABA problem. Portable parallel code, however,
      is written assuming only cmpxchg--and not LL/SC--is available.
      This means that in practice emulating LL/SC with cmpxchg is
      a viable alternative.
      
      The appended emulates LL/SC pairs in ARM with cmpxchg helpers.
      This works in both user and system mode. In usermode, it avoids
      pausing all other CPUs to perform the LL/SC pair. The subsequent
      performance and scalability improvement is significant, as the
      plots below show. They plot the throughput of atomic_add-bench
      compiled for ARM and executed on a 64-core x86 machine.
      
      Hi-res plots: http://imgur.com/a/aNQpB
      
                     atomic_add-bench: 1000000 ops/thread, [0,1] range
      
        9 ++---------+----------+----------+----------+----------+----------+---++
          +cmpxchg +-E--+       +          +          +          +          +    |
        8 +Emaster +-H--+                                                       ++
          | |                                                                    |
        7 ++E                                                                   ++
          | |                                                                    |
        6 ++++                                                                  ++
          |  |                                                                   |
        5 ++ |                                                                  ++
        4 ++ |                                                                  ++
          |  |                                                                   |
        3 ++ |                                                                  ++
          |   |                                                                  |
        2 ++  |                                                                 ++
          |H++E+---                                  +++  ---+E+------+E+------+E|
        1 +++     +E+-----+E+------+E+------+E+------+E+--   +++      +++       ++
          ++H+       +    +++   +  +++     ++++       +          +          +    |
        0 ++--H----H-+-----H----+----------+----------+----------+----------+---++
          0          10         20         30         40         50         60
                                     Number of threads
      
                      atomic_add-bench: 1000000 ops/thread, [0,2] range
      
        16 ++---------+----------+---------+----------+----------+----------+---++
           +cmpxchg +-E--+       +         +          +          +          +    |
        14 ++master +-H--+                                                      ++
           | |                                                                   |
        12 ++|                                                                  ++
           | E                                                                   |
        10 ++|                                                                  ++
           | |                                                                   |
         8 ++++                                                                 ++
           |E+|                                                                  |
           |  |                                                                  |
         6 ++ |                                                                 ++
           |   |                                                                 |
         4 ++  |                                                                ++
           |  +E+---       +++      +++              +++           ---+E+------+E|
         2 +H+     +E+------E-------+E+-----+E+------+E+------+E+--            +++
           + |        +    +++   +         ++++       +          +          +    |
         0 ++H-H----H-+-----H----+---------+----------+----------+----------+---++
           0          10         20        30         40         50         60
                                      Number of threads
      
                     atomic_add-bench: 1000000 ops/thread, [0,128] range
      
        70 ++---------+----------+---------+----------+----------+----------+---++
           +cmpxchg +-E--+       +         +          +       ++++          +    |
        60 ++master +-H--+                                 ----E------+E+-------++
           |                                        -+E+---   +++     +++      +E|
           |                                +++ ---- +++                       ++|
        50 ++                       +++  ---+E+-                                ++
           |                        -E---                                        |
        40 ++                    ---+++                                         ++
           |               +++---                                                |
           |              -+E+                                                   |
        30 ++      +++----                                                      ++
           |       +E+                                                           |
        20 ++ +++--                                                             ++
           |  +E+                                                                |
           |+E+                                                                  |
        10 +E+                                                                  ++
           +          +          +         +          +          +          +    |
         0 +HH-H----H-+-----H----+---------+----------+----------+----------+---++
           0          10         20        30         40         50         60
                                      Number of threads
      
                    atomic_add-bench: 1000000 ops/thread, [0,1024] range
      
        120 ++---------+---------+----------+---------+----------+----------+---++
            +cmpxchg +-E--+      +          +         +          +          +    |
            | master +-H--+                                                    ++|
        100 ++                                                              ----E+
            |                                                 +++  ---+E+---   ++|
            |                                                --E---   +++        |
         80 ++                                           ---- +++               ++
            |                                     ---+E+-                        |
         60 ++                              -+E+--                              ++
            |                       +++ ---- +++                                 |
            |                      -+E+-                                         |
         40 ++              +++----                                             ++
            |      +++   ---+E+                                                  |
            |     -+E+---                                                        |
         20 ++ +E+                                                              ++
            |+E+++                                                               |
            +E+        +         +          +         +          +          +    |
          0 +HH-H---H--+-----H---+----------+---------+----------+----------+---++
            0          10        20         30        40         50         60
                                      Number of threads
      
      [rth: Enforce alignment for ldrexd.]
      Reviewed-by: NAlex Bennée <alex.bennee@linaro.org>
      Signed-off-by: NEmilio G. Cota <cota@braap.org>
      Message-Id: <1467054136-10430-23-git-send-email-cota@braap.org>
      Signed-off-by: NRichard Henderson <rth@twiddle.net>
      354161b3
    • R
      target-arm: Rearrange aa32 load and store functions · 7f5616f5
      Richard Henderson 提交于
      Stop specializing on TARGET_LONG_BITS == 32; unconditionally allocate
      a temp and expand with tcg_gen_extu_i32_tl.  Split out gen_aa32_addr,
      gen_aa32_frob64, gen_aa32_ld_i32 and gen_aa32_st_i32 as separate interfaces.
      Reviewed-by: NAlex Bennée <alex.bennee@linaro.org>
      Signed-off-by: NRichard Henderson <rth@twiddle.net>
      7f5616f5
  11. 24 10月, 2016 1 次提交
    • P
      target-arm: Implement new HLT trap for semihosting · 19a6e31c
      Peter Maydell 提交于
      Version 2.0 of the semihosting specification introduces new trap
      instructions for AArch32: HLT 0xF000 for A32 and HLT 0x3C for T32.
      Implement these (in the same way we implement the existing HLT
      semihosting trap for A64).
      
      The old traps via SVC and BKPT are unaffected.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Message-id: 1476792973-18508-1-git-send-email-peter.maydell@linaro.org
      19a6e31c
  12. 18 10月, 2016 1 次提交
    • P
      Fix masking of PC lower bits when doing exception returns · fb0e8e79
      Peter Maydell 提交于
      In commit 9b6a3ea7 store_reg() was changed to mask
      both bits 0 and 1 of the new PC value when in ARM mode.
      Unfortunately this broke the exception return code paths
      when doing a return from ARM mode to Thumb mode: in some
      of these we write a new CPSR including new Thumb mode
      bit via gen_helper_cpsr_write_eret(), and then use store_reg()
      to write the new PC. In this case if the new CPSR specified
      Thumb mode then masking bit 1 of the PC is incorrect
      (these code paths correspond to the v8 ARM ARM pseudocode
      function AArch32.ExceptionReturn(), which always aligns the
      new PC appropriately for the new instruction set state).
      
      Instead of using store_reg() in exception-return code paths,
      call a new store_pc_exc_ret() which stores the raw new PC
      value to env->regs[15], and then mask it appropriately in
      the subsequent helper_cpsr_write_eret() where the new
      env->thumb state is available.
      
      This fixes a bug introduced by 9b6a3ea7 which caused
      crashes/hangs or otherwise bad behaviour for Linux when
      userspace was using Thumb.
      Reported-by: NJerome Forissier <jerome.forissier@linaro.org>
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Message-id: 1476113163-24578-1-git-send-email-peter.maydell@linaro.org
      fb0e8e79
  13. 04 10月, 2016 1 次提交
    • P
      target-arm: Correctly handle 'sub pc, pc, 1' for ARMv6 · 9b6a3ea7
      Peter Maydell 提交于
      In the ARM v6 architecture, 'sub pc, pc, 1' is not an interworking
      branch, so the computed new value is written to r15 as a normal
      value. The architecture says that in this case, bits [1:0] of
      the value written must be ignored if we are in ARM mode (or
      bit [0] ignored if in Thumb mode); this is a change from the
      ARMv4/v5 specification that behaviour is UNPREDICTABLE.
      Use the correct mask on the PC value when doing a non-interworking
      store to PC.
      
      A popular library used on RaspberryPi uses this instruction
      as part of a trick to determine whether it is running on
      ARMv6 or ARMv7, and we were mishandling the sequence.
      
      Fixes bug: https://bugs.launchpad.net/bugs/1625295
      
      Reported-by: <stu.axon@gmail.com>
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Message-id: 1474380941-4730-1-git-send-email-peter.maydell@linaro.org
      9b6a3ea7
  14. 16 9月, 2016 1 次提交
  15. 20 6月, 2016 1 次提交
  16. 14 6月, 2016 1 次提交
  17. 06 6月, 2016 1 次提交
  18. 19 5月, 2016 1 次提交
  19. 13 5月, 2016 2 次提交
  20. 23 3月, 2016 1 次提交
  21. 17 3月, 2016 1 次提交
  22. 04 3月, 2016 7 次提交
  23. 01 3月, 2016 1 次提交
    • L
      tcg: Add type for vCPU pointers · 1bcea73e
      Lluís Vilanova 提交于
      Adds the 'TCGv_env' type for pointers to 'CPUArchState' objects. The
      tracing infrastructure later needs to differentiate between regular
      pointers and pointers to vCPUs.
      
      Also changes all targets to use the new 'TCGv_env' type instead of the
      generic 'TCGv_ptr'. As of now, the change is merely cosmetic ('TCGv_env'
      translates into 'TCGv_ptr'), but that could change in the future to
      enforce the difference.
      
      Note that a 'TCGv_env' type (for 'CPUState') is not added, since all
      helpers currently receive the architecture-specific
      pointer ('CPUArchState').
      Signed-off-by: NLluís Vilanova <vilanova@ac.upc.edu>
      Acked-by: NRichard Henderson <rth@twiddle.net>
      Message-id: 145641859552.30295.7821536833590725201.stgit@localhost
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      1bcea73e